summaryrefslogtreecommitdiffstats
path: root/Python/dynload_shlib.c
Commit message (Collapse)AuthorAgeFilesLines
* gh-101758: Clean Up Uses of Import State (gh-101919)Eric Snow2023-02-151-1/+1
| | | | | | | | | | | | | | | This change is almost entirely moving code around and hiding import state behind internal API. We introduce no changes to behavior, nor to non-internal API. (Since there was already going to be a lot of churn, I took this as an opportunity to re-organize import.c into topically-grouped sections of code.) The motivation is to simplify a number of upcoming changes. Specific changes: * move existing import-related code to import.c, wherever possible * add internal API for interacting with import state (both global and per-interpreter) * use only API outside of import.c (to limit churn there when changing the location, etc.) * consolidate the import-related state of PyInterpreterState into a single struct field (this changes layout slightly) * add macros for import state in import.c (to simplify changing the location) * group code in import.c into sections *remove _PyState_AddModule() https://github.com/python/cpython/issues/101758
* bpo-43895: Remove an unnecessary cache of shared object handles (GH-25487)Ian Henriksen2021-07-071-22/+0
| | | * Remove an unnecessary cache of shared object handles.
* bpo-41894: Fix UnicodeDecodeError while loading native module (GH-22466)Kevin Adler2020-10-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running in a non-UTF-8 locale, if an error occurs while importing a native Python module (say because a dependent share library is missing), the error message string returned may contain non-ASCII code points causing a UnicodeDecodeError. PyUnicode_DecodeFSDefault is used for buffers which may contain filesystem paths. For consistency with os.strerror(), PyUnicode_DecodeLocale is used for buffers which contain system error messages. While the shortname parameter is always encoded in ASCII according to PEP 489, it is left decoded using PyUnicode_FromString to minimize the changes and since it should not affect the decoding (albeit _potentially_ slower). In dynload_hpux, since the error buffer contains a message generated from a static ASCII string and the module filesystem path, PyUnicode_DecodeFSDefault is used instead of PyUnicode_DecodeLocale as is used elsewhere. * bpo-41894: Fix bugs in dynload error msg handling For both dynload_aix and dynload_hpux, properly handle the possibility that decoding strings may return NULL and when such an error happens, properly decrement any previously decoded strings and return early. In addition, in dynload_aix, ensure that we pass the decoded string *object* pathname_ob to PyErr_SetImportError instead of the original pathname buffer. Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-40268: Rename _PyInterpreterState_GET_UNSAFE() (GH-19509)Victor Stinner2020-04-141-2/+2
| | | | | | | Rename _PyInterpreterState_GET_UNSAFE() to _PyInterpreterState_GET() for consistency with _PyThreadState_GET() and to have a shorter name (help to fit into 80 columns). Add also "assert(tstate != NULL);" to the function.
* bpo-40268: Include explicitly pycore_interp.h (GH-19505)Victor Stinner2020-04-141-0/+1
| | | | pycore_pystate.h no longer includes pycore_interp.h: it's now included explicitly in files accessing PyInterpreterState.
* bpo-39947: Use _PyInterpreterState_GET_UNSAFE() (GH-18978)Victor Stinner2020-03-131-2/+2
| | | | | | | Replace _PyInterpreterState_Get() function call with _PyInterpreterState_GET_UNSAFE() macro which is more efficient but don't check if tstate or interp is NULL. _Py_GetConfigsAsDict() now uses _PyThreadState_GET().
* bpo-36722: Debug build loads libraries built in release mode (GH-12952)Victor Stinner2019-04-251-2/+3
| | | | In debug build, import now also looks for C extensions compiled in release mode and for C extensions compiled in the stable ABI.
* bpo-28401: prevent Py_DEBUG builds from trying to import limited ABI modules ↵Stefano Rivera2018-11-161-0/+2
| | | | | | | | (GH-1766) [Issue 28401](https://bugs.python.org/issue28401): Don't attempt to import the stable API extensions, they are not supported in PyDEBUG builds (which don't implement that ABI). https://bugs.python.org/issue28401
* bpo-35081: Rename internal headers (GH-10275)Victor Stinner2018-11-121-1/+1
| | | | | | | | | | | | | | Rename Include/internal/ headers: * pycore_hash.h -> pycore_pyhash.h * pycore_lifecycle.h -> pycore_pylifecycle.h * pycore_mem.h -> pycore_pymem.h * pycore_state.h -> pycore_pystate.h Add missing headers to Makefile.pre.in and PCbuild: * pycore_condvar.h. * pycore_hamt.h * pycore_pyhash.h
* bpo-35081: Add pycore_ prefix to internal header files (GH-10263)Victor Stinner2018-10-311-1/+1
| | | | | | | | | | | | | | | | | | | | * Rename Include/internal/ header files: * pyatomic.h -> pycore_atomic.h * ceval.h -> pycore_ceval.h * condvar.h -> pycore_condvar.h * context.h -> pycore_context.h * pygetopt.h -> pycore_getopt.h * gil.h -> pycore_gil.h * hamt.h -> pycore_hamt.h * hash.h -> pycore_hash.h * mem.h -> pycore_mem.h * pystate.h -> pycore_state.h * warnings.h -> pycore_warnings.h * PCbuild project, Makefile.pre.in, Modules/Setup: add the Include/internal/ directory to the search paths of header files. * Update includes. For example, replace #include "internal/mem.h" with #include "pycore_mem.h".
* bpo-34301: Add _PyInterpreterState_Get() helper function (GH-8592)Victor Stinner2018-08-031-1/+1
| | | | sys_setcheckinterval() now uses a local variable to parse arguments, before writing into interp->check_interval.
* bpo-30860: Consolidate stateful runtime globals. (#3397)Eric Snow2017-09-081-0/+1
| | | | | | | * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
* PEP 489: Multi-phase extension module initializationNick Coghlan2015-05-231-3/+5
| | | | | | | | | | | | | | | | | | | | | | | Known limitations of the current implementation: - documentation changes are incomplete - there's a reference leak I haven't tracked down yet The leak is most visible by running: ./python -m test -R3:3 test_importlib However, you can also see it by running: ./python -X showrefcount Importing the array or _testmultiphase modules, and then deleting them from both sys.modules and the local namespace shows significant increases in the total number of active references each cycle. By contrast, with _testcapi (which continues to use single-phase initialisation) the global refcounts stabilise after a couple of cycles.
* Issue #23752: _Py_fstat() is now responsible to raise the Python exceptionVictor Stinner2015-03-301-8/+6
| | | | Add _Py_fstat_noraise() function when a Python exception is not welcome.
* Issue #23152: Implement _Py_fstat() to support files larger than 2 GB on ↵Steve Dower2015-02-211-2/+2
| | | | | | Windows. fstat() may fail with EOVERFLOW on files larger than 2 GB because the file size type is an signed 32-bit integer.
* Issue #16136: Remove VMS support and VMS-related codeChristian Heimes2013-12-211-26/+0
|
* merge 3.3Benjamin Peterson2013-07-231-1/+2
|\
| * return NULL hereBenjamin Peterson2013-07-231-1/+2
| |
* | Check return value of fstat() in _PyImport_GetDynLoadFunc()Christian Heimes2013-07-201-1/+3
|\ \ | |/ | | | | CID 486250
| * Check return value of fstat() in _PyImport_GetDynLoadFunc()Christian Heimes2013-07-201-1/+3
| | | | | | | | CID 486250
* | #16135: Removal of OS/2 support (I)Jesus Cea2012-10-041-11/+0
| |
* | Close #15766: Catch exceptions while raising the ImportError in ↵Victor Stinner2012-10-011-7/+18
|/ | | | imp.load_dynamic()
* Issue #15766: Fix a crash in imp.load_dynamic() on PyUnicode_FromString() ↵Victor Stinner2012-08-221-3/+3
| | | | failure
* Issue #13959: Re-implement imp.get_suffixes() in Lib/imp.py.Brett Cannon2012-05-041-10/+10
| | | | | | This introduces a new function, imp.extension_suffixes(), which is currently undocumented. That is forthcoming once issue #14657 is resolved and how to expose file suffixes is decided.
* Issue #14599: Generalize a test for ImportError.path and add supportBrett Cannon2012-04-201-1/+10
| | | | | | | in Python/dynload_shlibs.c. This should fix the remaining importlib test failure on Windows. Support in AIX and HP-UX will be in a separate checkin.
* Issue #2377: Make importlib the implementation of __import__().Brett Cannon2012-04-141-4/+0
| | | | | | | importlib._bootstrap is now frozen into Python/importlib.h and stored as _frozen_importlib in sys.modules. Py_Initialize() loads the frozen code along with sys and imp and then uses _frozen_importlib._install() to set builtins.__import__() w/ _frozen_importlib.__import__().
* Issue #14040: Remove rarely used file name suffixes for C extensions (under ↵Antoine Pitrou2012-02-201-6/+0
| | | | | | POSIX mainly). This will improve import performance a bit (especially under importlib).
* Issue #3080: Remove unused argument of _PyImport_GetDynLoadFunc()Victor Stinner2011-02-221-1/+1
| | | | The first argument, fqname, was not used.
* Merge branches/pep-0384.Martin v. Löwis2010-12-031-0/+2
|
* PEP 3149: Try to load the extension with the SOABI before tryingMatthias Klose2010-09-081-1/+1
| | | | to load the one without the SOABI in the name.
* PEP 3149 is accepted.Barry Warsaw2010-09-031-6/+13
| | | | http://mail.python.org/pipermail/python-dev/2010-September/103408.html
* Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou2010-05-091-76/+76
| | | | | | | | | | 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. ........
* Implement PEP 3121: new module initialization and finalization API.Martin v. Löwis2008-06-111-1/+1
|
* Fix a warning from gcc by adding a missed const qualifier.Hye-Shik Chang2006-01-041-1/+1
|
* - SF Bug #1350188, "setdlopenflags" leads to crash upon "import"Neal Norwitz2005-11-091-1/+4
| | | | | It was possible dlerror() returns a NULL pointer, use a default error message in this case.
* Print verbose messages to stderr. Fixes #1036752.Martin v. Löwis2004-10-031-1/+2
|
* A few more PyThreadState_Get to PyThreadState_GET conversionsNicholas Bastin2004-03-251-1/+1
|
* Patch #708495: Port more stuff to OpenVMS.Martin v. Löwis2003-05-031-0/+28
|
* OS/2 EMX port changes (Python part of patch #450267):Andrew MacIntyre2002-02-261-0/+11
| | | | | | | | | Python/ dynload_shlib.c // EMX port emulates dlopen() etc. for DL extensions import.c // changes to support 8.3 DLL name limit (VACPP+EMX) // and case sensitive import semantics importdl.h thread_os2.h
* Use PyOS_snprintf instead of sprintf.Jeremy Hylton2001-11-281-2/+3
|
* Move dlfcn.h block out of NetBSD block, assuming that NetBSD beforeMartin v. Löwis2001-10-181-3/+4
| | | | | 199712 didn't have dlfcn.h, or that it wouldn't conflict with the other stuff defined.
* Patch to bug #472202: Correctly recognize NetBSD before 199712.Martin v. Löwis2001-10-181-2/+5
|
* Patch #455231: Support ELF properly on OpenBSD.Martin v. Löwis2001-09-051-1/+1
|
* Patch #412229: Add functions sys.getdlopenflags and sys.setdlopenflags.Martin v. Löwis2001-07-181-13/+7
| | | | Add dlopenflags to PyInterpreterState, and use it in dlopen calls.
* Oops, one more part of the cygwin patch (SF patch #102409 by jlt63:Guido van Rossum2001-01-101-1/+1
| | | | | | | | Cygwin Python DLL and Shared Extension Patch). Add module.dll as a valid extension. jlt63 writes: Note that his change essentially backs out the fix for bug #115973. Should ".pyd" be retained instead for posterity?
* Patch 102114, Bug 11725. On OpenBSD (but apparently not on the otherGuido van Rossum2000-10-251-2/+7
| | | | BSDs) you need a leading underscore in the dlsym() lookup name.
* SF "bug" 115973: patches from Norman Vine so that shared libraries andTim Peters2000-10-051-0/+5
| | | | Tkinter work under Cygwin. Accepted on faith & reasonableness.
* 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.
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
|
* Change copyright notice.Guido van Rossum2000-06-301-22/+7
|