[issue6569] unittest document bug (random.shuffle sequence)

2009-07-24 Thread Kouki Hashimoto

New submission from Kouki Hashimoto :

Hello.
I found a bug in unittest sample code.
http://docs.python.org/dev/py3k/library/unittest.html#unittest-minimal-example
(naming this code as test_sample.py)

I got this error.
$ python3.2 test_sample.py
..E
==
ERROR: test_shuffle (__main__.TestSequenceFunctions)
--
Traceback (most recent call last):
  File "test_sample.py", line 11, in test_shuffle
random.shuffle(self.seq)
  File
"/opt/local/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/random.py",
line 270, in shuffle
x[i], x[j] = x[j], x[i]
TypeError: 'range' object does not support item assignment

--
Ran 3 tests in 0.004s

I think this code should be fixed with attached patch.
Regards.

--
assignee: georg.brandl
components: Documentation
files: unittest.rst.patch
keywords: patch
messages: 90907
nosy: georg.brandl, hsmtkk
severity: normal
status: open
title: unittest document bug (random.shuffle sequence)
versions: Python 3.2
Added file: http://bugs.python.org/file14563/unittest.rst.patch

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



[issue7285] multiprocessing module, example code error

2009-11-07 Thread Kouki Hashimoto

New submission from Kouki Hashimoto :

Example codes on multiprocessing module occur errors.
I attached the patch to fix these errors.

http://docs.python.org/dev/py3k/library/multiprocessing.html#module-
multiprocessing
"16.6.2.10. Listeners and Clients" section

Fix points are
1. Listener argument "authkey" must be a byte string
2. Client argument "authkey" must be a byte string
3. send_bytes argument must be a byte string

This is the server code listed on the section.
$ cat mpserver.py
from multiprocessing.connection import Listener
from array import array
address = ('localhost', 6000) # family is deduced to be 'AF_INET'
listener = Listener(address, authkey='secret password')
conn = listener.accept()
print('connection accepted from', listener.last_accepted)
conn.send([2.25, None, 'junk', float])
conn.send_bytes('hello')
conn.send_bytes(array('i', [42, 1729]))
conn.close()
listener.close()

And the error is
$ python3.2 mpserver.py
Traceback (most recent call last):
  File "mpserver1.py", line 5, in 
listener = Listener(address, authkey='secret password')
  File 
"/Users/kosmos/local/stow/py3k/lib/python3.2/multiprocessing/connection.
py", line 100, in __init__
raise TypeError('authkey should be a byte string')
TypeError: authkey should be a byte string

My source code is svn revision 76151.
Regards.

---
Kouki Hashimoto
hsm...@gmail.com

--
assignee: georg.brandl
components: Documentation
files: multiprocessing.rst.diff
keywords: patch
messages: 95035
nosy: georg.brandl, hsmtkk
severity: normal
status: open
title: multiprocessing module, example code error
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file15288/multiprocessing.rst.diff

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



[issue5478] document mistake xml.dom.minidom.Element

2009-03-11 Thread Kouki Hashimoto

New submission from Kouki Hashimoto :

I found mistake in python documentation about xml.dom.minidom.Element 
class.
http://docs.python.org/dev/py3k/library/xml.dom.html#module-xml.dom

I think it is NOT
Element.getElementsByTagNameNS(tagName)
It SHOULD be
Element.getElementsByTagNameNS(namespaceURI, tagName)

--
assignee: georg.brandl
components: Documentation
messages: 83482
nosy: georg.brandl, hsmtkk
severity: normal
status: open
title: document mistake xml.dom.minidom.Element
versions: Python 3.1

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