[issue13595] Weird behavior with generators with self-referencing output.

2011-12-13 Thread Pyry Pakkanen

New submission from Pyry Pakkanen frostb...@suomi24.fi:

The following self-referencing generator has incorrect output:

def ab_combinations():
#'', 'a', 'b', 'aa', 'ab', 'ba', 'bb', 'aaa', ...
def _deferred_output():
yield 
tees = tee(output)

#This definition works fine: '', 'a', 'b', 'aa', 'ab', 'ba', ...
l = [(item+a for item in tees[0]), (item+b for item in tees[1])]

#This definition results in: '', 'b', 'b', 'bb', 'bb', 'bb', ...
#l = [(item+label for item in t) for t, label in zip(tees,ab)]

while True:
for g in l:
yield next(g)

result, output = tee(_deferred_output())
return result

--
messages: 149403
nosy: PyryP
priority: normal
severity: normal
status: open
title: Weird behavior with generators with self-referencing output.
type: behavior
versions: Python 2.7, Python 3.2

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



[issue13595] Weird behavior with generators with self-referencing output.

2011-12-13 Thread Pyry Pakkanen

Pyry Pakkanen frostb...@suomi24.fi added the comment:

Oh, I was sure it had to do with binding issues. I just couldn't put my finger 
on it because the behavior seemed so counterintuitive.
Thanks for clearing things up. I can now work around this feature.

--

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



[issue13454] crash when deleting one pair from tee()

2011-11-22 Thread Pyry Pakkanen

New submission from Pyry Pakkanen frostb...@suomi24.fi:

Running the following results in a Segmentation fault on Ubuntu 11.10 64-bit 
with both python and python3.

from itertools import *
c = count()
a,b = tee(c)
for i in range(1000):
 next(a)
del(b)

--
messages: 148124
nosy: PyryP
priority: normal
severity: normal
status: open
title: crash when deleting one pair from tee()
type: crash
versions: Python 2.7, Python 3.2

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



[issue3753] bytearray incompatible with bytes

2008-09-01 Thread Pyry Pakkanen

New submission from Pyry Pakkanen [EMAIL PROTECTED]:

I was expecting that the API function PyArg_ParseTuple(args, y#:foo,
cp, size) would accept a bytearray and implicitly convert it to bytes.
Currently it throws the error:
TypeError: foo() argument 1 must be bytes or read-only buffer, not bytearray

--
messages: 72266
nosy: Frostburn
severity: normal
status: open
title: bytearray incompatible with bytes
type: behavior
versions: Python 3.0

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3753
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com