1
+ #include "pythoncapi-compat/pythoncapi_compat.h"
2
+
1
3
#ifndef PY_SCSOBJECT_H
2
4
#define PY_SCSOBJECT_H
3
5
@@ -398,7 +400,7 @@ static int SCS_init(SCS *self, PyObject *args, PyObject *kwargs) {
398
400
d -> A = A ;
399
401
400
402
/* set P if passed in */
401
- if ((void * )Px != Py_None && (void * )Pi != Py_None && (void * )Pp != Py_None ) {
403
+ if ((void * )! Py_IsNone ( Px ) && (void * )! Py_IsNone ( Pi ) && (void * )! Py_IsNone ( Pp ) ) {
402
404
if (!PyArray_ISFLOAT (Px ) || PyArray_NDIM (Px ) != 1 ) {
403
405
free_py_scs_data (d , k , stgs , & ps );
404
406
return finish_with_error ("Px must be a numpy array of floats" );
@@ -605,17 +607,17 @@ static PyObject *SCS_solve(SCS *self, PyObject *args) {
605
607
606
608
if (_warm_start ) {
607
609
/* If any of these of missing, we use the values in sol */
608
- if ((void * )warm_x != Py_None ) {
610
+ if ((void * )! Py_IsNone ( warm_x ) ) {
609
611
if (get_warm_start (self -> sol -> x , self -> n , warm_x ) < 0 ) {
610
612
return none_with_error ("Unable to parse x warm-start" );
611
613
}
612
614
}
613
- if ((void * )warm_y != Py_None ) {
615
+ if ((void * )! Py_IsNone ( warm_y ) ) {
614
616
if (get_warm_start (self -> sol -> y , self -> m , warm_y ) < 0 ) {
615
617
return none_with_error ("Unable to parse y warm-start" );
616
618
}
617
619
}
618
- if ((void * )warm_s != Py_None ) {
620
+ if ((void * )! Py_IsNone ( warm_s ) ) {
619
621
if (get_warm_start (self -> sol -> s , self -> m , warm_s ) < 0 ) {
620
622
return none_with_error ("Unable to parse s warm-start" );
621
623
}
@@ -727,7 +729,7 @@ PyObject *SCS_update(SCS *self, PyObject *args) {
727
729
return none_with_error ("Error parsing inputs" );
728
730
}
729
731
/* set c */
730
- if ((void * )c_new != Py_None ) {
732
+ if ((void * )! Py_IsNone ( c_new ) ) {
731
733
if (!PyArray_ISFLOAT (c_new ) || PyArray_NDIM (c_new ) != 1 ) {
732
734
return none_with_error (
733
735
"c_new must be a dense numpy array with one dimension" );
@@ -739,7 +741,7 @@ PyObject *SCS_update(SCS *self, PyObject *args) {
739
741
c = (scs_float * )PyArray_DATA (c_new );
740
742
}
741
743
/* set b */
742
- if ((void * )b_new != Py_None ) {
744
+ if ((void * )! Py_IsNone ( b_new ) ) {
743
745
if (!PyArray_ISFLOAT (b_new ) || PyArray_NDIM (b_new ) != 1 ) {
744
746
return none_with_error (
745
747
"b must be a dense numpy array with one dimension" );
@@ -776,7 +778,7 @@ static scs_int SCS_finish(SCS *self) {
776
778
}
777
779
778
780
/* Del python object */
779
- PyObject_Del (self );
781
+ PyObject_Free (self );
780
782
781
783
return 0 ;
782
784
}
0 commit comments