New submission from Martijn Pieters:

I'm not sure where exactly the error lies, but issue 27128 broke iter() for 
Argument Clinic class methods. The following works in Python 3.5, but not in 
Python 3.6:

from datetime import datetime
from asyncio import Task

next(iter(datetime.now, None))
next(iter(Task.all_tasks, None))

In 3.6 StopIteration is raised:

>>> next(iter(datetime.now, None))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
StopIteration
>>> next(iter(Task.all_tasks, None))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
StopIteration

(In 3.5 a `datetime.datetime` and `set` object are produced, respectively)

The only thing these two methods have in common is that they are class methods 
with no arguments, parsed out by the Argument Clinic generated code (so using 
_PyArg_Parser).

What appears to have changed is that iter() was switched from using 
PyObject_Call to _PyObject_FastCall, see 
https://github.com/python/cpython/commit/99ee9c70a73ec2f3db68785821a9f2867c3f637f

----------
messages: 294835
nosy: mjpieters
priority: normal
severity: normal
status: open
title: iter(classmethod, sentinel) broken for Argument Clinic class methods?
versions: Python 3.6, Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30524>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to