Skip to content

Commit 29f6979

Browse files
committed
remove PyZoneInfo_ZoneInfo_FAST_CAST macro
Raw casts were restored when they could be left as is
1 parent d97c2fd commit 29f6979

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Modules/_zoneinfo.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ typedef struct {
5656
unsigned char source;
5757
} PyZoneInfo_ZoneInfo;
5858

59-
#define PyZoneInfo_ZoneInfo_FAST_CAST(op) ((PyZoneInfo_ZoneInfo *)(op))
60-
#define PyZoneInfo_ZoneInfo_CAST(op) PyZoneInfo_ZoneInfo_FAST_CAST(op)
59+
#define PyZoneInfo_ZoneInfo_CAST(op) ((PyZoneInfo_ZoneInfo *)(op))
6160

6261
struct TransitionRuleType {
6362
int64_t (*year_to_timestamp)(TransitionRuleType *, int);
@@ -254,7 +253,8 @@ zoneinfo_new_instance(zoneinfo_state *state, PyTypeObject *type, PyObject *key)
254253
}
255254
}
256255

257-
if (load_data(state, PyZoneInfo_ZoneInfo_FAST_CAST(self), file_obj)) {
256+
PyZoneInfo_ZoneInfo *self_zinfo = (PyZoneInfo_ZoneInfo *)self;
257+
if (load_data(state, self_zinfo, file_obj)) {
258258
goto error;
259259
}
260260

@@ -265,7 +265,7 @@ zoneinfo_new_instance(zoneinfo_state *state, PyTypeObject *type, PyObject *key)
265265
}
266266
Py_DECREF(rv);
267267

268-
PyZoneInfo_ZoneInfo_FAST_CAST(self)->key = Py_NewRef(key);
268+
self_zinfo->key = Py_NewRef(key);
269269

270270
goto cleanup;
271271
error:
@@ -341,7 +341,7 @@ zoneinfo_ZoneInfo_impl(PyTypeObject *type, PyObject *key)
341341
if (instance == NULL) {
342342
return NULL;
343343
}
344-
PyZoneInfo_ZoneInfo_FAST_CAST(instance)->source = SOURCE_CACHE;
344+
((PyZoneInfo_ZoneInfo *)(instance))->source = SOURCE_CACHE;
345345
}
346346

347347
update_strong_cache(state, type, key, instance);
@@ -425,11 +425,10 @@ zoneinfo_ZoneInfo_from_file_impl(PyTypeObject *type, PyTypeObject *cls,
425425
PyObject *file_repr = NULL;
426426
PyZoneInfo_ZoneInfo *self = NULL;
427427

428-
PyObject *obj_self = type->tp_alloc(type, 0);
429-
if (obj_self == NULL) {
428+
self = (PyZoneInfo_ZoneInfo *)type->tp_alloc(type, 0);
429+
if (self == NULL) {
430430
return NULL;
431431
}
432-
self = PyZoneInfo_ZoneInfo_FAST_CAST(obj_self);
433432

434433
file_repr = PyObject_Repr(file_obj);
435434
if (file_repr == NULL) {
@@ -444,7 +443,7 @@ zoneinfo_ZoneInfo_from_file_impl(PyTypeObject *type, PyTypeObject *cls,
444443
self->source = SOURCE_FILE;
445444
self->file_repr = file_repr;
446445
self->key = Py_NewRef(key);
447-
return obj_self;
446+
return (PyObject *)self;
448447

449448
error:
450449
Py_XDECREF(file_repr);

0 commit comments

Comments
 (0)