Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions atom/src/sortedmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,12 @@ SortedMap_contains( SortedMap* self, PyObject* key )


PyObject*
SortedMap_get( SortedMap* self, PyObject* args )
SortedMap_get( SortedMap* self, PyObject*const *args, Py_ssize_t nargs )
{
Py_ssize_t nargs = PyTuple_GET_SIZE( args );
if( nargs == 1 )
return self->getitem( PyTuple_GET_ITEM( args, 0 ), Py_None );
return self->getitem( args[0], Py_None );
if( nargs == 2 )
return self->getitem( PyTuple_GET_ITEM( args, 0 ), PyTuple_GET_ITEM( args, 1 ) );
return self->getitem( args[0], args[1] );
std::ostringstream ostr;
if( nargs > 2 )
ostr << "get() expected at most 2 arguments, got " << nargs;
Expand All @@ -418,13 +417,12 @@ SortedMap_get( SortedMap* self, PyObject* args )


PyObject*
SortedMap_pop( SortedMap* self, PyObject* args )
SortedMap_pop( SortedMap* self, PyObject*const *args, Py_ssize_t nargs )
{
Py_ssize_t nargs = PyTuple_GET_SIZE( args );
if( nargs == 1 )
return self->pop( PyTuple_GET_ITEM( args, 0 ) );
return self->pop( args[0] );
if( nargs == 2 )
return self->getitem( PyTuple_GET_ITEM( args, 0 ), PyTuple_GET_ITEM( args, 1 ) );
return self->getitem( args[0], args[1] );
std::ostringstream ostr;
if( nargs > 2 )
ostr << "pop() expected at most 2 arguments, got " << nargs;
Expand Down Expand Up @@ -541,9 +539,9 @@ SortedMap_sizeof( SortedMap* self, PyObject* args )

static PyMethodDef
SortedMap_methods[] = {
{ "get", ( PyCFunction )SortedMap_get, METH_VARARGS,
{ "get", ( PyCFunction )SortedMap_get, METH_FASTCALL,
"" },
{ "pop", ( PyCFunction )SortedMap_pop, METH_VARARGS,
{ "pop", ( PyCFunction )SortedMap_pop, METH_FASTCALL,
"" },
{ "clear", ( PyCFunction)SortedMap_clearmethod, METH_NOARGS,
"" },
Expand Down
Loading