summaryrefslogtreecommitdiff
path: root/Python/import.c
AgeCommit message (Collapse)AuthorLines
1997-12-17Oops! Should've renamed dos_8x3 to dos-8x3 here, too.Guido van Rossum-3/+3
1997-12-05Jeff Rush: add definition for S_IFMT for VisualAge C/C++ under OS2.Guido van Rossum-0/+5
1997-10-31New policy for package imports: only a directory containingGuido van Rossum-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!
1997-10-31Instead of using _PyImport_Inittab[] directly, use the new "official"Guido van Rossum-4/+8
pointer *PyImport_Inittab which is initialized to _PyImport_Inittab.
1997-10-08Moved mac-specific speedup to a different place (Jack)Guido van Rossum-5/+5
1997-10-03Remove unreachable "return 1" at end of ensure_fromlist().Guido van Rossum-1/+1
1997-09-09Added docstrings. Not for the obsolete functions though.Guido van Rossum-6/+46
1997-09-09Deleted find_module_in_package and find_module_in_directory -- theyGuido van Rossum-53/+0
aren't needed and it was a mistake to add them.
1997-09-09Crrected a flow control error that caused the wrong error message whenGuido van Rossum-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.
1997-09-08Added support for __all__, which should be a list of modules to beGuido van Rossum-3/+16
imported when the user says "from package import *".
1997-09-07Bugfix: import A.B from inside package was busted by mark_miss optimization.Guido van Rossum-1/+1
1997-09-06Significant speedup -- when a submodule imports a global module, add aGuido van Rossum-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.)
1997-09-06Fix reload() for package submodules.Guido van Rossum-2/+24
1997-09-06Phase two of package import. "import a.b.c" and all variants now do theGuido van Rossum-17/+299
right thing. Still to do: - Make reload() of a submodule work. - Performance tweaks -- currently, a submodule that tries to import a global module *always* searches the package directory first, even if the global module was already imported. Not sure how to solve this one; probably need to record misses per package. - Documentation!
1997-09-05First part of package support.Guido van Rossum-129/+440
This doesn't yet support "import a.b.c" or "from a.b.c import x", but it does recognize directories. When importing a directory, it initializes __path__ to a list containing the directory name, and loads the __init__ module if found. The (internal) find_module() and load_module() functions are restructured so that they both also handle built-in and frozen modules and Mac resources (and directories of course). The imp module's find_module() and (new) load_module() also have this functionality. Moreover, imp unconditionally defines constants for all module types, and has two more new functions: find_module_in_package() and find_module_in_directory(). There's also a new API function, PyImport_ImportModuleEx(), which takes all four __import__ arguments (name, globals, locals, fromlist). The last three may be NULL. This is currently the same as PyImport_ImportModule() but in the future it will be able to do relative dotted-path imports. Other changes: - bltinmodule.c: in __import__, call PyImport_ImportModuleEx(). - ceval.c: always pass the fromlist to __import__, even if it is a C function, so PyImport_ImportModuleEx() is useful. - getmtime.c: the function has a second argument, the FILE*, on which it applies fstat(). According to Sjoerd this is much faster. The first (pathname) argument is ignored, but remains for backward compatibility (so the Mac version still works without changes). By cleverly combining the new imp functionality, the full support for dotted names in Python (mini.py, not checked in) is now about 7K, lavishly commented (vs. 14K for ni plus 11K for ihooks, also lavishly commented). Good night!
1997-08-15Keep gcc -Wall happyGuido van Rossum-1/+0
1997-08-14Added Jim Fulton's PyImport_Import(), which calls whateverGuido van Rossum-0/+78
__import__() hook is currently installed.
1997-08-12Use string interning and caching to get speedups on the mac (Jack).Guido van Rossum-1/+17
1997-08-05New rules for deleting modules. Rather than having an elaborateGuido van Rossum-1/+29
scheme based on object's types, have a simple two-phase scheme based on object's *names*: /* To make the execution order of destructors for global objects a bit more predictable, we first zap all objects whose name starts with a single underscore, before we clear the entire dictionary. We zap them by replacing them with None, rather than deleting them from the dictionary, to avoid rehashing the dictionary (to some extent). */
1997-08-02The last of the mass checkins for separate (sub)interpreters.Guido van Rossum-46/+120
Everything should now work again. See the comments for the .h files mass checkin (e.g. pystate.h) for more detail.
1997-07-21Removed some variables that are used to exchange data between import.c andGuido van Rossum-2/+2
importdl.c: the MAXSUFFIXSIZE macro is now defined in importdl.h, and the modules dictionary is now passed using PyImport_GetModuleDict(). Also undefine USE_SHLIB for AIX -- in AIX 4.2 and up, dlfcn.h exists but we don't want to use it.
1997-07-10Fix problem discovered by Greg McFarlane: when an imported moduleGuido van Rossum-0/+7
replaces its own entry in sys.module, reference count errors ensue; even if there is no reference count problem, it would be preferable for the import to yield the new thing in sys.modules anyway (if only because that's what later imports will yield). This opens the road to an official hack to implement a __getattr__ like feature for modules: stick an instance in sys.modules[__name__].
1997-05-14One last rename glitch: import_modules -> _PyImport_Modules.Guido van Rossum-15/+15
1997-05-07Instead of importing graminit.h whenever one of the three grammar 'root'Guido van Rossum-4/+1
symbols is needed, define these in Python.h with a Py_ prefix.
1997-04-29Oops, forgot one: inittab.Guido van Rossum-7/+7
1997-04-29Quickly renamed the remaining files -- this directory is done.Guido van Rossum-270/+282
1997-04-11Keep gcc -Wall and Microsoft VC happy.Guido van Rossum-5/+6
1997-03-11When -O is given, use ".pyo" instead of ".pyc".Guido van Rossum-1/+9
1997-01-24New magin number (because of linenumber table).Guido van Rossum-1/+1
1997-01-17New MAGIC number (code objects have one more item when marshalled).Guido van Rossum-1/+2
1996-12-05Keep gcc -Wall happy.Guido van Rossum-1/+5
1996-10-25New permission notice, includes CNRI.Guido van Rossum-12/+19
1996-08-22PYTHONWIN -> MS_COREDLLGuido van Rossum-1/+1
1996-08-08Added casts from unsigned char to char when calling rds_object() onGuido van Rossum-2/+2
frozen code.
1996-07-30Changes for slice and ellipsesGuido van Rossum-1/+1
1996-07-21new .pyc magic number (** operator)Guido van Rossum-1/+1
1996-06-28Slightly different Windows ifdefsGuido van Rossum-3/+2
1996-06-20Cosmetic change to the dox_8x3 hack.Guido van Rossum-4/+3
1996-06-17struct frozen is now struct _frozen and comes from import.h.Guido van Rossum-11/+5
1996-05-23moved verbose decl to pydebug.h; added dos_8x3 featureGuido van Rossum-2/+18
1996-05-16Remember source filename as <module>.__file__.Guido van Rossum-0/+3
1996-04-09Under NT, interface to mysterious module registry. (Mark H.)Guido van Rossum-0/+8
1996-02-21Change Mac creator from 'PYTH' to 'Pyth' -- 'PYTH' was already takenGuido van Rossum-1/+1
by someone else, 'Pyth' is now officially registered by the PSA.
1995-10-03Removed unused variablesJack Jansen-3/+1
1995-08-04add imp.get_frozen_object()Guido van Rossum-13/+54
1995-07-28Undef 'argument' before including mac headersJack Jansen-0/+2
1995-07-26never close the file in imp.load_...Guido van Rossum-6/+0
1995-07-18keyword arguments and faster callsGuido van Rossum-2/+2
1995-07-07new MAGIC; some changes to default files for imp.load_... functionsGuido van Rossum-8/+19
1995-06-18Added PY_RESOURCE (mac only) to imp moduleJack Jansen-0/+7