Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Revert cosmetic changes.
  • Loading branch information
serhiy-storchaka committed Apr 19, 2017
commit 3e83c4a60ec27a0484d86003c9535f1b8bbcdb90
2 changes: 1 addition & 1 deletion Modules/_ctypes/_ctypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -5139,7 +5139,7 @@ comerror_init(PyObject *self, PyObject *args, PyObject *kwds)
if (!PyArg_ParseTuple(args, "OOO:COMError", &hresult, &text, &details))
return -1;

a = PySequence_GetSlice(args, 1, PyTuple_GET_SIZE(args));
a = PySequence_GetSlice(args, 1, PySequence_Size(args));
if (!a)
return -1;
status = PyObject_SetAttrString(self, "args", a);
Expand Down
3 changes: 1 addition & 2 deletions Modules/itertoolsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -4333,7 +4333,7 @@ zip_longest_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
PyObject *ittuple; /* tuple of iterators */
PyObject *result;
PyObject *fillvalue = Py_None;
Py_ssize_t tuplesize;
Py_ssize_t tuplesize = PySequence_Length(args);

if (kwds != NULL && PyDict_CheckExact(kwds) && PyDict_Size(kwds) > 0) {
fillvalue = PyDict_GetItemString(kwds, "fillvalue");
Expand All @@ -4346,7 +4346,6 @@ zip_longest_new(PyTypeObject *type, PyObject *args, PyObject *kwds)

/* args must be a tuple */
assert(PyTuple_Check(args));
tuplesize = PyTuple_GET_SIZE(args);

/* obtain iterators */
ittuple = PyTuple_New(tuplesize);
Expand Down
4 changes: 2 additions & 2 deletions Modules/selectmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2022,8 +2022,8 @@ newKqueue_Object(PyTypeObject *type, SOCKET fd)
static PyObject *
kqueue_queue_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
if (PyTuple_GET_SIZE(args) ||
(kwds != NULL && PyDict_Size(kwds))) {
if ((args != NULL && PyObject_Size(args)) ||
(kwds != NULL && PyObject_Size(kwds))) {
PyErr_SetString(PyExc_ValueError,
"select.kqueue doesn't accept arguments");
return NULL;
Expand Down
2 changes: 1 addition & 1 deletion Objects/exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -2809,7 +2809,7 @@ _PyErr_TrySetFromCause(const char *format, ...)
/* Ensure the instance dict is also empty */
dictptr = _PyObject_GetDictPtr(val);
if (dictptr != NULL && *dictptr != NULL &&
PyDict_Size(*dictptr) != 0) {
PyObject_Length(*dictptr) > 0) {
/* While we could potentially copy a non-empty instance dictionary
* to the replacement exception, for now we take the more
* conservative path of leaving exceptions with attributes set
Expand Down
12 changes: 9 additions & 3 deletions Objects/namespaceobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,15 @@ namespace_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
static int
namespace_init(_PyNamespaceObject *ns, PyObject *args, PyObject *kwds)
{
if (PyTuple_GET_SIZE(args) != 0) {
PyErr_Format(PyExc_TypeError, "no positional arguments expected");
return -1;
// ignore args if it's NULL or empty
if (args != NULL) {
Py_ssize_t argcount = PyObject_Size(args);
if (argcount < 0)
return -1;
else if (argcount > 0) {
PyErr_Format(PyExc_TypeError, "no positional arguments expected");
return -1;
}
}
if (kwds == NULL)
return 0;
Expand Down
3 changes: 1 addition & 2 deletions Python/bltinmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2447,14 +2447,13 @@ zip_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
Py_ssize_t i;
PyObject *ittuple; /* tuple of iterators */
PyObject *result;
Py_ssize_t tuplesize;
Py_ssize_t tuplesize = PySequence_Length(args);

if (type == &PyZip_Type && !_PyArg_NoKeywords("zip()", kwds))
return NULL;

/* args must be a tuple */
assert(PyTuple_Check(args));
tuplesize = PyTuple_GET_SIZE(args);

/* obtain iterators */
ittuple = PyTuple_New(tuplesize);
Expand Down