Antoine Pitrou
40322e6ad5
Issue #10241 : Clear extension module dict copies at interpreter shutdown.
Patch by Neil Schemenauer, minimally modified.
(re-apply after fix for tkinter-related crash)
13 years ago
Christian Heimes
ad73a9cf97
Issue #16400 : Add command line option for isolated mode.
-I
Run Python in isolated mode. This also implies -E and -s. In isolated mode
sys.path contains neither the script’s directory nor the user’s
site-packages directory. All PYTHON* environment variables are ignored,
too. Further restrictions may be imposed to prevent the user from
injecting malicious code.
13 years ago
Antoine Pitrou
79ba3882ad
Improve verbose reporting of shutdown phase by using the "public" module name
13 years ago
Antoine Pitrou
58720d6145
Issue #17934 : Add a clear() method to frame objects, to help clean up expensive details (local variables) and break reference cycles.
13 years ago
Antoine Pitrou
95db2e7b8a
Backout 62658d9d8926 (issue #10241 ): it causes a crash at shutdown when deallocating a Tkapp object.
13 years ago
Antoine Pitrou
84f31a5676
Issue #10241 : Clear extension module dict copies at interpreter shutdown.
Patch by Neil Schemenauer, minimally modified.
13 years ago
Antoine Pitrou
dcedaf6e53
Issue #18214 : Improve finalization of Python modules to avoid setting their globals to None, in most cases.
13 years ago
Antoine Pitrou
32d483c39b
Fix style
13 years ago
Victor Stinner
da2cbb4fc8
Issue #15893 : Remove dead code
13 years ago
Victor Stinner
c588feeea9
Issue #15893 : Improve error handling in main() and Py_FrozenMain()
* handle _PyMem_RawStrdup() failure
* Py_FrozenMain() releases memory on error
* Py_FrozenMain() duplicates the old locale, as done in main()
13 years ago
Victor Stinner
739cf4e3e6
Py_FrozenMain() now uses _Py_char2wchar() to decode command line arguments, as
done in main()
13 years ago
Victor Stinner
b5245bec93
Issue #18203 : Replace PyMem_Malloc() with PyMem_RawMalloc() at Python initialization
13 years ago
Victor Stinner
36577e4e8c
Issue #15893 : frozenmain.c now handles PyMem_Malloc() failure
13 years ago
Christian Heimes
70c94e7896
Issue #18552 : Check return value of PyArena_AddPyObject() in obj2ast_object().
13 years ago
Victor Stinner
1acc129d48
Parser/asdl_c.py: use Py_CLEAR()
13 years ago
Victor Stinner
ce72e1ce6c
According to the PEP 7, C code must "use 4-space indents"
Replace 8 spaces with 4.
13 years ago
Christian Heimes
704e2d374f
Issue #18560 : Fix potential NULL pointer dereference in sum()
13 years ago
Christian Heimes
72f562f719
Fix potential NULL pointer dereferencing in ast module
CID 719690
13 years ago
Benjamin Peterson
7d28b6b379
return NULL here
13 years ago
Victor Stinner
ba30883f60
Issue #18520 : Fix initstdio(), handle PySys_SetObject() failure
13 years ago
Victor Stinner
62ce62a3a1
Issue #18520 : initsite() is a little bit more verbose when import site fails
13 years ago
Victor Stinner
580496005d
Issue #18520 : Fix _PySys_Init(), handle PyDict_SetItemString() errors
13 years ago
Victor Stinner
f54a574478
Issue #18520 : PyErr_NoMemory() now fails with a fatal error if it is called
before PyExc_MemoryError has been initialized by _PyExc_Init()
13 years ago
Victor Stinner
1c8f059019
Issue #18520 : Add a new PyStructSequence_InitType2() function, same than
PyStructSequence_InitType() except that it has a return value (0 on success,
-1 on error).
* PyStructSequence_InitType2() now raises MemoryError on memory allocation failure
* Fix also some calls to PyDict_SetItemString(): handle error
13 years ago
Christian Heimes
60a6067709
Issue #15905 : Fix theoretical buffer overflow in handling of sys.argv[0],
prefix and exec_prefix if the operation system does not obey MAXPATHLEN.
13 years ago
Benjamin Peterson
0f9b7d32c7
fix spacing
13 years ago
Benjamin Peterson
04b01dc8f7
let's not return NULL from functions that should return ints
13 years ago
Victor Stinner
d786ad55ef
Issue #18520 : Fix initsigs(), handle PyOS_InitInterrupts() error
PyOS_InitInterrupts() can raise error when importing the signal module
13 years ago
Christian Heimes
1f34729f42
Check return value of lseek() in _Py_DisplaySourceLine().
Also use portable SEEK_SET instead of 0.
CID 1040639
13 years ago
Christian Heimes
8c077bc03e
Check return value of PyObject_AsFileDescriptor() in _Py_DisplaySourceLine() for error
CID 486768
13 years ago
Christian Heimes
27c4c3ec79
Check return value of fstat() in _PyImport_GetDynLoadFunc()
CID 486250
13 years ago
Christian Heimes
09ca794afe
Add missing check of PyDict_SetItem()'s return value in _PyImport_FindExtensionObject()
CID 486649
13 years ago
Christian Heimes
0bd447f847
Add missing check of PyDict_SetItem()'s return value in PyEval_EvalCodeEx()
CID 486647
13 years ago
Victor Stinner
ace47d7efd
Issue #18408 : PyEval_EvalFrameEx() and PyEval_CallObjectWithKeywords() now fail
with an assertion error if they are called with an exception set
(PyErr_Occurred()).
If these functions are called with an exception set, the exception may be
cleared and so the caller looses its exception.
Add also assertions to PyEval_CallObjectWithKeywords() and call_function() to
check if the function succeed with no exception set, or the function failed
with an exception set.
13 years ago
Victor Stinner
479054bca7
Issue #18408 : Fix PyErr_SetImportError(), handle PyDict_SetItemString() failure
13 years ago
Victor Stinner
8e54b1c448
Issue #18408 : Fix _PyImport_LoadDynamicModule(), handle PyUnicode_FromFormat() failure
13 years ago
Victor Stinner
0fae8f9083
Issue #18408 : Fix ast_for_atom(), PyErr_Fetch(&type, &value, &tback) can set value to NULL
13 years ago
Victor Stinner
26f91999b4
Close #18469 : Replace PyDict_GetItemString() with _PyDict_GetItemId() in structseq.c
_PyDict_GetItemId() is more efficient: it only builds the Unicode string once.
Identifiers (dictionary keys) are now created at Python initialization, and if
the creation failed, Python does exit with a fatal error.
Before, PyDict_GetItemString() failure was not handled: structseq_new() could
call PyObject_GC_NewVar() with a negative size, and structseq_dealloc() could
also crash.
13 years ago
Victor Stinner
43d8195a70
Issue #18408 : Handle PyArena_AddPyObject() failure in ast.c
PyList_Append() (called by PyArena_AddPyObject()) can fail because of a
MemoryError for example.
13 years ago
Victor Stinner
74a7fa6663
Issue #18408 : Fix PyErr_NormalizeException(), handle PyObject_IsSubclass() failure
PyObject_IsSubclass() can fail and raise a new exception!
13 years ago
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