| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
| |
* Remove an unnecessary cache of shared object handles.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
pycore_pystate.h no longer includes pycore_interp.h:
it's now included explicitly in files accessing PyInterpreterState.
|
|
|
|
|
|
|
| |
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().
|
|
|
|
| |
In debug build, import now also looks for C extensions compiled in
release mode and for C extensions compiled in the stable ABI.
|
|
|
|
|
|
|
|
| |
(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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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".
|
|
|
|
| |
sys_setcheckinterval() now uses a local variable to parse arguments,
before writing into interp->check_interval.
|
|
|
|
|
|
|
| |
* 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).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Add _Py_fstat_noraise() function when a Python exception is not welcome.
|
|
|
|
|
|
| |
Windows.
fstat() may fail with EOVERFLOW on files larger than 2 GB because the file size type is an signed 32-bit integer.
|
| |
|
|\ |
|
| | |
|
|\ \
| |/
| |
| | |
CID 486250
|
| |
| |
| |
| | |
CID 486250
|
| | |
|
|/
|
|
| |
imp.load_dynamic()
|
|
|
|
| |
failure
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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__().
|
|
|
|
|
|
| |
POSIX mainly).
This will improve import performance a bit (especially under importlib).
|
|
|
|
| |
The first argument, fqname, was not used.
|
| |
|
|
|
|
| |
to load the one without the SOABI in the name.
|
|
|
|
| |
http://mail.python.org/pipermail/python-dev/2010-September/103408.html
|
|
|
|
|
|
|
|
|
|
| |
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.
........
|
| |
|
| |
|
|
|
|
|
| |
It was possible dlerror() returns a NULL pointer, use a default error
message in this case.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
| |
199712 didn't have dlfcn.h, or that it wouldn't conflict with the other
stuff defined.
|
| |
|
| |
|
|
|
|
| |
Add dlopenflags to PyInterpreterState, and use it in dlopen calls.
|
|
|
|
|
|
|
|
| |
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?
|
|
|
|
| |
BSDs) you need a leading underscore in the dlsym() lookup name.
|
|
|
|
| |
Tkinter work under Cygwin. Accepted on faith & reasonableness.
|
|
|
|
| |
This should match the situation in the 1.6b1 tree.
|
| |
|
| |
|