Skip to content

Commit 6c2ef08

Browse files
committed
align naming convention
1 parent 6abf1d8 commit 6c2ef08

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

Objects/exceptions.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ get_exc_state(void)
4545
*/
4646

4747
static inline PyBaseExceptionObject *
48-
_PyBaseExceptionObject_cast(PyObject *exc)
48+
_PyBaseExceptionObject_CAST(PyObject *exc)
4949
{
5050
assert(PyExceptionInstance_Check(exc));
5151
return (PyBaseExceptionObject *)exc;
@@ -85,7 +85,7 @@ BaseException_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
8585
static int
8686
BaseException_init(PyObject *op, PyObject *args, PyObject *kwds)
8787
{
88-
PyBaseExceptionObject *self = _PyBaseExceptionObject_cast(op);
88+
PyBaseExceptionObject *self = _PyBaseExceptionObject_CAST(op);
8989
if (!_PyArg_NoKeywords(Py_TYPE(self)->tp_name, kwds))
9090
return -1;
9191

@@ -130,7 +130,7 @@ BaseException_vectorcall(PyObject *type_obj, PyObject * const*args,
130130
static int
131131
BaseException_clear(PyObject *op)
132132
{
133-
PyBaseExceptionObject *self = _PyBaseExceptionObject_cast(op);
133+
PyBaseExceptionObject *self = _PyBaseExceptionObject_CAST(op);
134134
Py_CLEAR(self->dict);
135135
Py_CLEAR(self->args);
136136
Py_CLEAR(self->notes);
@@ -143,7 +143,7 @@ BaseException_clear(PyObject *op)
143143
static void
144144
BaseException_dealloc(PyObject *op)
145145
{
146-
PyBaseExceptionObject *self = _PyBaseExceptionObject_cast(op);
146+
PyBaseExceptionObject *self = _PyBaseExceptionObject_CAST(op);
147147
PyObject_GC_UnTrack(self);
148148
// bpo-44348: The trashcan mechanism prevents stack overflow when deleting
149149
// long chains of exceptions. For example, exceptions can be chained
@@ -157,7 +157,7 @@ BaseException_dealloc(PyObject *op)
157157
static int
158158
BaseException_traverse(PyObject *op, visitproc visit, void *arg)
159159
{
160-
PyBaseExceptionObject *self = _PyBaseExceptionObject_cast(op);
160+
PyBaseExceptionObject *self = _PyBaseExceptionObject_CAST(op);
161161
Py_VISIT(self->dict);
162162
Py_VISIT(self->args);
163163
Py_VISIT(self->notes);
@@ -170,7 +170,7 @@ BaseException_traverse(PyObject *op, visitproc visit, void *arg)
170170
static PyObject *
171171
BaseException_str(PyObject *op)
172172
{
173-
PyBaseExceptionObject *self = _PyBaseExceptionObject_cast(op);
173+
PyBaseExceptionObject *self = _PyBaseExceptionObject_CAST(op);
174174

175175
PyObject *res;
176176
Py_BEGIN_CRITICAL_SECTION(self);
@@ -193,7 +193,7 @@ static PyObject *
193193
BaseException_repr(PyObject *op)
194194
{
195195

196-
PyBaseExceptionObject *self = _PyBaseExceptionObject_cast(op);
196+
PyBaseExceptionObject *self = _PyBaseExceptionObject_CAST(op);
197197

198198
PyObject *res;
199199
Py_BEGIN_CRITICAL_SECTION(self);
@@ -520,7 +520,7 @@ PyException_GetTraceback(PyObject *self)
520520
{
521521
PyObject *traceback;
522522
Py_BEGIN_CRITICAL_SECTION(self);
523-
traceback = Py_XNewRef(_PyBaseExceptionObject_cast(self)->traceback);
523+
traceback = Py_XNewRef(_PyBaseExceptionObject_CAST(self)->traceback);
524524
Py_END_CRITICAL_SECTION();
525525
return traceback;
526526
}
@@ -531,7 +531,7 @@ PyException_SetTraceback(PyObject *self, PyObject *tb)
531531
{
532532
int res;
533533
Py_BEGIN_CRITICAL_SECTION(self);
534-
res = BaseException___traceback___set_impl(_PyBaseExceptionObject_cast(self), tb);
534+
res = BaseException___traceback___set_impl(_PyBaseExceptionObject_CAST(self), tb);
535535
Py_END_CRITICAL_SECTION();
536536
return res;
537537
}
@@ -541,7 +541,7 @@ PyException_GetCause(PyObject *self)
541541
{
542542
PyObject *cause;
543543
Py_BEGIN_CRITICAL_SECTION(self);
544-
cause = Py_XNewRef(_PyBaseExceptionObject_cast(self)->cause);
544+
cause = Py_XNewRef(_PyBaseExceptionObject_CAST(self)->cause);
545545
Py_END_CRITICAL_SECTION();
546546
return cause;
547547
}
@@ -551,7 +551,7 @@ void
551551
PyException_SetCause(PyObject *self, PyObject *cause)
552552
{
553553
Py_BEGIN_CRITICAL_SECTION(self);
554-
PyBaseExceptionObject *base_self = _PyBaseExceptionObject_cast(self);
554+
PyBaseExceptionObject *base_self = _PyBaseExceptionObject_CAST(self);
555555
base_self->suppress_context = 1;
556556
Py_XSETREF(base_self->cause, cause);
557557
Py_END_CRITICAL_SECTION();
@@ -562,7 +562,7 @@ PyException_GetContext(PyObject *self)
562562
{
563563
PyObject *context;
564564
Py_BEGIN_CRITICAL_SECTION(self);
565-
context = Py_XNewRef(_PyBaseExceptionObject_cast(self)->context);
565+
context = Py_XNewRef(_PyBaseExceptionObject_CAST(self)->context);
566566
Py_END_CRITICAL_SECTION();
567567
return context;
568568
}
@@ -572,7 +572,7 @@ void
572572
PyException_SetContext(PyObject *self, PyObject *context)
573573
{
574574
Py_BEGIN_CRITICAL_SECTION(self);
575-
Py_XSETREF(_PyBaseExceptionObject_cast(self)->context, context);
575+
Py_XSETREF(_PyBaseExceptionObject_CAST(self)->context, context);
576576
Py_END_CRITICAL_SECTION();
577577
}
578578

@@ -581,7 +581,7 @@ PyException_GetArgs(PyObject *self)
581581
{
582582
PyObject *args;
583583
Py_BEGIN_CRITICAL_SECTION(self);
584-
args = Py_NewRef(_PyBaseExceptionObject_cast(self)->args);
584+
args = Py_NewRef(_PyBaseExceptionObject_CAST(self)->args);
585585
Py_END_CRITICAL_SECTION();
586586
return args;
587587
}
@@ -591,7 +591,7 @@ PyException_SetArgs(PyObject *self, PyObject *args)
591591
{
592592
Py_BEGIN_CRITICAL_SECTION(self);
593593
Py_INCREF(args);
594-
Py_XSETREF(_PyBaseExceptionObject_cast(self)->args, args);
594+
Py_XSETREF(_PyBaseExceptionObject_CAST(self)->args, args);
595595
Py_END_CRITICAL_SECTION();
596596
}
597597

@@ -1829,7 +1829,7 @@ ImportError_reduce(PyObject *self, PyObject *Py_UNUSED(ignored))
18291829
PyObject *state = ImportError_getstate(self);
18301830
if (state == NULL)
18311831
return NULL;
1832-
PyBaseExceptionObject *exc = _PyBaseExceptionObject_cast(self);
1832+
PyBaseExceptionObject *exc = _PyBaseExceptionObject_CAST(self);
18331833
if (state == Py_None)
18341834
res = PyTuple_Pack(2, Py_TYPE(self), exc->args);
18351835
else
@@ -2850,7 +2850,7 @@ KeyError_str(PyObject *op)
28502850
string, that string will be displayed in quotes. Too bad.
28512851
If args is anything else, use the default BaseException__str__().
28522852
*/
2853-
PyBaseExceptionObject *self = _PyBaseExceptionObject_cast(op);
2853+
PyBaseExceptionObject *self = _PyBaseExceptionObject_CAST(op);
28542854
if (PyTuple_GET_SIZE(self->args) == 1) {
28552855
return PyObject_Repr(PyTuple_GET_ITEM(self->args, 0));
28562856
}
@@ -3863,7 +3863,7 @@ _PyErr_NoMemory(PyThreadState *tstate)
38633863
static void
38643864
MemoryError_dealloc(PyObject *op)
38653865
{
3866-
PyBaseExceptionObject *self = _PyBaseExceptionObject_cast(op);
3866+
PyBaseExceptionObject *self = _PyBaseExceptionObject_CAST(op);
38673867
_PyObject_GC_UNTRACK(self);
38683868

38693869
(void)BaseException_clear(op);
@@ -4347,7 +4347,7 @@ _PyException_AddNote(PyObject *exc, PyObject *note)
43474347
Py_TYPE(exc)->tp_name);
43484348
return -1;
43494349
}
4350-
PyObject *r = BaseException_add_note(_PyBaseExceptionObject_cast(exc), note);
4350+
PyObject *r = BaseException_add_note(_PyBaseExceptionObject_CAST(exc), note);
43514351
int res = r == NULL ? -1 : 0;
43524352
Py_XDECREF(r);
43534353
return res;

0 commit comments

Comments
 (0)