Skip to content

Commit fe9f918

Browse files
committed
Do not use _ + capital letter in cast macros as it is also UB.
1 parent d734c1e commit fe9f918

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Modules/_ssl/cert.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,13 @@ _x509name_print(_sslmodulestate *state, X509_NAME *name, int indent, unsigned lo
153153
* PySSLCertificate_Type
154154
*/
155155

156-
#define _PySSLCertificate_CAST(op) ((PySSLCertificate *)(op))
156+
#define PySSLCertificate_CAST(op) ((PySSLCertificate *)(op))
157157

158158
static PyObject *
159159
certificate_repr(PyObject *op)
160160
{
161161
PyObject *osubject, *result;
162-
PySSLCertificate *self = _PySSLCertificate_CAST(op);
162+
PySSLCertificate *self = PySSLCertificate_CAST(op);
163163

164164
/* subject string is ASCII encoded, UTF-8 chars are quoted */
165165
osubject = _x509name_print(
@@ -181,7 +181,7 @@ certificate_repr(PyObject *op)
181181
static Py_hash_t
182182
certificate_hash(PyObject *op)
183183
{
184-
PySSLCertificate *self = _PySSLCertificate_CAST(op);
184+
PySSLCertificate *self = PySSLCertificate_CAST(op);
185185
if (self->hash == (Py_hash_t)-1) {
186186
unsigned long hash;
187187
hash = X509_subject_name_hash(self->cert);
@@ -198,7 +198,7 @@ static PyObject *
198198
certificate_richcompare(PyObject *lhs, PyObject *rhs, int op)
199199
{
200200
int cmp;
201-
PySSLCertificate *self = _PySSLCertificate_CAST(lhs);
201+
PySSLCertificate *self = PySSLCertificate_CAST(lhs);
202202
_sslmodulestate *state = get_state_cert(self);
203203

204204
if (Py_TYPE(rhs) != state->PySSLCertificate_Type) {
@@ -219,7 +219,7 @@ certificate_richcompare(PyObject *lhs, PyObject *rhs, int op)
219219
static void
220220
certificate_dealloc(PyObject *op)
221221
{
222-
PySSLCertificate *self = _PySSLCertificate_CAST(op);
222+
PySSLCertificate *self = PySSLCertificate_CAST(op);
223223
PyTypeObject *tp = Py_TYPE(self);
224224
X509_free(self->cert);
225225
(void)Py_TYPE(self)->tp_free(self);

0 commit comments

Comments
 (0)