File tree 1 file changed +11
-1
lines changed
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) {
67
67
if (version == NULL ) {
68
68
goto FINALIZE ;
69
69
}
70
- if (!PyTuple_Check (version ) || PyTuple_Size (version ) != 3 ) {
70
+ if (!PyTuple_Check (version ) || PyTuple_Size (version ) < 2 ) {
71
71
goto FINALIZE ;
72
72
}
73
73
74
74
PyObject * major = PyTuple_GetItem (version , 0 );
75
+ if (major == NULL ) {
76
+ goto FINALIZE ;
77
+ }
75
78
PyObject * minor = PyTuple_GetItem (version , 1 );
79
+ if (minor == NULL ) {
80
+ goto FINALIZE ;
81
+ }
76
82
77
83
if (!PyLong_Check (major ) || !PyLong_Check (minor )) {
78
84
goto FINALIZE ;
@@ -85,9 +91,13 @@ static int PyXmlSec_CheckLxmlLibraryVersion(void) {
85
91
result = 0 ;
86
92
87
93
FINALIZE :
94
+ // Clear any errors that may have occurred
95
+ PyErr_Clear ();
96
+
88
97
// Cleanup our references, and return the result
89
98
Py_XDECREF (lxml );
90
99
Py_XDECREF (version );
100
+
91
101
return result ;
92
102
}
93
103
You can’t perform that action at this time.
0 commit comments