diff options
author | Jose M. Guisado Gomez <guigom@riseup.net> | 2022-04-26 17:08:49 +0200 |
---|---|---|
committer | Jose M. Guisado Gomez <guigom@riseup.net> | 2022-04-26 17:08:49 +0200 |
commit | b905c1996fa2b894631949dffb60b03a9c7c3412 (patch) | |
tree | ee1f3a7687edcd59881cdea45cc9393c094dea77 | |
parent | ef613790e9f6ecc52455b70d1c711266b9e3c96f (diff) |
fdisk.c: add partition module object
Call Partition_AddModuleObject when initializing the python module.
Fixes bug when using the Partition class but the class has not
been added to the module via Py_TypeReady.
A common error was the type not being ready (missing attributes):
>>> for pa in cxt.parts:
... print(pa.partno)
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
AttributeError: 'libfdisk.Partition' object has no attribute 'partno'
-rw-r--r-- | fdisk.c | 1 | ||||
-rw-r--r-- | fdisk.h | 1 |
2 files changed, 2 insertions, 0 deletions
@@ -65,6 +65,7 @@ PyInit_fdisk(void) Context_AddModuleObject(m); Label_AddModuleObject(m); + Partition_AddModuleObject(m); return m; @@ -44,6 +44,7 @@ extern PyTypeObject PartitionType; extern void Context_AddModuleObject(PyObject *mod); extern void Label_AddModuleObject(PyObject *mod); +extern void Partition_AddModuleObject(PyObject *mod); extern PyObject *PyObjectResultStr(const char *s); extern PyObject *PyObjectResultLabel(struct fdisk_label *lb); |