Victor Stinner
bdf630c4a7
Issue #18408 : Fix Python-ast.c: handle init_types() failure (ex: MemoryError)
13 years ago
Victor Stinner
1e53bbaced
Issue #18408 : handle PySys_GetObject() failure, raise a RuntimeError
13 years ago
Victor Stinner
78e2c985ac
Issue #18408 : Fix show_warning(), clear also the exception raised by
_Py_DisplaySourceLine()
For example, _PyGC_DumpShutdownStats() calls PyErr_WarnExplicitFormat() while
the import machinery does not work anymore, _Py_DisplaySourceLine() fails when
trying to import the io module.
13 years ago
Victor Stinner
f243ee4055
Issue #18408 : add more assertions on PyErr_Occurred() in ceval.c to detect bugs
earlier
13 years ago
Victor Stinner
ceceaa00ba
Issue #18408 : Fix _Py_DisplaySourceLine()
Report _Py_FindSourceFile() error, so the error is cleared;
and clear io.open(filename) exception on failure.
13 years ago
Victor Stinner
7eab0d000c
Issue #18408 : Fix PyEval_EvalFrameEx() for MemoryError
Don't pass a NULL traceback to PyException_SetTraceback(): pass Py_None.
Passing NULL would raise a new exception.
13 years ago
Brett Cannon
a79e4fb38d
Issue #18342 : Use the repr of a module name for ``from ... import
...`` when an ImportError occurs.
Other cases had already been switched over to using the repr.
Thanks to Tomasz Maćkowiak for the patch.
13 years ago
Brett Cannon
f0cb69274c
Issue #18415 : Normalize what type of quotes are used with string
constants in importlib._bootstrap. Along the way clean up from string
interpolation to use the repr explicitly.
Initial patch by Madison May.
13 years ago
Victor Stinner
fb3a630001
Issue #18408 : errors.c: in debug mode, calling PyErr_BadInternalCall() now
fails with an assertion error
13 years ago
Victor Stinner
365b693adc
Issue #18408 : ceval.c: in debug mode, convert the PyErr_Occurred() check on
exception (when getting NULL) to an assertion to detect bugs earlier
13 years ago
Victor Stinner
cc35159ed8
Issue #18408 : normalizestring() now raises MemoryError on memory allocation failure
13 years ago
Victor Stinner
6b64a6803e
Issue #18408 : Fix compiler_import() to handle PyUnicode_Substring() failure properly
13 years ago
Victor Stinner
9a4fb66966
Issue #18408 : ste_new() initialize all attributes before handling error
If an attribute is not initialized, the destructor can crash
13 years ago
Serhiy Storchaka
3641a74e1c
Issue #17872 : Fix a segfault in marshal.load() when input stream returns
more bytes than requested.
13 years ago
Serhiy Storchaka
dfde2151ed
Fix reference leaks introduced by the patch for issue #5308 .
13 years ago
Christian Heimes
7ce57d67c9
Issue #18426 : improve exception message. Courtesy of Amaury
13 years ago
Christian Heimes
848ee099f5
Issue #18426 : Fix NULL pointer dereference in C extension import when
PyModule_GetDef() returns an error.
13 years ago
R David Murray
87ead1138d
#18424 : PEP8ify the tense of the sum docstring.
13 years ago
Victor Stinner
aaa8ed8b84
Issue #18408 : Fix call_exc_trace(): if the traceback is NULL, use None when
building the tuple (type, value, traceback) passed to the callback.
PyTuple_Pack() does crash if an argument is NULL.
13 years ago
Victor Stinner
e0af3a802a
Issue #18408 : Fix PyCode_Optimize(): raise a MemoryError on memory allocation
failure.
13 years ago
Victor Stinner
0ff0f54dd4
Issue #18408 : Fix call_function() of ceval.c to handle PyTuple_New() failure
(in load_args()), ex: MemoryError.
13 years ago
Victor Stinner
3a8b79d4d2
Issue #18408 : Fix marshal reader for Unicode strings: handle
PyUnicode_DecodeUTF8() failure (ex: MemoryError).
13 years ago
Victor Stinner
49fc8ece81
Issue #18203 : Add _PyMem_RawStrdup() and _PyMem_Strdup()
Replace strdup() with _PyMem_RawStrdup() or _PyMem_Strdup(), depending if the
GIL is held or not.
13 years ago
Victor Stinner
c6632e7eb4
Issue #18203 : Replace malloc() with PyMem_Malloc() to allocate arena objects
13 years ago
Victor Stinner
80aa565fb4
Issue #18203 : Replace malloc() with PyMem_RawMalloc() to allocate thread locks
13 years ago
Victor Stinner
65bf9cf26f
Issue #18203 : Fix decode_ascii_surrogateescape(), use PyMem_RawMalloc() as _Py_char2wchar()
13 years ago
Victor Stinner
1a7425f67a
Issue #18203 : Replace malloc() with PyMem_RawMalloc() at Python initialization
* Replace malloc() with PyMem_RawMalloc()
* Replace PyMem_Malloc() with PyMem_RawMalloc() where the GIL is not held.
* _Py_char2wchar() now returns a buffer allocated by PyMem_RawMalloc(), instead
of PyMem_Malloc()
13 years ago
Victor Stinner
51fa458d0a
Issue #18203 : Fix Py_Finalize(): destroy the GIL after the last call to
PyMem_Malloc() or PyObject_Malloc().
For example, PyCFunction_Fini() calls PyObject_GC_Del() which calls
PyObject_FREE().
13 years ago
Brett Cannon
a53cca3fea
Issue #18351 : Fix various issues with
importlib._bootstrap._get_sourcefile().
Thanks to its only use by the C API, it was never properly tested
until now.
Thanks to Neal Norwitz for discovering the bug and Madison May for the patch.
13 years ago
Brett Cannon
0075110ab2
Issue #18364 : Stop using the ImportError._not_found hack.
The private attribute was leaking out of importlib and led to at least
one person noticing it. Switch to another hack which won't leak
outside of importlib and is nearly as robust.
13 years ago
Brett Cannon
679ecb565b
Issue #15767 : back out 8a0ed9f63c6e, finishing the removal of
ModuleNotFoundError.
13 years ago
Brett Cannon
82da8886cc
Issue #15767 : Revert 3a50025f1900 for ModuleNotFoundError
13 years ago
Christian Heimes
b9dbc7d6e1
Issue #18328 : Reorder ops in PyThreadState_Delete*() functions. Now the
tstate is first removed from TLS and then deallocated.
CID 1019639 (#1 of 1): Use after free (USE_AFTER_FREE)
use_after_free: Using freed pointer tstate.
13 years ago
Raymond Hettinger
4d6018fe45
Issue 18111: Add a default argument to min() and max()
13 years ago
Victor Stinner
14b9b11098
If MS_WIN64 is defined, MS_WINDOWS is also defined: #ifdef can be simplified.
13 years ago
Victor Stinner
7b2513589f
Issue #9566 : pystrtod.c: Fix a compiler warnings on Windows x64
13 years ago
Victor Stinner
76d38502e4
Issue #9566 : Fix a compiler warning on Windows x64
13 years ago
Christian Heimes
582cfbbf74
import.c does neither need mode_t nor _mkdir() anymore
13 years ago
Victor Stinner
2f084ecfe7
Issue #18137 : Detect integer overflow on precision in float.__format__() and
complex.__format__().
13 years ago
Victor Stinner
f1913ca37f
marshal: optimize parsing of empty Unicode strings
Don't create a temporary buffer of zeroy byte nor call r_string() if the length
is zero, create directly the empty string.
13 years ago
Andrew Kuchling
c61b913078
#13226 : update references from ctypes/DLFCN modules to os module
13 years ago
Antoine Pitrou
9a00e0a41c
Issue #18256 : Compilation fix for recent AIX releases. Patch by David Edelsohn.
13 years ago
Brett Cannon
1d75382e81
Fix a misnaming of a method and an argument
13 years ago
Brett Cannon
f24fecd4ac
Issue #18076 : Introduce imoportlib.util.decode_source().
The helper function makes it easier to implement
imoprtlib.abc.InspectLoader.get_source() by making that function
require just the raw bytes for source code and handling all other
details.
13 years ago
Brett Cannon
f4375ef4d4
importlib.abc.SourceLoader.get_source() was re-raising SyntaxError and
UnicodeDecodeError as ImportError. That was over-reaching the point of
raising ImportError in get_source() (which is to signal the source
code was not found when it should have). Conflating the two exceptions
with ImportError could lead to masking errors with the source which
should be known outside of whether there was an error simply getting
the source to begin with.
13 years ago
Brett Cannon
01b0475b08
Issue #18115 : Abstract out managing the cleanup of modules to use in
loaders where C code provides the loaded module.
13 years ago
Brett Cannon
13d8ff9c5b
Issues #18058 , 18057: Make importlib._bootstrap.NamespaceLoader
conform the the InspectLoader ABC. Perk of this is that runpy/-m can
now work with namespace packages.
13 years ago
Brett Cannon
a3c96154d2
Issue #17907 : touch up the code for imp.new_module().
13 years ago
Brett Cannon
05a647deed
Issue #18192 : Introduce importlib.util.MAGIC_NUMBER and document the
deprecation of imp.get_magic().
13 years ago
Brett Cannon
8f5ac5106e
Issue #15767 : Touch up ModuleNotFoundError usage by import.
Forgot to raise ModuleNotFoundError when None is found in sys.modules.
This led to introducing the C function PyErr_SetImportErrorSubclass()
to make setting ModuleNotFoundError easier.
Also updated the reference docs to mention ModuleNotFoundError
appropriately. Updated the docs for ModuleNotFoundError to mention the
None in sys.modules case.
Lastly, it was noticed that PyErr_SetImportError() was not setting an
exception when returning None in one case. That issue is now fixed.
13 years ago