partition: return None if partno is unset
Undefined values in libfdisk should map to None type in Python. Py_BuildValue("%d", -1); is also incorrectly formatted and raises an error when executed.master
parent
3d9db0b93b
commit
bd2703c54e
|
@ -70,8 +70,7 @@ static PyObject *Partition_get_partno(PartitionObject *self)
|
||||||
if (fdisk_partition_has_partno(self->pa)) {
|
if (fdisk_partition_has_partno(self->pa)) {
|
||||||
return PyLong_FromSize_t(fdisk_partition_get_partno(self->pa));
|
return PyLong_FromSize_t(fdisk_partition_get_partno(self->pa));
|
||||||
}
|
}
|
||||||
// Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
return Py_BuildValue("%d", -1);
|
|
||||||
}
|
}
|
||||||
static PyObject *Partition_get_size(PartitionObject *self)
|
static PyObject *Partition_get_size(PartitionObject *self)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue