mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-90110: Fix the c-analyzer Tool (#102483)
Some incompatible changes had gone in, and the "ignore" lists weren't properly undated. This change fixes that. It's necessary prior to enabling test_check_c_globals, which I hope to do soon. Note that this does include moving last_resort_memory_error to PyInterpreterState. https://github.com/python/cpython/issues/90110
This commit is contained in:
parent
f9cdeb7b99
commit
8606697f49
11 changed files with 86 additions and 35 deletions
|
@ -3207,8 +3207,6 @@ SimpleExtendsException(PyExc_Exception, ReferenceError,
|
|||
|
||||
#define MEMERRORS_SAVE 16
|
||||
|
||||
static PyBaseExceptionObject last_resort_memory_error;
|
||||
|
||||
static PyObject *
|
||||
get_memory_error(int allow_allocation, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
|
@ -3216,7 +3214,9 @@ get_memory_error(int allow_allocation, PyObject *args, PyObject *kwds)
|
|||
struct _Py_exc_state *state = get_exc_state();
|
||||
if (state->memerrors_freelist == NULL) {
|
||||
if (!allow_allocation) {
|
||||
return Py_NewRef(&last_resort_memory_error);
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
return Py_NewRef(
|
||||
&_Py_INTERP_SINGLETON(interp, last_resort_memory_error));
|
||||
}
|
||||
PyObject *result = BaseException_new((PyTypeObject *)PyExc_MemoryError, args, kwds);
|
||||
return result;
|
||||
|
@ -3239,8 +3239,6 @@ get_memory_error(int allow_allocation, PyObject *args, PyObject *kwds)
|
|||
return (PyObject *)self;
|
||||
}
|
||||
|
||||
static PyBaseExceptionObject last_resort_memory_error;
|
||||
|
||||
static PyObject *
|
||||
MemoryError_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
|
@ -3325,7 +3323,7 @@ free_preallocated_memerrors(struct _Py_exc_state *state)
|
|||
}
|
||||
|
||||
|
||||
static PyTypeObject _PyExc_MemoryError = {
|
||||
PyTypeObject _PyExc_MemoryError = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
"MemoryError",
|
||||
sizeof(PyBaseExceptionObject),
|
||||
|
@ -3339,9 +3337,6 @@ static PyTypeObject _PyExc_MemoryError = {
|
|||
};
|
||||
PyObject *PyExc_MemoryError = (PyObject *) &_PyExc_MemoryError;
|
||||
|
||||
static PyBaseExceptionObject last_resort_memory_error = {
|
||||
_PyObject_IMMORTAL_INIT(&_PyExc_MemoryError)
|
||||
};
|
||||
|
||||
/*
|
||||
* BufferError extends Exception
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue