File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -67,12 +67,18 @@ static int PyXmlSec_CheckLxmlLibraryVersion(void) {
6767 if (version == NULL ) {
6868 goto FINALIZE ;
6969 }
70- if (!PyTuple_Check (version ) || PyTuple_Size (version ) != 3 ) {
70+ if (!PyTuple_Check (version ) || PyTuple_Size (version ) < 2 ) {
7171 goto FINALIZE ;
7272 }
7373
7474 PyObject * major = PyTuple_GetItem (version , 0 );
75+ if (major == NULL ) {
76+ goto FINALIZE ;
77+ }
7578 PyObject * minor = PyTuple_GetItem (version , 1 );
79+ if (minor == NULL ) {
80+ goto FINALIZE ;
81+ }
7682
7783 if (!PyLong_Check (major ) || !PyLong_Check (minor )) {
7884 goto FINALIZE ;
@@ -85,9 +91,13 @@ static int PyXmlSec_CheckLxmlLibraryVersion(void) {
8591 result = 0 ;
8692
8793FINALIZE :
94+ // Clear any errors that may have occurred
95+ PyErr_Clear ();
96+
8897 // Cleanup our references, and return the result
8998 Py_XDECREF (lxml );
9099 Py_XDECREF (version );
100+
91101 return result ;
92102}
93103
You can’t perform that action at this time.
0 commit comments