Blob Blame History Raw
diff -up pyparted-3.11.7/src/pydisk.c.orig pyparted-3.11.7/src/pydisk.c
--- pyparted-3.11.7/src/pydisk.c.orig	2019-04-23 14:23:44.456665800 -0400
+++ pyparted-3.11.7/src/pydisk.c	2021-07-09 15:59:00.998981206 -0400
@@ -205,8 +205,7 @@ int _ped_Partition_init(_ped_Partition *
         if (partedExnRaised) {
             partedExnRaised = 0;
 
-            if (!PyErr_ExceptionMatches(PartedException) &&
-                !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
+            if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                 PyErr_SetString(PartitionException, partedExnMessage);
             }
         } else {
@@ -423,8 +422,7 @@ int _ped_Disk_init(_ped_Disk *self, PyOb
         if (partedExnRaised) {
             partedExnRaised = 0;
 
-            if (!PyErr_ExceptionMatches(PartedException) &&
-                !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
+            if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                 PyErr_SetString(DiskLabelException, partedExnMessage);
             }
         } else {
@@ -548,6 +546,7 @@ PyObject *py_ped_disk_type_get_next(PyOb
     }
 
     next = ped_disk_type_get_next(cur);
+
     if (next) {
         ret = PedDiskType2_ped_DiskType(next);
         return (PyObject *) ret;
@@ -575,6 +574,7 @@ PyObject *py_ped_disk_type_get(PyObject
         }
 
         ret = PedDiskType2_ped_DiskType(out_type);
+
         if (ret == NULL) {
             return NULL;
         }
@@ -590,16 +590,14 @@ PyObject *py_ped_disk_type_check_feature
     int ret = 0;
 
     if (!PyArg_ParseTuple(args, "i", &feature)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     disktype = _ped_DiskType2PedDiskType(s);
+
     if (disktype) {
         ret = ped_disk_type_check_feature(disktype, feature);
     }
-    else {
-        return NULL;
-    }
 
     if (ret) {
         Py_RETURN_TRUE;
@@ -613,29 +611,28 @@ PyObject *py_ped_disk_clobber(PyObject *
     int ret = 0;
 
     device = _ped_Device2PedDevice(s);
-    if (device == NULL)
-        return NULL;
+
+    if (device == NULL) {
+        return (PyObject *) NULL;
+    }
 
     ret = ped_disk_clobber(device);
+
     if (ret == 0) {
         if (partedExnRaised) {
             partedExnRaised = 0;
 
-            if (!PyErr_ExceptionMatches(PartedException) &&
-                !PyErr_ExceptionMatches(PyExc_NotImplementedError))
+            if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                 PyErr_SetString(IOException, partedExnMessage);
-        }
-        else
+            }
+        } else {
             PyErr_Format(DiskException, "Failed to clobber partition table on device %s", device->path);
+        }
 
-        return NULL;
+        return (PyObject *) NULL;
     }
 
-    if (ret) {
-        Py_RETURN_TRUE;
-    } else {
-        Py_RETURN_FALSE;
-    }
+    Py_RETURN_TRUE;
 }
 
 /* XXX: is this necessary? */
@@ -644,18 +641,20 @@ PyObject *py_ped_disk_duplicate(PyObject
     _ped_Disk *ret = NULL;
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk) {
         pass_disk = ped_disk_duplicate(disk);
+
         if (pass_disk == NULL) {
             if (partedExnRaised) {
                 partedExnRaised = 0;
 
-                if (!PyErr_ExceptionMatches(PartedException) &&
-                    !PyErr_ExceptionMatches(PyExc_NotImplementedError))
+                if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                     PyErr_SetString(IOException, partedExnMessage);
-            }
-            else
+                }
+            } else {
                 PyErr_Format(DiskException, "Could not duplicate device %s", disk->dev->path);
+            }
 
             return NULL;
         }
@@ -664,8 +663,7 @@ PyObject *py_ped_disk_duplicate(PyObject
         if (ret == NULL) {
             return NULL;
         }
-    }
-    else {
+    } else {
         return NULL;
     }
 
@@ -685,8 +683,9 @@ PyObject *py_ped_disk_destroy(PyObject *
     PedDisk *disk = NULL;
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     ped_disk_destroy(disk);
@@ -701,26 +700,24 @@ PyObject *py_ped_disk_commit(PyObject *s
     int ret = 0;
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk) {
         ret = ped_disk_commit(disk);
+
         if (ret == 0) {
             if (partedExnRaised) {
                 partedExnRaised = 0;
 
-                if (!PyErr_ExceptionMatches(PartedException) &&
-                    !PyErr_ExceptionMatches(PyExc_NotImplementedError))
+                if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                     PyErr_SetString(IOException, partedExnMessage);
+                }
+            } else {
+                PyErr_Format(DiskException, "Could not commit to disk %s, (%s)", disk->dev->path, __func__);
             }
-            else
-                PyErr_Format(DiskException, "Could not commit to disk %s, (%s)",
-                             disk->dev->path, __func__);
 
-            return NULL;
+            return (PyObject *) NULL;
         }
     }
-    else {
-        return NULL;
-    }
 
     if (ret) {
         Py_RETURN_TRUE;
@@ -734,26 +731,24 @@ PyObject *py_ped_disk_commit_to_dev(PyOb
     int ret = 0;
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk) {
         ret = ped_disk_commit_to_dev(disk);
+
         if (ret == 0) {
             if (partedExnRaised) {
                 partedExnRaised = 0;
 
-                if (!PyErr_ExceptionMatches(PartedException) &&
-                    !PyErr_ExceptionMatches(PyExc_NotImplementedError))
+                if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                     PyErr_SetString(IOException, partedExnMessage);
+                }
+            } else {
+                PyErr_Format(DiskException, "Could not commit to disk %s, (%s)", disk->dev->path, __func__);
             }
-            else
-                PyErr_Format(DiskException, "Could not commit to disk %s, (%s)",
-                             disk->dev->path, __func__);
 
-            return NULL;
+            return (PyObject *) NULL;
         }
     }
-    else {
-        return NULL;
-    }
 
     if (ret) {
         Py_RETURN_TRUE;
@@ -773,20 +768,16 @@ PyObject *py_ped_disk_commit_to_os(PyObj
             if (partedExnRaised) {
                 partedExnRaised = 0;
 
-                if (!PyErr_ExceptionMatches(PartedException) &&
-                    !PyErr_ExceptionMatches(PyExc_NotImplementedError))
+                if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                     PyErr_SetString(IOException, partedExnMessage);
+                }
+            } else {
+                PyErr_Format(DiskException, "Could not commit to disk %s, (%s)", disk->dev->path, __func__);
             }
-            else
-                PyErr_Format(DiskException, "Could not commit to disk %s, (%s)",
-                             disk->dev->path, __func__);
 
-            return NULL;
+            return (PyObject *) NULL;
         }
     }
-    else {
-        return NULL;
-    }
 
     if (ret) {
         Py_RETURN_TRUE;
@@ -800,25 +791,24 @@ PyObject *py_ped_disk_check(PyObject *s,
     int ret = 0;
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk) {
         ret = ped_disk_check(disk);
+
         if (ret == 0) {
             if (partedExnRaised) {
                 partedExnRaised = 0;
 
-                if (!PyErr_ExceptionMatches(PartedException) &&
-                    !PyErr_ExceptionMatches(PyExc_NotImplementedError))
+                if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                     PyErr_SetString(IOException, partedExnMessage);
-            }
-            else
+                }
+            } else {
                 PyErr_Format(DiskException, "Could not check disk %s", disk->dev->path);
+            }
 
-            return NULL;
+            return (PyObject *) NULL;
         }
     }
-    else {
-        return NULL;
-    }
 
     if (ret) {
         Py_RETURN_TRUE;
@@ -831,12 +821,10 @@ PyObject *py_ped_disk_print(PyObject *s,
     PedDisk *disk = NULL;
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk) {
         ped_disk_print(disk);
     }
-    else {
-        return NULL;
-    }
 
     Py_INCREF(Py_None);
     return Py_None;
@@ -847,12 +835,10 @@ PyObject *py_ped_disk_get_primary_partit
     int ret = 0;
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk) {
         ret = ped_disk_get_primary_partition_count(disk);
     }
-    else {
-        return NULL;
-    }
 
     return PyLong_FromLong(ret);
 }
@@ -862,38 +848,33 @@ PyObject *py_ped_disk_get_last_partition
     int ret = 0;
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk) {
         ret = ped_disk_get_last_partition_num(disk);
     }
-    else {
-        return NULL;
-    }
 
     return PyLong_FromLong(ret);
 }
 
-PyObject *py_ped_disk_get_max_primary_partition_count(PyObject *s,
-                                                      PyObject *args) {
+PyObject *py_ped_disk_get_max_primary_partition_count(PyObject *s, PyObject *args) {
     PedDisk *disk = NULL;
     int ret = 0;
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk) {
         ret = ped_disk_get_max_primary_partition_count(disk);
     }
-    else {
-        return NULL;
-    }
 
     return PyLong_FromLong(ret);
 }
 
-PyObject *py_ped_disk_get_max_supported_partition_count(PyObject *s,
-                                                        PyObject *args) {
+PyObject *py_ped_disk_get_max_supported_partition_count(PyObject *s, PyObject *args) {
     PedDisk *disk = NULL;
     int max = 0;
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk) {
         if (ped_disk_get_max_supported_partition_count(disk, &max) == true) {
             return Py_BuildValue("i", max);
@@ -910,13 +891,16 @@ PyObject *py_ped_disk_get_partition_alig
     _ped_Alignment *ret = NULL;
 
     disk = _ped_Disk2PedDisk(s);
-    if (!disk)
-        return NULL;
+
+    if (!disk) {
+        return (PyObject *) NULL;
+    }
 
     alignment = ped_disk_get_partition_alignment(disk);
+
     if (!alignment) {
         PyErr_SetString(CreateException, "Could not get alignment for device");
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     ret = PedAlignment2_ped_Alignment(alignment);
@@ -929,8 +913,10 @@ PyObject *py_ped_disk_max_partition_leng
     PedDisk *disk = NULL;
 
     disk = _ped_Disk2PedDisk(s);
-    if (!disk)
-        return NULL;
+
+    if (!disk) {
+        return (PyObject *) NULL;
+    }
 
     return PyLong_FromUnsignedLongLong(ped_disk_max_partition_length(disk));
 }
@@ -939,8 +925,10 @@ PyObject *py_ped_disk_max_partition_star
     PedDisk *disk = NULL;
 
     disk = _ped_Disk2PedDisk(s);
-    if (!disk)
-        return NULL;
+
+    if (!disk) {
+        return (PyObject *) NULL;
+    }
 
     return PyLong_FromUnsignedLongLong(ped_disk_max_partition_start_sector(disk));
 }
@@ -950,27 +938,29 @@ PyObject *py_ped_disk_set_flag(PyObject
     PedDisk *disk = NULL;
 
     if (!PyArg_ParseTuple(args, "ii", &flag, &state)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     ret = ped_disk_set_flag(disk, flag, state);
+
     if (ret == 0) {
         if (partedExnRaised) {
             partedExnRaised = 0;
 
-            if (!PyErr_ExceptionMatches(PartedException) &&
-                !PyErr_ExceptionMatches(PyExc_NotImplementedError))
+            if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                 PyErr_SetString(DiskException, partedExnMessage);
-        }
-        else
+            }
+        } else {
             PyErr_Format(DiskException, "Could not set flag on disk %s", disk->dev->path);
+        }
 
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     Py_RETURN_TRUE;
@@ -981,12 +971,13 @@ PyObject *py_ped_disk_get_flag(PyObject
     PedDisk *disk = NULL;
 
     if (!PyArg_ParseTuple(args, "i", &flag)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (ped_disk_get_flag(disk, flag)) {
@@ -1001,12 +992,13 @@ PyObject *py_ped_disk_is_flag_available(
     PedDisk *disk = NULL;
 
     if (!PyArg_ParseTuple(args, "i", &flag)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (ped_disk_is_flag_available(disk, flag)) {
@@ -1021,27 +1013,28 @@ PyObject *py_ped_disk_flag_get_name(PyOb
     char *ret = NULL;
 
     if (!PyArg_ParseTuple(args, "i", &flag)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (flag < PED_DISK_FIRST_FLAG) {
         PyErr_SetString(PyExc_ValueError, "Invalid flag provided.");
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     ret = (char *) ped_disk_flag_get_name(flag);
+
     if (ret == NULL) {
         if (partedExnRaised) {
             partedExnRaised = 0;
 
-            if (!PyErr_ExceptionMatches(PartedException) &&
-                !PyErr_ExceptionMatches(PyExc_NotImplementedError))
+            if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                 PyErr_SetString(DiskException, partedExnMessage);
-        }
-        else
+            }
+        } else {
             PyErr_Format(DiskException, "Could not get disk flag name for %d", flag);
+        }
 
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     return PyUnicode_FromString(ret);
@@ -1051,7 +1044,7 @@ PyObject *py_ped_disk_flag_get_by_name(P
     char *name = NULL;
 
     if (!PyArg_ParseTuple(args, "s", &name)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     return PyLong_FromLong(ped_disk_flag_get_by_name(name));
@@ -1061,7 +1054,7 @@ PyObject *py_ped_disk_flag_next(PyObject
     int flag;
 
     if (!PyArg_ParseTuple(args, "i", &flag)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     return Py_BuildValue("i", ped_disk_flag_next(flag));
@@ -1080,8 +1073,9 @@ PyObject *py_ped_partition_destroy(_ped_
     PedPartition *partition = NULL;
 
     partition = _ped_Partition2PedPartition(s);
+
     if (partition == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     ped_partition_destroy(partition);
@@ -1096,12 +1090,10 @@ PyObject *py_ped_partition_is_active(_pe
     int ret = 0;
 
     partition = _ped_Partition2PedPartition(s);
+
     if (partition) {
         ret = ped_partition_is_active(partition);
     }
-    else {
-        return NULL;
-    }
 
     if (ret) {
         Py_RETURN_TRUE;
@@ -1117,28 +1109,30 @@ PyObject *py_ped_partition_set_flag(_ped
     int ret = 0;
 
     if (!PyArg_ParseTuple(args, "ii", &flag, &in_state)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     part = _ped_Partition2PedPartition(s);
+
     if (part == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (part && flag && in_state > -1) {
         ret = ped_partition_set_flag(part, flag, in_state);
+
         if (ret == 0) {
             if (partedExnRaised) {
                 partedExnRaised = 0;
 
-                if (!PyErr_ExceptionMatches(PartedException) &&
-                    !PyErr_ExceptionMatches(PyExc_NotImplementedError))
+                if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                     PyErr_SetString(PartitionException, partedExnMessage);
-            }
-            else
+                }
+            } else {
                 PyErr_Format(PartitionException, "Could not set flag on partition %s%d", part->disk->dev->path, part->num);
+            }
 
-            return NULL;
+            return (PyObject *) NULL;
         }
     }
 
@@ -1155,18 +1149,19 @@ PyObject *py_ped_partition_get_flag(_ped
     int ret = -1;
 
     if (!PyArg_ParseTuple(args, "i", &flag)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     part = _ped_Partition2PedPartition(s);
+
     if (part == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     /* ped_partition_get_flag will assert on this. */
     if (!ped_partition_is_active(part)) {
         PyErr_Format(PartitionException, "Could not get flag on inactive partition %s%d", part->disk->dev->path, part->num);
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     ret = ped_partition_get_flag(part, flag);
@@ -1184,17 +1179,18 @@ PyObject *py_ped_partition_is_flag_avail
     int ret = 0;
 
     if (!PyArg_ParseTuple(args, "i", &flag)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     part = _ped_Partition2PedPartition(s);
+
     if (part == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (!ped_partition_is_active(part)) {
         PyErr_Format(PartitionException, "Flag is not available on inactive partition %s%d", part->disk->dev->path, part->num);
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     ret = ped_partition_is_flag_available(part, flag);
@@ -1213,31 +1209,34 @@ PyObject *py_ped_partition_set_system(_p
     int ret = 0;
 
     if (!PyArg_ParseTuple(args, "O!", &_ped_FileSystemType_Type_obj, &in_fstype)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     part = _ped_Partition2PedPartition(s);
+
     if (part == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (in_fstype != NULL) {
         out_fstype = _ped_FileSystemType2PedFileSystemType(in_fstype);
+
         if (out_fstype == NULL) {
-            return NULL;
+            return (PyObject *) NULL;
         }
     }
 
     /* ped_partition_set_system will assert on this. */
     if (!ped_partition_is_active(part)) {
         PyErr_Format(PartitionException, "Could not set system flag on inactive partition %s%d", part->disk->dev->path, part->num);
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     ret = ped_partition_set_system(part, out_fstype);
+
     if (ret == 0) {
         PyErr_Format(PartitionException, "Could not set system flag on partition %s%d", part->disk->dev->path, part->num);
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (ret) {
@@ -1253,34 +1252,35 @@ PyObject *py_ped_partition_set_name(_ped
     int ret = 0;
 
     if (!PyArg_ParseTuple(args, "s", &in_name)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     part = _ped_Partition2PedPartition(s);
+
     if (part == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     /* ped_partition_set_name will assert on this. */
     if (!ped_partition_is_active(part)) {
         PyErr_Format(PartitionException, "Could not set system flag on inactive partition %s%d", part->disk->dev->path, part->num);
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     ret = ped_partition_set_name(part, in_name);
+
     if (ret == 0) {
         if (partedExnRaised) {
             partedExnRaised = 0;
 
-            if (!PyErr_ExceptionMatches(PartedException) &&
-                !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
+            if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                 PyErr_SetString(PartitionException, partedExnMessage);
             }
         } else {
             PyErr_Format(PartitionException, "Could not set name on partition %s%d", part->disk->dev->path, part->num);
         }
 
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (ret) {
@@ -1295,30 +1295,31 @@ PyObject *py_ped_partition_get_name(_ped
     char *ret = NULL;
 
     part = _ped_Partition2PedPartition(s);
+
     if (part == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     /* ped_partition_get_name will assert on this. */
     if (!ped_partition_is_active(part)) {
         PyErr_Format(PartitionException, "Could not get name on inactive partition %s%d", part->disk->dev->path, part->num);
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     ret = (char *) ped_partition_get_name(part);
+
     if (ret == NULL) {
         if (partedExnRaised) {
             partedExnRaised = 0;
 
-            if (!PyErr_ExceptionMatches(PartedException) &&
-                !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
+            if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                 PyErr_SetString(PartitionException, partedExnMessage);
             }
         } else {
             PyErr_Format(PartitionException, "Could not read name on partition %s%d", part->disk->dev->path, part->num);
         }
 
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     return PyUnicode_FromString(ret);
@@ -1329,13 +1330,13 @@ PyObject *py_ped_partition_is_busy(_ped_
     int ret = 0;
 
     part = _ped_Partition2PedPartition(s);
-    if (part) {
-        ret = ped_partition_is_busy(part);
-    }
-    else {
-        return NULL;
+
+    if (part == NULL) {
+        return (PyObject *) NULL;
     }
 
+    ret = ped_partition_is_busy(part);
+
     if (ret) {
         Py_RETURN_TRUE;
     } else {
@@ -1348,15 +1349,16 @@ PyObject *py_ped_partition_get_path(_ped
     char *ret = NULL;
 
     part = _ped_Partition2PedPartition(s);
-    if (part) {
-        ret = ped_partition_get_path(part);
-        if (ret == NULL) {
-            PyErr_Format(PartitionException, "Could not get path for partition %s%d", part->disk->dev->path, part->num);
-            return NULL;
-        }
+
+    if (part == NULL) {
+        return (PyObject *) NULL;
     }
-    else {
-        return NULL;
+
+    ret = ped_partition_get_path(part);
+
+    if (ret == NULL) {
+        PyErr_Format(PartitionException, "Could not get path for partition %s%d", part->disk->dev->path, part->num);
+        return (PyObject *) NULL;
     }
 
     return PyUnicode_FromString(ret);
@@ -1366,12 +1368,12 @@ PyObject *py_ped_partition_reset_num(_pe
     PedPartition *part = NULL;
 
     part = _ped_Partition2PedPartition(s);
+
     if (part == NULL) {
-        Py_RETURN_FALSE;
+        return (PyObject *) NULL;
     }
 
     part->num = -1;
-
     Py_RETURN_TRUE;
 }
 
@@ -1381,17 +1383,18 @@ PyObject *py_ped_partition_type_get_name
     char *ret = NULL;
 
     if (!PyArg_ParseTuple(args, "i", &type)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (type) {
         ret = (char *) ped_partition_type_get_name(type);
     }
 
-    if (ret != NULL)
+    if (ret != NULL) {
         return PyUnicode_FromString(ret);
-    else
-        return PyUnicode_FromString("");
+    } else {
+        return (PyObject *) NULL;
+    }
 }
 
 PyObject *py_ped_partition_flag_get_name(PyObject *s, PyObject *args) {
@@ -1399,12 +1402,12 @@ PyObject *py_ped_partition_flag_get_name
     char *ret = NULL;
 
     if (!PyArg_ParseTuple(args, "i", &flag)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (flag < PED_PARTITION_FIRST_FLAG) {
         PyErr_SetString(PyExc_ValueError, "Invalid flag provided.");
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (flag) {
@@ -1413,7 +1416,7 @@ PyObject *py_ped_partition_flag_get_name
         if (!ret) {
             /* Re-raise the libparted exception. */
             partedExnRaised = 0;
-            return NULL;
+            return (PyObject *) NULL;
         }
     }
 
@@ -1424,7 +1427,7 @@ PyObject *py_ped_partition_flag_get_by_n
     char *name = NULL;
 
     if (!PyArg_ParseTuple(args, "s", &name)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     return PyLong_FromLong(ped_partition_flag_get_by_name(name));
@@ -1434,7 +1437,7 @@ PyObject *py_ped_partition_flag_next(PyO
     int flag;
 
     if (!PyArg_ParseTuple(args, "i", &flag)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     return Py_BuildValue("i", ped_partition_flag_next(flag));
@@ -1448,38 +1451,40 @@ PyObject *py_ped_disk_add_partition(PyOb
     PedConstraint *out_constraint = NULL;
     int ret = 0;
 
-    if (!PyArg_ParseTuple(args, "O!|O!",&_ped_Partition_Type_obj,
-                          &in_part, &_ped_Constraint_Type_obj, &in_constraint)) {
-        return NULL;
+    if (!PyArg_ParseTuple(args, "O!|O!",&_ped_Partition_Type_obj, &in_part, &_ped_Constraint_Type_obj, &in_constraint)) {
+        return (PyObject *) NULL;
     }
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     /* Its non-sense to add an owned partition */
     if (in_part->_owned == 1) {
         PyErr_SetString(PartitionException, "Attempting to add a partition "
                                             "that is already owned by a disk.");
-        return NULL;
+        return (PyObject *) NULL;
     }
 
 
     out_part = _ped_Partition2PedPartition(in_part);
+
     if (out_part == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (out_part->disk != disk) {
         PyErr_SetString(PartitionException, "Cannot add a partition to another disk then the one used for creating the partition");
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (in_constraint) {
         out_constraint = _ped_Constraint2PedConstraint(in_constraint);
+
         if (out_constraint == NULL) {
-            return NULL;
+            return (PyObject *) NULL;
         }
     }
 
@@ -1492,14 +1497,14 @@ PyObject *py_ped_disk_add_partition(PyOb
         if (partedExnRaised) {
             partedExnRaised = 0;
 
-            if (!PyErr_ExceptionMatches(PartedException) &&
-                !PyErr_ExceptionMatches(PyExc_NotImplementedError))
+            if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                 PyErr_SetString(PartitionException, partedExnMessage);
-        }
-        else
+            }
+        } else {
             PyErr_Format(PartitionException, "Could not create partition %s%d", out_part->disk->dev->path, out_part->num);
+        }
 
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     /* update our _ped.Partition object with out_part values */
@@ -1521,56 +1526,62 @@ PyObject *py_ped_disk_remove_partition(P
     int ret = 0;
 
     if (!PyArg_ParseTuple(args, "O!", &_ped_Partition_Type_obj, &in_part)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     /* Its non-sense  to remove an unowned partition */
     if (in_part->_owned == 0) {
         PyErr_SetString(PartitionException, "Attempting to remove a partition "
                                             "that is not owned by any disk.");
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     out_part = _ped_Partition2PedPartition(in_part);
+
     if (out_part == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (out_part->disk != disk) {
         PyErr_SetString(PartitionException, "Partition is not part of the disk it is being removed from");
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (out_part->part_list != NULL) {
         PedPartition *part;
+
         for (part = out_part->part_list; part; part = part->next) {
-            if (ped_partition_is_active(part))
+            if (ped_partition_is_active(part)) {
                 break;
+            }
         }
+
         if (part) {
             PyErr_SetString(PartitionException, "Attempting to remove an extended partition that still contains logical partitions");
-            return NULL;
+            return (PyObject *) NULL;
         }
     }
 
     ret = ped_disk_remove_partition(disk, out_part);
+
     if (ret == 0) {
         if (partedExnRaised) {
             partedExnRaised = 0;
 
-            if (!PyErr_ExceptionMatches(PartedException) &&
-                !PyErr_ExceptionMatches(PyExc_NotImplementedError))
+            if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                 PyErr_SetString(PartitionException, partedExnMessage);
-        }
-        else
+            }
+        } else {
             PyErr_Format(PartitionException, "Could not remove partition %s%d", out_part->disk->dev->path, out_part->num);
+        }
 
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     in_part->_owned = 0;
@@ -1591,25 +1602,24 @@ PyObject *py_ped_disk_delete_all(PyObjec
     int ret = 0;
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk) {
         ret = ped_disk_delete_all(disk);
+
         if (ret == 0) {
             if (partedExnRaised) {
                 partedExnRaised = 0;
 
-                if (!PyErr_ExceptionMatches(PartedException) &&
-                    !PyErr_ExceptionMatches(PyExc_NotImplementedError))
+                if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                     PyErr_SetString(PartitionException, partedExnMessage);
-            }
-            else
+                }
+            } else {
                 PyErr_Format(PartitionException, "Could not remove all partitions on %s", disk->dev->path);
+            }
 
-            return NULL;
+            return (PyObject *) NULL;
         }
     }
-    else {
-        return NULL;
-    }
 
     if (ret) {
         Py_RETURN_TRUE;
@@ -1627,57 +1637,58 @@ PyObject *py_ped_disk_set_partition_geom
     PedSector start, end;
     int ret = 0;
 
-    if (!PyArg_ParseTuple(args, "O!OLL", &_ped_Partition_Type_obj, &in_part,
-                          &in_constraint, &start, &end)) {
-        return NULL;
+    if (!PyArg_ParseTuple(args, "O!OLL", &_ped_Partition_Type_obj, &in_part, &in_constraint, &start, &end)) {
+        return (PyObject *) NULL;
     }
 
-    if (in_constraint != Py_None && !PyObject_IsInstance(in_constraint,
-                                      (PyObject *)&_ped_Constraint_Type_obj)) {
+    if (in_constraint != Py_None && !PyObject_IsInstance(in_constraint, (PyObject *)&_ped_Constraint_Type_obj)) {
         PyErr_SetString(PyExc_ValueError, "invalid constraint type");
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     out_part = _ped_Partition2PedPartition(in_part);
+
     if (out_part == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (out_part->disk != disk) {
         PyErr_SetString(PartitionException, "partition.disk does not match disk");
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (in_constraint != Py_None) {
         out_constraint = _ped_Constraint2PedConstraint(in_constraint);
+
         if (out_constraint == NULL) {
-            return NULL;
+            return (PyObject *) NULL;
         }
     }
 
-    ret = ped_disk_set_partition_geom(disk, out_part, out_constraint,
-                                      start, end);
+    ret = ped_disk_set_partition_geom(disk, out_part, out_constraint, start, end);
 
-    if (out_constraint)
+    if (out_constraint) {
         ped_constraint_destroy(out_constraint);
+    }
 
     if (ret == 0) {
         if (partedExnRaised) {
             partedExnRaised = 0;
 
-            if (!PyErr_ExceptionMatches(PartedException) &&
-                !PyErr_ExceptionMatches(PyExc_NotImplementedError))
+            if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                 PyErr_SetString(PartitionException, partedExnMessage);
-        }
-        else
+            }
+        } else {
             PyErr_Format(PartitionException, "Could not set geometry on %s%d", disk->dev->path, out_part->num);
+        }
 
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     *((_ped_Geometry *)in_part->geom)->ped_geometry = out_part->geom;
@@ -1697,50 +1708,53 @@ PyObject *py_ped_disk_maximize_partition
     PedConstraint *out_constraint = NULL;
     int ret = 0;
 
-    if (!PyArg_ParseTuple(args, "O!|O!", &_ped_Partition_Type_obj, &in_part,
-                          &_ped_Constraint_Type_obj, &in_constraint)) {
-        return NULL;
+    if (!PyArg_ParseTuple(args, "O!|O!", &_ped_Partition_Type_obj, &in_part, &_ped_Constraint_Type_obj, &in_constraint)) {
+        return (PyObject *) NULL;
     }
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     out_part = _ped_Partition2PedPartition(in_part);
+
     if (out_part == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (out_part->disk != disk) {
         PyErr_SetString(PartitionException, "partition.disk does not match disk");
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (in_constraint) {
         out_constraint = _ped_Constraint2PedConstraint(in_constraint);
+
         if (out_constraint == NULL) {
-            return NULL;
+            return (PyObject *) NULL;
         }
     }
 
     ret = ped_disk_maximize_partition(disk, out_part, out_constraint);
 
-    if (out_constraint)
+    if (out_constraint) {
         ped_constraint_destroy(out_constraint);
+    }
 
     if (ret == 0) {
         if (partedExnRaised) {
             partedExnRaised = 0;
 
-            if (!PyErr_ExceptionMatches(PartedException) &&
-                !PyErr_ExceptionMatches(PyExc_NotImplementedError))
+            if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                 PyErr_SetString(PartitionException, partedExnMessage);
-        }
-        else
+            }
+        } else {
             PyErr_Format(PartitionException, "Could not maximize partition size for %s%d", disk->dev->path, out_part->num);
+        }
 
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     *((_ped_Geometry *)in_part->geom)->ped_geometry = out_part->geom;
@@ -1761,55 +1775,59 @@ PyObject *py_ped_disk_get_max_partition_
     PedGeometry *pass_geom = NULL;
     _ped_Geometry *ret = NULL;
 
-    if (!PyArg_ParseTuple(args, "O!|O!", &_ped_Partition_Type_obj, &in_part,
-                          &_ped_Constraint_Type_obj, &in_constraint)) {
-        return NULL;
+    if (!PyArg_ParseTuple(args, "O!|O!", &_ped_Partition_Type_obj, &in_part, &_ped_Constraint_Type_obj, &in_constraint)) {
+        return (PyObject *) NULL;
     }
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     out_part = _ped_Partition2PedPartition(in_part);
+
     if (out_part == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (out_part->disk != disk) {
         PyErr_SetString(PartitionException, "partition.disk does not match disk");
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (in_constraint) {
         out_constraint = _ped_Constraint2PedConstraint(in_constraint);
+
         if (out_constraint == NULL) {
-            return NULL;
+            return (PyObject *) NULL;
         }
     }
 
     pass_geom = ped_disk_get_max_partition_geometry(disk, out_part,
                                                     out_constraint);
-    if (out_constraint)
+    if (out_constraint) {
         ped_constraint_destroy(out_constraint);
+    }
 
     if (pass_geom == NULL) {
         if (partedExnRaised) {
             partedExnRaised = 0;
 
-            if (!PyErr_ExceptionMatches(PartedException) &&
-                !PyErr_ExceptionMatches(PyExc_NotImplementedError))
+            if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                 PyErr_SetString(PartitionException, partedExnMessage);
-        }
-        else
+            }
+        } else {
             PyErr_Format(PartitionException, "Could not get maximum partition size for %s%d", disk->dev->path, out_part->num);
+        }
 
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     ret = PedGeometry2_ped_Geometry(pass_geom);
+
     if (ret == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     return (PyObject *) ret;
@@ -1820,25 +1838,24 @@ PyObject *py_ped_disk_minimize_extended_
     int ret = 0;
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk) {
         ret = ped_disk_minimize_extended_partition(disk);
+
         if (ret == 0) {
             if (partedExnRaised) {
                 partedExnRaised = 0;
 
-                if (!PyErr_ExceptionMatches(PartedException) &&
-                    !PyErr_ExceptionMatches(PyExc_NotImplementedError))
+                if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                     PyErr_SetString(PartitionException, partedExnMessage);
-            }
-            else
+                }
+            } else {
                 PyErr_Format(PartitionException, "Could not shrink extended partition on %s", disk->dev->path);
+            }
 
-            return NULL;
+            return (PyObject *) NULL;
         }
     }
-    else {
-        return NULL;
-    }
 
     if (ret) {
         Py_RETURN_TRUE;
@@ -1855,38 +1872,41 @@ PyObject *py_ped_disk_next_partition(PyO
     _ped_Partition *ret = NULL;
 
     if (!PyArg_ParseTuple(args, "|O!", &_ped_Partition_Type_obj, &in_part)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if (in_part) {
         out_part = _ped_Partition2PedPartition(in_part);
+
         if (out_part == NULL) {
-            return NULL;
+            return (PyObject *) NULL;
         }
 
         if (out_part->disk != disk) {
             PyErr_SetString(PartitionException, "partition.disk does not match disk");
-            return NULL;
+            return (PyObject *) NULL;
         }
     }
 
     pass_part = ped_disk_next_partition(disk, out_part);
+
     if (pass_part == NULL) {
         Py_INCREF(Py_None);
         return Py_None;
     }
 
     ret = PedPartition2_ped_Partition(pass_part, (_ped_Disk *)s);
-    if (ret == NULL) {
-        return NULL;
+
+    if (ret != NULL) {
+        ret->_owned = 1;
     }
 
-    ret->_owned = 1;
     return (PyObject *) ret;
 }
 
@@ -1897,27 +1917,28 @@ PyObject *py_ped_disk_get_partition(PyOb
     _ped_Partition *ret = NULL;
 
     if (!PyArg_ParseTuple(args, "i", &num)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk) {
         pass_part = ped_disk_get_partition(disk, num);
+
         if (pass_part == NULL) {
             PyErr_SetString(PartitionException, "Partition does not exist");
-            return NULL;
+            return (PyObject *) NULL;
         }
 
         ret = PedPartition2_ped_Partition(pass_part, (_ped_Disk *)s);
+
         if (ret == NULL) {
-            return NULL;
+            return (PyObject *) NULL;
         }
-    }
-    else {
-        return NULL;
+
+        ret->_owned = 1;
     }
 
-    ret->_owned = 1;
     return (PyObject *) ret;
 }
 
@@ -1928,23 +1949,26 @@ PyObject *py_ped_disk_get_partition_by_s
     _ped_Partition *ret = NULL;
 
     if (!PyArg_ParseTuple(args, "L", &sector)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     pass_part = ped_disk_get_partition_by_sector(disk, sector);
+
     if (pass_part == NULL) {
         PyErr_SetString(PartitionException, "Partition does not exist");
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     ret = PedPartition2_ped_Partition(pass_part, (_ped_Disk *)s);
+
     if (ret == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     ret->_owned = 1;
@@ -1957,23 +1981,24 @@ PyObject *py_ped_disk_extended_partition
     _ped_Partition *ret = NULL;
 
     disk = _ped_Disk2PedDisk(s);
+
     if (disk) {
         pass_part = ped_disk_extended_partition(disk);
+
         if (pass_part == NULL) {
             PyErr_SetString(PartitionException, "Extended partition does not exist");
-            return NULL;
+            return (PyObject *) NULL;
         }
 
         ret = PedPartition2_ped_Partition(pass_part, (_ped_Disk *)s);
+
         if (ret == NULL) {
-            return NULL;
+            return (PyObject *) NULL;
         }
-    }
-    else {
-        return NULL;
+
+        ret->_owned = 1;
     }
 
-    ret->_owned = 1;
     return (PyObject *) ret;
 }
 
@@ -1985,26 +2010,25 @@ PyObject *py_ped_disk_new_fresh(PyObject
     PedDisk *disk = NULL;
     _ped_Disk *ret = NULL;
 
-    if (!PyArg_ParseTuple(args, "O!O!", &_ped_Device_Type_obj, &in_device,
-                                        &_ped_DiskType_Type_obj, &in_type)) {
-        return NULL;
+    if (!PyArg_ParseTuple(args, "O!O!", &_ped_Device_Type_obj, &in_device, &_ped_DiskType_Type_obj, &in_type)) {
+        return (PyObject *) NULL;
     }
 
     if ((device = _ped_Device2PedDevice((PyObject *) in_device)) == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if ((type = _ped_DiskType2PedDiskType((PyObject *) in_type)) == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if ((disk = ped_disk_new_fresh(device, type)) == NULL) {
         if (partedExnRaised) {
             partedExnRaised = 0;
 
-            if (!PyErr_ExceptionMatches(PartedException) &&
-                !PyErr_ExceptionMatches(PyExc_NotImplementedError))
+            if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                 PyErr_SetString(DiskException, partedExnMessage);
+            }
         } else {
             if (disk->dev == NULL) {
                 PyErr_Format(DiskException, "Could not create new disk label");
@@ -2013,7 +2037,7 @@ PyObject *py_ped_disk_new_fresh(PyObject
             }
         }
 
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     ret = PedDisk2_ped_Disk(disk);
@@ -2027,20 +2051,20 @@ PyObject *py_ped_disk_new(PyObject *s, P
     _ped_Disk *ret = NULL;
 
     if (!PyArg_ParseTuple(args, "O!", &_ped_Device_Type_obj, &in_device)) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if ((device = _ped_Device2PedDevice((PyObject *) in_device)) == NULL) {
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     if ((disk = ped_disk_new(device)) == NULL) {
         if (partedExnRaised) {
             partedExnRaised = 0;
 
-            if (!PyErr_ExceptionMatches(PartedException) &&
-                !PyErr_ExceptionMatches(PyExc_NotImplementedError))
+            if (!PyErr_ExceptionMatches(PartedException) && !PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
                 PyErr_SetString(DiskException, partedExnMessage);
+            }
         } else {
             if (disk->dev == NULL) {
                 PyErr_Format(DiskException, "Could not create new disk label");
@@ -2049,7 +2073,7 @@ PyObject *py_ped_disk_new(PyObject *s, P
             }
         }
 
-        return NULL;
+        return (PyObject *) NULL;
     }
 
     ret = PedDisk2_ped_Disk(disk);
diff -up pyparted-3.11.7/src/pytimer.c.orig pyparted-3.11.7/src/pytimer.c
--- pyparted-3.11.7/src/pytimer.c.orig	2019-04-23 14:24:26.657517400 -0400
+++ pyparted-3.11.7/src/pytimer.c	2021-07-09 15:09:17.827164706 -0400
@@ -104,33 +104,9 @@ int _ped_Timer_clear(_ped_Timer *self) {
 }
 
 int _ped_Timer_init(_ped_Timer *self, PyObject *args, PyObject *kwds) {
-    static char *kwlist[] = {"frac", "start", "now", "predicted_end",
-                             "state_name", NULL};
-
-    self->state_name = NULL;
-
     /* XXX: timers aren't really done yet in pyparted */
     PyErr_SetString(PyExc_NotImplementedError, NULL);
     return -1;
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "|fdddz", kwlist,
-                                     &self->frac, &self->start, &self->now,
-                                     &self->predicted_end, &self->state_name)) {
-        return -1;
-    }
-
-     /* self->state_name now points to the internal buffer of a PyUnicode object,
-      * which may be freed when its refcount drops to zero, so strdup it.
-      */
-     if (self->state_name) {
-         self->state_name = strdup(self->state_name);
-         if (!self->state_name) {
-             PyErr_NoMemory();
-             return -3;
-         }
-     }
-
-    return 0;
 }
 
 PyObject *_ped_Timer_get(_ped_Timer *self, void *closure) {