Skip to content

Commit

Permalink
ssl: fix for Python 2.7.9
Browse files Browse the repository at this point in the history
  • Loading branch information
geertj committed Dec 23, 2014
1 parent e42135d commit 274a798
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions gruvi/_sslcompat.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,17 @@ typedef struct
} PySSLObject;


#if PY_MAJOR_VERSION == 3
# define CHECK_SSL_OBJ(obj) \
do { \
if (strcmp(Py_TYPE(obj)->tp_name, "_ssl._SSLSocket")) \
RETURN_ERROR("expecting a _ssl._SSLSocket instance"); \
} while (0)
#elif PY_MAJOR_VERSION == 2
# define CHECK_SSL_OBJ(obj) \
#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 7 && PY_MICRO_VERSION < 9
# define SSL_OBJ_NAME "ssl.SSLContext"
#else
# define SSL_OBJ_NAME "_ssl._SSLSocket"
#endif

#define CHECK_SSL_OBJ(obj) \
do { \
if (strcmp(Py_TYPE(obj)->tp_name, "ssl.SSLContext")) \
RETURN_ERROR("expecting a ssl.SSLContext instance"); \
if (strcmp(Py_TYPE(obj)->tp_name, SSL_OBJ_NAME)) \
RETURN_ERROR("expecting a " SSL_OBJ_NAME " instance"); \
} while (0)
#endif


/* MemoryBIO type */
Expand Down

0 comments on commit 274a798

Please sign in to comment.