@@ -35,7 +35,7 @@ PyObject *py2bitEnter(pyTwoBit_t *self, PyObject *args) {
35
35
pyTwoBit_t * pytb = self -> tb ;
36
36
37
37
if (!pytb ) {
38
- PyErr_SetString (PyExc_RuntimeError , "The 2bit file handle is not opened !" );
38
+ PyErr_SetString (PyExc_RuntimeError , "The 2bit file handle is not open !" );
39
39
return NULL ;
40
40
}
41
41
@@ -62,6 +62,11 @@ static PyObject *py2bitInfo(pyTwoBit_t *self, PyObject *args) {
62
62
PyObject * ret = NULL , * val = NULL ;
63
63
uint32_t i , j , foo ;
64
64
65
+ if (!tb ) {
66
+ PyErr_SetString (PyExc_RuntimeError , "The 2bit file handle is not open!" );
67
+ return NULL ;
68
+ }
69
+
65
70
ret = PyDict_New ();
66
71
67
72
//file size
@@ -126,6 +131,11 @@ static PyObject *py2bitChroms(pyTwoBit_t *self, PyObject *args) {
126
131
char * chrom = NULL ;
127
132
uint32_t i ;
128
133
134
+ if (!tb ) {
135
+ PyErr_SetString (PyExc_RuntimeError , "The 2bit file handle is not open!" );
136
+ return NULL ;
137
+ }
138
+
129
139
if (!(PyArg_ParseTuple (args , "|s" , & chrom )) || !chrom ) {
130
140
ret = PyDict_New ();
131
141
if (!ret ) goto error ;
@@ -173,6 +183,11 @@ static PyObject *py2bitSequence(pyTwoBit_t *self, PyObject *args, PyObject *kwds
173
183
uint32_t start , end , len ;
174
184
static char * kwd_list [] = {"chrom" , "start" , "end" , NULL };
175
185
186
+ if (!tb ) {
187
+ PyErr_SetString (PyExc_RuntimeError , "The 2bit file handle is not open!" );
188
+ return NULL ;
189
+ }
190
+
176
191
if (!PyArg_ParseTupleAndKeywords (args , kwds , "s|kk" , kwd_list , & chrom , & startl , & endl )) {
177
192
PyErr_SetString (PyExc_RuntimeError , "You must supply at least a chromosome!" );
178
193
return NULL ;
@@ -217,6 +232,11 @@ static PyObject *py2bitBases(pyTwoBit_t *self, PyObject *args, PyObject *kwds) {
217
232
static char * kwd_list [] = {"chrom" , "start" , "end" , "fraction" , NULL };
218
233
int fraction = 1 ;
219
234
235
+ if (!tb ) {
236
+ PyErr_SetString (PyExc_RuntimeError , "The 2bit file handle is not open!" );
237
+ return NULL ;
238
+ }
239
+
220
240
if (!PyArg_ParseTupleAndKeywords (args , kwds , "s|kkO" , kwd_list , & chrom , & startl , & endl , & fractionO )) {
221
241
PyErr_SetString (PyExc_RuntimeError , "You must supply at least a chromosome!" );
222
242
return NULL ;
0 commit comments