[issue43683] Handle generator (and coroutine) state in the bytecode.

2021-10-27 Thread Damien George


Damien George  added the comment:

Thanks for confirming the bug.

Sending non-None to a not-started generator could arguably be case (2), because 
that's exactly the semantics introduced by the commit that broke the test case 
:)

Honestly I don't have a strong opinion on which way this goes.  But I think it 
would be interesting to know if there was code out there that relied on the 
original behaviour.

--

___
Python tracker 
<https://bugs.python.org/issue43683>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43683] Handle generator (and coroutine) state in the bytecode.

2021-10-20 Thread Damien George


Damien George  added the comment:

It looks like this change introduced a subtle, and maybe intended (?), 
behavioural change.

Consider (from MicroPython's test suite):

def f():
n = 0 
while True:
n = yield n + 1 
print(n)

g = f()
try:
g.send(1)
except TypeError:
print("caught")

print(g.send(None))
print(g.send(100))
print(g.send(200))

This used to work prior to commit b37181e69209746adc2119c471599a1ea5faa6c8.  
But after that commit it fails on the print(g.send(None)) because the generator 
is now stopped.

--
nosy: +dpgeorge

___
Python tracker 
<https://bugs.python.org/issue43683>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue30707] Incorrect description of "async with" in PEP492 and documentation

2017-06-19 Thread Damien George

New submission from Damien George:

The behaviour of the "async with" statement in CPython does not match the 
description of it in PEP492, nor the language documentation.  The 
implementation uses a try/except/finally block, while the PEP and documentation 
describe the behaviour using a try/except/else block.  The PEP and 
documentation should be updated to reflect the true intention of "async with".

--

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



[issue30707] Incorrect description of "async with" in PEP492 and documentation

2017-06-19 Thread Damien George

Changes by Damien George <damien.p.geo...@gmail.com>:


--
assignee: docs@python
components: Documentation
nosy: Damien George, docs@python
priority: normal
severity: normal
status: open
title: Incorrect description of "async with" in PEP492 and documentation
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7

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



[issue27039] bytearray.remove cannot remove bytes with value greater than 127

2016-05-16 Thread Damien George

New submission from Damien George:

The following code fails with a ValueError (but I expect it to succeed):

>>> bytearray([128]).remove(128)

Tested with Python 2.7.11 and 3.5.1.  Probably it's a case of comparing a char 
(signed byte) with an unsigned value.

--
components: Interpreter Core
messages: 265709
nosy: Damien George
priority: normal
severity: normal
status: open
title: bytearray.remove cannot remove bytes with value greater than 127
type: behavior
versions: Python 2.7, Python 3.5

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