summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2022-10-07 10:24:45 +0200
committerJose M. Guisado <jguisado@soleta.eu>2022-12-15 12:16:52 +0100
commitbd2703c54ea42da625b7e521297f9c4e493d86bb (patch)
treea530f975b6910baf3e6a7221f2d16130ec51d7cb
parent3d9db0b93b45d2751009a010fef14003cca5797c (diff)
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.
-rw-r--r--partition.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/partition.c b/partition.c
index f1cc5e3..15dd28f 100644
--- a/partition.c
+++ b/partition.c
@@ -70,8 +70,7 @@ static PyObject *Partition_get_partno(PartitionObject *self)
if (fdisk_partition_has_partno(self->pa)) {
return PyLong_FromSize_t(fdisk_partition_get_partno(self->pa));
}
- // Py_RETURN_NONE;
- return Py_BuildValue("%d", -1);
+ Py_RETURN_NONE;
}
static PyObject *Partition_get_size(PartitionObject *self)
{