summaryrefslogtreecommitdiff
path: root/Include/import.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix issue #1590864, multiple threads and fork() can cause deadlocks, byThomas Wouters2009-09-161-0/+8
| | | | | | | | | | | | | | | | | | | | | | acquiring the import lock around fork() calls. This prevents other threads from having that lock while the fork happens, and is the recommended way of dealing with such issues. There are two other locks we care about, the GIL and the Thread Local Storage lock. The GIL is obviously held when calling Python functions like os.fork(), and the TLS lock is explicitly reallocated instead, while also deleting now-orphaned TLS data. This only fixes calls to os.fork(), not extension modules or embedding programs calling C's fork() directly. Solving that requires a new set of API functions, and possibly a rewrite of the Python/thread_*.c mess. Add a warning explaining the problem to the documentation in the mean time. This also changes behaviour a little on AIX. Before, AIX (but only AIX) was getting the import lock reallocated, seemingly to avoid this very same problem. This is not the right approach, because the import lock is a re-entrant one, and reallocating would do the wrong thing when forking while holding the import lock. Will backport to 2.6, minus the tiny AIX behaviour change.
* Fix two issues introduced by issue #71031 by changing the signature ofBrett Cannon2009-04-021-1/+1
| | | | PyImport_AppendInittab() to take a const char *.
* Modified PyImport_Import and PyImport_ImportModule to always use absolute ↵Christian Heimes2008-01-031-4/+1
| | | | | | 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
* Patch #1739468: Directories and zipfiles containing __main__.py are now ↵Nick Coghlan2007-11-181-0/+2
| | | | executable
* SF #1542693: Remove semi-colon at end of PyImport_ImportModuleEx macroNeal Norwitz2006-08-191-1/+1
|
* SF patch #1438387, PEP 328: relative and absolute imports.Thomas Wouters2006-02-281-0/+8
| | | | | | | | | | | | | | | | | | | | | | | - 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.
* Add const to several API functions that take char *.Jeremy Hylton2005-12-101-2/+2
| | | | | | | | | | | | | | | | | | | In C++, it's an error to pass a string literal to a char* function without a const_cast(). Rather than require every C++ extension module to put a cast around string literals, fix the API to state the const-ness. I focused on parts of the API where people usually pass literals: PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type slots, etc. Predictably, there were a large set of functions that needed to be fixed as a result of these changes. The most pervasive change was to make the keyword args list passed to PyArg_ParseTupleAndKewords() to be a const char *kwlist[]. One cast was required as a result of the changes: A type object mallocs the memory for its tp_doc slot and later frees it. PyTypeObject says that tp_doc is const char *; but if the type was created by type_new(), we know it is safe to cast to char *.
* - Changes donated by Elemental Security to make it work on AIX 5.3Guido van Rossum2005-09-141-0/+1
| | | | | with IBM's 64-bit compiler (SF patch #1284289). This also closes SF bug #105470: test_pwd fails on 64bit system (Opteron).
* SF patch #1035498: -m option to run a module as a scriptRaymond Hettinger2004-10-071-0/+4
| | | | (Contributed by Nick Coghlan.)
* Excise DL_IMPORT/EXPORT from object.h, and related files. This patchMark Hammond2002-07-291-6/+6
| | | | | also adds 'extern' to PyAPI_DATA rather than at each declaration, as discussed with Tim and Guido.
* Land Patch [ 566100 ] Rationalize DL_IMPORT and DL_EXPORT.Mark Hammond2002-07-191-17/+17
|
* 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.
* ANSIfications: fix empty arglists, and remove the checks forThomas Wouters2000-07-221-2/+2
| | | | 'HAVE_STDARG_PROTOTYPES' (consider it true, remove false branch)
* ANSI-fication and Py_PROTO extermination.Fred Drake2000-07-081-29/+29
|
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
|
* Change copyright notice.Guido van Rossum2000-06-301-21/+6
|
* Chris Herborth writes:Guido van Rossum1999-01-041-5/+0
| | | | Donn Cave tells me the PyImport_BeImageID() function isn't needed anymore.
* Add DL_IMPORT(returntype) for all officially exported functions.Guido van Rossum1998-12-041-16/+16
|
* Changes for BeOS, QNX and long long, by Chris Herborth.Guido van Rossum1998-08-041-0/+5
|
* Add PyImport_AppendInittab() an PyImport_ExtendInittab().Guido van Rossum1998-06-291-0/+3
|
* Added PyImport_ExecCodeModuleEx(), which adds an extra parameter to passGuido van Rossum1998-02-111-0/+2
| | | | it the true file.
* Remove the declaration of "internal" table _PyImport_Inittab[]; addGuido van Rossum1997-10-311-3/+1
| | | | new "official" pointer *PyImport_Inittab.
* Added PyImport_ImportModuleEx(name, globals, locals, fromlist); thisGuido van Rossum1997-09-051-0/+2
| | | | | | is like PyImport_ImporModule(name) but receives the globals and locals dict and the fromlist arguments as well. (The name is a char*; the others are PyObject*s).
* Added prototype for PyImport_Import().Guido van Rossum1997-08-141-0/+1
|
* Mass checkin (more to follow for other directories).Guido van Rossum1997-08-021-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce truly separate (sub)interpreter objects. For now, these must be used by separate threads, created from C. See Demo/pysvr for an example of how to use this. This also rationalizes Python's initialization and finalization behavior: Py_Initialize() -- initialize the whole interpreter Py_Finalize() -- finalize the whole interpreter tstate = Py_NewInterpreter() -- create a new (sub)interpreter Py_EndInterpreter(tstate) -- delete a new (sub)interpreter There are also new interfaces relating to threads and the interpreter lock, which can be used to create new threads, and sometimes have to be used to manipulate the interpreter lock when creating or deleting sub-interpreters. These are only defined when WITH_THREAD is defined: PyEval_AcquireLock() -- acquire the interpreter lock PyEval_ReleaseLock() -- release the interpreter lock PyEval_AcquireThread(tstate) -- acquire the lock and make the thread current PyEval_ReleaseThread(tstate) -- release the lock and make NULL current Other administrative changes: - The header file bltinmodule.h is deleted. - The init functions for Import, Sys and Builtin are now internal and declared in pythonrun.h. - Py_Setup() and Py_Cleanup() are no longer declared. - The interpreter state and thread state structures are now linked together in a chain (the chain of interpreters is a static variable in pythonrun.c). - Some members of the interpreter and thread structures have new, shorter, more consistent, names. - Added declarations for _PyImport_{Find,Fixup}Extension() to import.h.
* Renamed inittab.Guido van Rossum1997-04-291-1/+1
|
* New permission notice, includes CNRI.Guido van Rossum1996-10-251-12/+19
|
* Add defs for struct _frozen and struct _frozen *PyImport_FrozenModules();Guido van Rossum1996-06-171-0/+13
|
* Added decl for PyImport_Init.Guido van Rossum1996-05-221-2/+6
| | | | Changed decl for inittab to define struct _inittab first.
* exec_dode_object/PyImport_ExecCodeObject is now externally visibleJack Jansen1995-02-151-1/+2
|
* The great renaming, phase two: all header files have been updated toGuido van Rossum1995-01-121-5/+5
| | | | | | | use the new names exclusively, and the linker will see the new names. Files that import "Python.h" also only see the new names. Files that import "allobjects.h" will continue to be able to use the old names, due to the inclusion (in allobjects.h) of "rename2.h".
* Added 1995 copyright.Guido van Rossum1995-01-041-2/+2
| | | | | | object.h: made sizes and refcnts signed ints. stringobject.h: make getstrsize() signed int. methodobject.h: add METH_VARARGS and METH_FREENAME flag bit definitions.
* Lots of small things, see ChangeLogGuido van Rossum1994-12-301-0/+1
|
* Merge alpha100 branch back to main trunkGuido van Rossum1994-08-011-1/+1
|
* * Added support for X11 modules.Guido van Rossum1993-07-281-0/+11
| | | | | | | * Makefile: change location of FORMS library. * posixmodule.c: turn #if 0 into #ifdef MSDOS (stuff in unistd.h or not) * Almost all .h files: added CPP magic to avoid duplicate inclusions and to support inclusion from C++.
* * Added Fixcprt.py: script to fix copyright message.Guido van Rossum1993-01-261-2/+7
| | | | | | | | | | | * various modules: added 1993 to copyright. * thread.c: added copyright notice. * ceval.c: minor change to error message for "+" * stdwinmodule.c: check for error from wfetchcolor * config.c: MS-DOS fixes (define PYTHONPATH, use DELIM, use osdefs.h) * Add declaration of inittab to import.h * sysmodule.c: added sys.builtin_module_names * xxmodule.c, xxobject.c: fix minor errors
* Copyright for 1992 addedGuido van Rossum1992-04-051-1/+1
|
* Added copyright notice.Guido van Rossum1991-02-191-0/+24
|
* "Compiling" versionGuido van Rossum1990-12-201-3/+5
|
* Added prototype for reload_module.Guido van Rossum1990-10-261-3/+1
|
* Initial revisionGuido van Rossum1990-10-141-0/+7