Skip to content

Commit 94e841b

Browse files
committed
Remove useless constructors
The Reference, Branch, ConfigIter and Walker types were allowed to be created by the user, but no constructor was set, and the default values are either meaningless (in the case of Reference/Branch) or would cause a segfault as soon as one tried to use them (ConfigIter and Walker). Remove the constructor from these types, as they don't serve a purpose and can only be used by mistake.
1 parent 3026798 commit 94e841b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/pygit2.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ moduleinit(PyObject* m)
312312
/*
313313
* Log
314314
*/
315-
INIT_TYPE(WalkerType, NULL, PyType_GenericNew)
315+
INIT_TYPE(WalkerType, NULL, NULL)
316316
ADD_TYPE(m, Walker);
317317
ADD_CONSTANT_INT(m, GIT_SORT_NONE)
318318
ADD_CONSTANT_INT(m, GIT_SORT_TOPOLOGICAL)
@@ -329,7 +329,7 @@ moduleinit(PyObject* m)
329329
/*
330330
* References
331331
*/
332-
INIT_TYPE(ReferenceType, NULL, PyType_GenericNew)
332+
INIT_TYPE(ReferenceType, NULL, NULL)
333333
INIT_TYPE(RefLogEntryType, NULL, NULL)
334334
INIT_TYPE(RefLogIterType, NULL, NULL)
335335
INIT_TYPE(NoteType, NULL, NULL)
@@ -345,7 +345,7 @@ moduleinit(PyObject* m)
345345
/*
346346
* Branches
347347
*/
348-
INIT_TYPE(BranchType, &ReferenceType, PyType_GenericNew);
348+
INIT_TYPE(BranchType, &ReferenceType, NULL);
349349
ADD_TYPE(m, Branch)
350350
ADD_CONSTANT_INT(m, GIT_BRANCH_LOCAL)
351351
ADD_CONSTANT_INT(m, GIT_BRANCH_REMOTE)
@@ -425,7 +425,7 @@ moduleinit(PyObject* m)
425425

426426
/* Config */
427427
INIT_TYPE(ConfigType, NULL, PyType_GenericNew)
428-
INIT_TYPE(ConfigIterType, NULL, PyType_GenericNew)
428+
INIT_TYPE(ConfigIterType, NULL, NULL)
429429
ADD_TYPE(m, Config)
430430
ADD_TYPE(m, ConfigIter)
431431

0 commit comments

Comments
 (0)