| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
- replace 'long int' / 'long' by 'int'
- fix capitalization of "Python" in PyLong_AsUnsignedLong
- "is too large" -> "too large", for consistency with other messages.
|
| |
|
|
| |
globals to None, in most cases.
|
| | |
|
| |
|
|
|
| |
As PyDict_GetItem(), _PyDict_GetItemId() suppresses all errors that may occur,
for historical reasons.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
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
|
| |\
| |
| |
| | |
CID 715334
|
| | |
| |
| |
| | |
CID 715334
|
| |\ \
| |/
| |
| | |
CID 486654
|
| | |
| |
| |
| | |
CID 486654
|
| | |
| |
| |
| |
| |
| | |
newto, attr).
The fix only affects the error message of __class__ assignment. CID 983564
|
| | |
| |
| |
| |
| | |
I tested the patch manually by injecting a fault using gdb: list items are
correctly restored on failure.
|
| | |
| |
| |
| |
| |
| |
| | |
assertion error if they are called with an exception set (PyErr_Occurred()).
As PyEval_EvalFrameEx(), they may clear the current exception and so the caller
looses its exception.
|
| | |
| |
| |
| |
| | |
PyObject_Repr() can removes the current exception. For example, module_repr()
calls PyErr_Clear() if calling loader.module_repr(mod) failed.
|
| | |
| |
| |
| | |
small integers (0 or 1 digit)
|
| | |
| |
| |
| | |
PyLong_FromLong() failure
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
| |
| |
| |
| |
| | |
It was easy to miss the call to type->tp_init because it was done in a long
conditional expression. Split the long expression in multiple lines to make the
debug step by step easier.
|
| | |
| |
| |
| | |
and ignores exceptions raised during the call
|
| | |
| |
| |
| | |
Pass the MemoryError exception to the caller, instead of using empty keys.
|
| | | |
|
| | |
| |
| |
| |
| | |
As PyDict_GetItem(), PyDict_GetItemString() suppresses all errors that may
occur for historical reasons.
|
| | | |
|
| | |
| |
| |
| | |
earlier
|
| | |
| |
| |
| | |
on memory allocation failure
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
and _PyUnicode_HAS_WSTR_MEMORY() macros
These macros are called in unicode_dealloc(), whereas the unicode object can be
"inconsistent" if the creation of the object failed.
For example, when unicode_subtype_new() fails on a memory allocation,
_PyUnicode_CheckConsistency() fails with an assertion error because data is
NULL.
|
| | |
| |
| |
| |
| | |
if the function called failed whereas no exception was raised, to detect bugs
earlier.
|
| | |
| |
| |
| |
| |
| |
| | |
memory allocation failure
Replace also PyMem_Free() with PyMem_FREE() to be consistent with the rest of
the function.
|
| | |
| |
| |
| |
| | |
raised if the result is NULL to help to find bugs in C mode (get the error
earlier than the SystemError in ceval.c).
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
type->tp_str must not point to slot_tp_str() if type has no __str__ attribute,
so there is no reason for slot_tp_str() to fallback on slot_tp_str() on lookup
error. Moreover, calling PyErr_Clear() may hide a real bug like MemoryError.
If __str__ attribute is removed, slots must be updated (which is done by
type_setattro()).
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| | |
Don't mark old extra memory dead before calling realloc(). realloc() can fail
and realloc() must not touch the original buffer on failure.
So mark old extra memory dead only on success if the new buffer did not move
(has the same address).
|
| | |
| |
| |
| | |
cases, so _PyUnicodeWriter_Dealloc() can be called after finish.
|
| | |
| |
| |
| | |
so _PyUnicodeWriter_Dealloc() can be called on the writer after finish.
|
| | |
| |
| |
| | |
PyWeakref_NewRef() failure (ex: MemoryError).
|
| | | |
|
| | |
| |
| |
| | |
(MemoryError).
|
| | |
| |
| |
| |
| | |
Replace strdup() with _PyMem_RawStrdup() or _PyMem_Strdup(), depending if the
GIL is held or not.
|
| | |
| |
| |
| | |
_Py_char2wchar()
|
| | |
| |
| |
| | |
_PySequence_BytesToCharpArray()
|
| | |
| |
| |
| |
| |
| |
| | |
* 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()
|
| | |
| |
| |
| |
| | |
According to VirtualFree() documentation, the size must be zero if the "free
type" is MEM_RELEASE.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Add new enum:
* PyMemAllocatorDomain
Add new structures:
* PyMemAllocator
* PyObjectArenaAllocator
Add new functions:
* PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree()
* PyMem_GetAllocator(), PyMem_SetAllocator()
* PyObject_GetArenaAllocator(), PyObject_SetArenaAllocator()
* PyMem_SetupDebugHooks()
Changes:
* PyMem_Malloc()/PyObject_Realloc() now always call malloc()/realloc(), instead
of calling PyObject_Malloc()/PyObject_Realloc() in debug mode.
* PyObject_Malloc()/PyObject_Realloc() now falls back to
PyMem_Malloc()/PyMem_Realloc() for allocations larger than 512 bytes.
* Redesign debug checks on memory block allocators as hooks, instead of using C
macros
|
| | |
| |
| |
| | |
ModuleNotFoundError.
|
| | |
| |
| |
| |
| |
| | |
CID 983315: Resource leak (RESOURCE_LEAK)
CID 983316: Resource leak (RESOURCE_LEAK)
CID 983317: Resource leak (RESOURCE_LEAK)
|