Skip to content

Commit

Permalink
Use positional-only parameters for the __new__
Browse files Browse the repository at this point in the history
  • Loading branch information
pablogsal committed Nov 27, 2018
1 parent 7d2dd84 commit e5bca1d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Lib/collections/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def __getnewargs__(self):
doc = f'Alias for field number {index}'
cache[index] = doc

tuplegetter_object = _tuplegetter(index, doc=doc)
tuplegetter_object = _tuplegetter(index, doc)
class_namespace[name] = tuplegetter_object

result = type(typename, (tuple,), class_namespace)
Expand Down
9 changes: 5 additions & 4 deletions Modules/_collectionsmodule.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "Python.h"
#include "structmember.h"
#include "clinic/_collectionsmodule.c.h"

#ifdef STDC_HEADERS
#include <stddef.h>
Expand All @@ -13,6 +12,9 @@ class _tuplegetter "_tuplegetterobject *" "&tuplegetter_type"
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=ee5ed5baabe35068]*/

static PyTypeObject tuplegetter_type;
#include "clinic/_collectionsmodule.c.h"

/* collections module implementation of a deque() datatype
Written and maintained by Raymond D. Hettinger <[email protected]>
*/
Expand Down Expand Up @@ -2348,12 +2350,12 @@ _tuplegetter.__new__ as tuplegetter_new
index: Py_ssize_t
doc: object
/
[clinic start generated code]*/

static PyObject *
tuplegetter_new_impl(PyTypeObject *type, Py_ssize_t index, PyObject *doc)
/*[clinic end generated code: output=014be444ad80263f input=bed3e2ac189db22a]*/
/*[clinic end generated code: output=014be444ad80263f input=87c576a5bdbc0bbb]*/
{
_tuplegetterobject* self;
self = (_tuplegetterobject *)type->tp_alloc(type, 0);
Expand Down Expand Up @@ -2387,7 +2389,6 @@ tuplegetterdescr_get(PyObject *self, PyObject *obj, PyObject *type)
return result;
}


static int
tuplegetter_traverse(PyObject *self, visitproc visit, void *arg)
{
Expand Down
10 changes: 6 additions & 4 deletions Modules/clinic/_collectionsmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e5bca1d

Please sign in to comment.