Closed szhorvat closed 4 months ago
PyArg_ParseTupleAndKeywords(args, kwds, "|nO", kwlist, &n, &mode_o)
-- this function parses n
as a Python integer int
and saves it in a Py_ssize_t
, that's why you cannot simply pass None
for n
right now (see here for more details). If you wanted to support None
, you would need to change the format string to |OO
, parse n
into a PyObject*
first, check whether it's None
(with == Py_None
) and if not, try to cast it into a Py_ssize_t
with PyNumber_AsSsize_t
(see here ).
What I want is that the effective default be 1000*ecount
. What is the best way to do this? Should the formal default be None
, which is then interpreted this way? If yes, I now understand how to do that and can update this PR. Let me know.
Yes, that's the way to go, that's how I would do it in pure Python as well.
@ntamas Have another look, I used igraphmodule_PyObject_to_integer_t()
instead of PyNumber_AsSsize_t
. Is this okay?
Closes #775
@ntamas, can you help with this? What should I specify as the default for
n
? I'm pretty sure that the way I wroten=None
is not correct.