| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
| |
| |
| | |
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)
|
| |
| |
| |
| |
| | |
CID 983319 (#1 of 2): Resource leak (RESOURCE_LEAK)
leaked_storage: Variable substring going out of scope leaks the storage it points to.
|
| |
| |
| |
| |
| |
| | |
CID 983320: Resource leak (RESOURCE_LEAK)
CID 983321: Resource leak (RESOURCE_LEAK)
leaked_storage: Variable substring going out of scope leaks the storage it points to.
|
| |
| |
| |
| |
| | |
CID 1040368 (#1 of 1): Resource leak (RESOURCE_LEAK)
leaked_storage: Variable substring going out of scope leaks the storage it points to.
|
| | |
|
| | |
|
| | |
|
| | |
|
|\ \
| |/
| |
| | |
OverflowError when an argument of %c format is out of range.
|
| |
| |
| |
| | |
OverflowError when an argument of %c format is out of range.
|
| | |
|
| |
| |
| |
| |
| |
| | |
allocators
The new API require more discussion.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* Add a new PyMemAllocators structure
* New functions:
- PyMem_RawMalloc(), PyMem_RawRealloc(), PyMem_RawFree(): GIL-free memory
allocator functions
- PyMem_GetRawAllocators(), PyMem_SetRawAllocators()
- PyMem_GetAllocators(), PyMem_SetAllocators()
- PyMem_SetupDebugHooks()
- _PyObject_GetArenaAllocators(), _PyObject_SetArenaAllocators()
* Add unit test for PyMem_Malloc(0) and PyObject_Malloc(0)
* Add unit test for new get/set allocators functions
* PyObject_Malloc() now falls back on PyMem_Malloc() instead of malloc() if
size is bigger than SMALL_REQUEST_THRESHOLD, and PyObject_Realloc() falls
back on PyMem_Realloc() instead of realloc()
* PyMem_Malloc() and PyMem_Realloc() now always call malloc() and realloc(),
instead of calling PyObject_Malloc() and PyObject_Realloc() in debug mode
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
ImportError.
The exception is raised by import when a module could not be found.
Technically this is defined as no viable loader could be found for the
specified module. This includes ``from ... import`` statements so that
the module usage is consistent for all situations where import
couldn't find what was requested.
This should allow for the common idiom of::
try:
import something
except ImportError:
pass
to be updated to using ModuleNotFoundError and not accidentally mask
ImportError messages that should propagate (e.g. issues with a
loader).
This work was driven by the fact that the ``from ... import``
statement needed to be able to tell the difference between an
ImportError that simply couldn't find a module (and thus silence the
exception so that ceval can raise it) and an ImportError that
represented an actual problem.
|
|\ \
| |/ |
|
| |
| |
| |
| | |
(see #18183)
|
| | |
|
| |
| |
| |
| |
| |
| | |
The result type is int, return -1 to avoid a compiler warning (cast Py_ssize_t
to int). PyObject_Size() can only fail with -1, and anyway a constructor
should return -1 on error, not an arbitrary negative number.
|
| |
| |
| |
| |
| | |
iterators: change the C type of tupleiterobject.it_index from long to
Py_ssize_t.
|
| |
| |
| |
| | |
multiprocessing.h: remove unused MIN and MAX macros
|
| |
| |
| |
| | |
change the C type of seqiterobject.it_index from long to Py_ssize_t.
|
| |
| |
| |
| |
| | |
PyObject_CallMethod() now changed to `const char*`.
Based on patches by Jörg Müller and Lars Buitinck.
|
| | |
|
|\ \
| |/ |
|
| | |
|
|\ \
| |/ |
|
| | |
|
| | |
|
| |
| |
| |
| | |
(Issue #17807: Generators can now be finalized even when they are part of a reference cycle)
|
| | |
|