[issue8603] Create a bytes version of os.environ and getenvb()

2010-05-04 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

Martin v. Löwis wrote:
 
 Martin v. Löwis mar...@v.loewis.de added the comment:
 
 Your name will end up being partially escaped as surrogate:

 'L\udcf6wis'

 Further processing will fail
 
 That depends on the further processing, no?
 
 Traceback (most recent call last):
   File stdin, line 1, in module
 UnicodeEncodeError: 'latin-1' codec can't encode character '\udcf6' in 
 position 1: ordinal not in
 range(256)
 
 Where did you get this error from?

The roundup email interface must have eaten this
first line of the traceback:  _.encode('latin-1')

 It doesn't work if an application tries to work *with* the data,
 e.g. tries to convert it
 
 Converting it to what?
 
 parse it
 
 Parsing will work fine.
 
 decode it
 
 It's a string. You shouldn't decode it.

 The reason is
 that information included by the use of the 'surrogateescape'
 error handler is lost along the way and this then causes data
 corruption.
 
 And how would that not happen if it was bytes? The problems you describe
 were one of the primary motivations to switch to Unicode: it's *byte*
 strings that have these problems.

Martin, it's obvious that you are not even trying to understand
what I'm saying. That's not a good basis for discussion.

--

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



[issue8608] fix_import prefixes . to already relative imports

2010-05-04 Thread Torsten Marek

New submission from Torsten Marek shlo...@gmx.net:

The fixer for absolute - relative imports prefixes . to already relative 
imports, i.e. 

from . import something

will be converted into 

from .. import something

if something.py exists. This of course will raise an exception on import or 
introduce subtle bugs if something exists in ..

I've attached a patch against 2to3 head which addresses this problem.

--
components: 2to3 (2.x to 3.0 conversion tool)
files: fix-no-prefix-relative-import.diff
keywords: patch
messages: 104914
nosy: shlomme
priority: normal
severity: normal
status: open
title: fix_import prefixes . to already relative imports
type: behavior
Added file: http://bugs.python.org/file17196/fix-no-prefix-relative-import.diff

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



[issue8608] fix_import prefixes . to already relative imports

2010-05-04 Thread Torsten Marek

Torsten Marek shlo...@gmx.net added the comment:

This file contains the same patch, but as a mercurial revision bundle.

--

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



[issue8608] fix_import prefixes . to already relative imports

2010-05-04 Thread Torsten Marek

Torsten Marek shlo...@gmx.net added the comment:

Forgot the file name last time.

--
Added file: 
http://bugs.python.org/file17197/fix-no-prefix-relative-import.bundle

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



[issue8609] itertools: problem with nested groupby, list()

2010-05-04 Thread Nico

New submission from Nico nico.schloe...@gmail.com:

Hi,

I ran into a bit of an unexpected issue here with itertools.

I need to say that I discovered itertools only recently, and that maybe my way 
of approaching the problem is not what I want to do. If you think this may be 
the case, please let me know.

Anyway, the problem is the following:
I have a list of dictionaries, something like

[ { a: 1, b: 1, c: 3 },
  { a: 1, b: 1, c: 4 },
  ...
]

and I'd like to iterate through all items with, e.g., a:1. What I do is sort 
and then groupby,

my_list.sort( key=operator.itemgetter('a') )
my_list_grouped = itertools.groupby( my_list, operator.itemgetter('a') )

and then just very simply iterate over my_list_grouped,

for my_item in my_list_grouped:
# do something with my_item[0], my_item[1]

Now, inside this loop I'd like to again iterate over all items with the same 
'b'-value -- no problem, just do the above inside the loop:

for my_item in my_list_grouped:
# group by keyword b
my_list2 = list( my_item[1] )
my_list2.sort( key=operator.itemgetter('b') )
my_list_grouped = itertools.groupby( my_list2, operator.itemgetter('b') 
)
for e in my_list_grouped:
# do something with e[0], e[1]

That seems to work all right.

Now, the problem occurs when this all is wrapped into an outer loop, such as

for k in [ 'first pass', 'second pass' ]:
for my_item in my_list_grouped:
# bla, the above

To be able to iterate more than once through my_list_grouped, I have to convert 
it into a list first, so outside all loops, I go like

my_list.sort( key=operator.itemgetter('a') )
my_list_grouped = itertools.groupby( my_list, operator.itemgetter('a') )
my_list_grouped = list( my_list_grouped )

This, however, makes it impossible to do the inner sort and groupby-operation; 
you just get the very first element, and that's it.

An example file is attached.

Is there anything that I can do to debug?

Cheers,
Nico

--
components: None
files: iterator-test.py
messages: 104917
nosy: nicki
priority: normal
severity: normal
status: open
title: itertools: problem with nested groupby, list()
versions: Python 2.6
Added file: http://bugs.python.org/file17198/iterator-test.py

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



[issue8609] itertools: problem with nested groupby, list()

2010-05-04 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

You'd be better off asking this on the python mailing list 
http://mail.python.org/mailman/listinfo/python-list (or in some other forum);  
this tracker is for reporting bugs in Python itself, not bugs in code written 
in Python.

[The problem you're encountering here is that you can only iterate over the 
return of itertools.groupby once.  That's by design, though:  it's not a Python 
bug.]

--
nosy: +mark.dickinson
resolution:  - invalid
status: open - closed

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



[issue8609] itertools: problem with nested groupby, list()

2010-05-04 Thread Nico

Nico nico.schloe...@gmail.com added the comment:

Okay, thanks for the hint.
Closing as invalid.

--

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



[issue8603] Create a bytes version of os.environ and getenvb()

2010-05-04 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

New version of my patch, which looks much better. Summary:

  Issue #8603: Create os.environb and os.getenvb() on POSIX system.
  os.unsetenv() encodes str argument using file system encoding and
  surrogateescape error handler (instead of utf8/strict), and accept bytes.

Changes with my previous patch:

 - update os module documentation
 - os.getenv() only accepts str, os.getenvb() only accepts bytes (to avoid 
mojibake)
 - fix test_environb() of test_os for ASCII locale
 - fix os.putenv() if key is an unicode string: use the string encoded to bytes 
as key for posix_putenv_garbage
 - _Envion.__setitem__() encodes the key and value before calling putenv()
 - _Environ.__delitem__() encodes the key before calling unsetenv()
 - create a temporary function to create os.environ (to use temporary variables 
like encode, decode, keymap, data)
 - annotation types in os.getenv() and os.getenvb()
 - remove fsencode()/fsdecode() from the patch and don't touch os._execvpe() 
(will be fixed in other issues)
 - putenv() uses PyBytes_GET_SIZE() instead of strlen()

--
Added file: http://bugs.python.org/file17199/os_environb-2.patch

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



[issue8514] Create fsencode() and fsdecode() functions in os.path

2010-05-04 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

I think that fsencode() (and fsdecode()) should be specific to POSIX. I don't 
know any good reason to encode a nice and correctly encoded unicode string to 
the ugly MBCS encoding.

--

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



[issue8513] subprocess: support bytes program name (POSIX)

2010-05-04 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Bytes program name problem should be splitted in two parts:

 (a) subprocess.call([b'env']) and subprocess.call([b'env'], env={'PATH': 
'/usr/bin'}): bytes program and unicode environ
 (b) bytes program and bytes environ

Part (a)


(a) would benefit from the creation of os(.path).fsencode() function (issue 
#8514).

Part (b)


If the creation of os.environb is accepted (#8603), I think that subprocess 
should also be modified to support pure bytes environ. Mix bytes and unicode 
variables in env would lead to mojibake and headaches.

So I propose the creation of an envb (environment bytes) argument to Popen 
constructor. (b) would be written as:

   subprocess.call([b'env'], envb={b'PATH': b'/usr/bin'})

or

   envb = os.environb.copy()
   envb[b'PATH'] = b'/usr/bin'
   subprocess.call([b'env'], envb=envb)

(and it will not be possible to define env and envb at the same time)

In this case, we will need a pure bytes version of os.get_exec_path(), and 
os._execvpe() should have a bytes environment mode (add an optional argument).

--

I have a patch fixing both problems, parts (a) and (b), but the patch depends 
on os.environb. I prefer to wait until os.environb is accepted to submit my 
patch.

--
dependencies: +Create a bytes version of os.environ and getenvb() -Create 
fsencode() and fsdecode() functions in os.path

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



[issue1533] Bug in range() function for large values

2010-05-04 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Thanks for the fixes.  The latest patch looks good to me.

Alexander, is it okay for me to commit this?

--
resolution:  - accepted

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



[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-04 Thread STINNER Victor

New submission from STINNER Victor victor.stin...@haypocalc.com:

On POSIX (but not on Mac OS X), Python3 calls get_codeset() to get the file 
system encoding. If this function fails, sys.getfilesystemencoding() returns 
None.  PyUnicode_DecodeFSDefaultAndSize() fallbacks to utf-8 whereas subprocess 
fail:

  ...
  File /home/SHARE/SVN/py3k/Lib/subprocess.py, line 670, in __init__
restore_signals, start_new_session)
  File /home/SHARE/SVN/py3k/Lib/subprocess.py, line 1101, in _execute_child
executable_list = (fs_encode(executable),)
  File /home/SHARE/SVN/py3k/Lib/subprocess.py, line 1088, in fs_encode
return s.encode(fs_encoding, 'surrogateescape')
TypeError: encode() argument 1 must be string, not None

We have two choices: raise a fatal error if get_codeset() failed, or fallback 
to utf-8.

On Windows and Mac OS X, get_codeset() shouldn't be called because the result 
is just dropped. We should call _PyCodec_Lookup(Py_FileSystemDefaultEncoding) 
instead to ensure that the file system encoding can be loaded.

--
components: Interpreter Core, Unicode
messages: 104924
nosy: haypo
priority: normal
severity: normal
status: open
title: Python3/POSIX:  errors if file system encoding is None
versions: Python 3.2

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



[issue8557] subprocess PATH semantics and portability

2010-05-04 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Fair enough.  Thank you for your detective work, and hopefully someone will be 
interested enough to pick this up again later.

--
status: open - languishing

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



[issue8608] fix_import prefixes . to already relative imports

2010-05-04 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Thanks, but this is a duplicate of issue 8553, which has already been fixed.

--
nosy: +r.david.murray
resolution:  - duplicate
stage:  - committed/rejected
status: open - closed
superseder:  - 2to3 breaks relative imports

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



[issue5753] CVE-2008-5983 python: untrusted python modules search path

2010-05-04 Thread Tomas Hoger

Tomas Hoger tho...@redhat.com added the comment:

Can anyone move this to Stage: patch review (for the fix approach proposed in 
msg90336)?  Or does anyone have better idea on how to move this closer to final 
fix or wontfix / reject?  Thank you!

--

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



[issue1533] Bug in range() function for large values

2010-05-04 Thread Alexander Belopolsky

Alexander Belopolsky alexander.belopol...@gmail.com added the comment:

On May 4, 2010, at 7:27 AM, Mark Dickinson rep...@bugs.python.org  
wrote:


 Mark Dickinson dicki...@gmail.com added the comment:

 Thanks for the fixes.  The latest patch looks good to me.

 Alexander, is it okay for me to commit this?


Sure. Why do you have to ask?

--
nosy: +Alexander.Belopolsky

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



[issue1533] Bug in range() function for large values

2010-05-04 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Hi Alexander,

I took the liberty of messing with your patch slightly;  I didn't want to ask 
you to make further changes since the patch was fine, and my messing was mostly 
just to satisfy my own fussiness (only the first two items were really 
necessary):

Minor updates:
 - add Misc/NEWS entry
 - remove trailing whitespace and fix spaces that should have been a tab
 - added some extra tests to check all possible combinations of bad
   arguments, purely to check for refcounting problems
 - initialize low to NULL, to match the Py_XDECREF(low) (could change
   that Py_XDECREF to Py_DECREF instead, but the code's more resistant
   to random refactorings this way --- see next item :)
 - randomly refactor:  regroup blocks for ease of reading
 - don't do PyLong_FromLong(1) until it's needed ('zero' is different,
   since it's always used in the non-error case)
 - [micro-optimization]: don't pass a known zero value to
   get_range_long_argument

Any objections or comments?  Can I apply this version of the patch?

--
Added file: http://bugs.python.org/file17200/issue1533_metd.diff

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



[issue1533] Bug in range() function for large values

2010-05-04 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Re emacs:

C-c . python

should set a python 2.x-friendly indentation mode.

There's also a python-new style floating around somewhere on the web (not part 
of emacs as standard), suitable for the 4-space indent style that's supposed to 
be used for new code.

--

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



[issue8242] Improve support of PEP 383 (surrogates) in Python3: meta-issue

2010-05-04 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

I opened a different issue to use surrogates in Python module path: #8611, but 
the issue is not specific to surrogates (Python3 doesn't support locale 
different than utf8 and an non-ASCII path (POSIX)).

--

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



[issue8611] Python3 doesn't support locale different than utf8 and an non-ASCII path (POSIX)

2010-05-04 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

We could have a separate list storing the original bytes form of sys.path; this 
list would be used by find_module() as long as Py_FileSystemDefaultEncoding 
isn't initialized.

--
nosy: +pitrou

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



[issue8611] Python3 doesn't support locale different than utf8 and an non-ASCII path (POSIX)

2010-05-04 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Or find_module() could use wcstombs() as long as Py_FileSystemDefaultEncoding 
is NULL.

--

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



[issue8477] _ssl: support surrogates in filenames, and bytes/bytearray filenames

2010-05-04 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Most of this should be solved if the patch in issue8550 gets accepted. As for 
test_decode_certificate, it seems it isn't used anywhere, and could therefore 
be deleted.

--

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



[issue8313] unprintable AssertionError object message in unittest tracebacks

2010-05-04 Thread Gunnlaugur Thor Briem

Gunnlaugur Thor Briem gunnlau...@gmail.com added the comment:

Replacing the message with its repr seems to me at least strongly preferable to 
the current “hide it all” behavior. :)

Better, msg.encode('ascii', 'backslashreplace') does what repr does with 
unencodable characters, but does not add the quotes, so the behavior is only 
different when it needs to be.

Better still, 'ascii' need not be hardcoded. I'm attaching a patch that sets 
the encoding from an environment variable, defaulting to 'ascii', and encodes 
the message with 'backslashreplace'. This makes unicode string equality 
assertions much more useful for me.

The encoding could also be configurable by some clean hook for test runners to 
use. unit2 could have a command-line parameter, and TextTestRunner could use 
stream.encoding if not None (or PYTHONIOENCODING on Python 3).

Ideally messages should not be forced to be 8-bit strings by the failure 
exception class, but I suppose that's a bigger change than you would want to 
make.

The downside of using backslashreplace (or repr, for that matter) is that it 
does not preserve lengths, so the diff markers can get misaligned. I find that 
an acceptable tradeoff, but 'replace' is another option that preserves lengths, 
at least more often.

--
keywords: +patch
nosy: +gthb
Added file: http://bugs.python.org/file17201/unittest2-issue-8313.patch

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



[issue3823] ssl.wrap_socket() is incompatible with servers that drop privileges, due to keyfile requirement

2010-05-04 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

There's a patch in issue8550 to expose SSL contexts as first-class objects. It 
allows you to create first your context object(s) and load certificates, then 
drop privileges, then create sockets using this/these contexts.
In any case, resolution can't happen before 3.2. 2.7 is in feature freeze now.

--
nosy: +pitrou
versions: +Python 3.2 -Python 2.6

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



[issue5753] CVE-2008-5983 python: untrusted python modules search path

2010-05-04 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 Can anyone move this to Stage: patch review (for the fix approach
 proposed in msg90336)?  Or does anyone have better idea on how to move
 this closer to final fix or wontfix / reject?  Thank you!

I stand by my opinion that adding another hack in the initialization
path will not do us a lot of good, while a separate API would solve the
problem neatly. Perhaps Dave Malcolm can chime in?

--

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



[issue8313] unprintable AssertionError object message in unittest tracebacks

2010-05-04 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

Sounds like a good solution - I'll look at this, thanks.

--

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



[issue8611] Python3 doesn't support locale different than utf8 and an non-ASCII path (POSIX)

2010-05-04 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

I have a patch implementation most of the point described in my first message. 
I have to rework on it before submit it. The patch depends on other issues, and 
I prefer to first fix all related issues.

--

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



[issue8612] multiprocessing Queue module failes to send INIConfig objects

2010-05-04 Thread Zaar Hai

New submission from Zaar Hai haiz...@gmail.com:

I'm using INIConfig class from iniparse 
module(http://code.google.com/p/iniparse).
I've tried to use multiprocessing.Queue to propagate 
configuration changes between the processes. However, INIConfig instances 
have troubles being pushed through Queue objects.

I do not know whether this is a Queue or iniparse bug, so I've opened issued on 
both projects(http://code.google.com/p/iniparse/issues/detail?id=20). Even this 
is not a Queue bug, it would be great to have some advice on how this problem 
may be solved. Thanks.

Problem description:

Running this simple code:

from multiprocessing import Process
from multiprocessing import Queue
from iniparse import INIConfig
import time

def worker(queue):
config = queue.get()
print config.sec1.var1

def main():
config = INIConfig(open(./my.conf))
queue = Queue()
p = Process(target=worker, args=(queue,))
p.start()
queue.put(config)
time.sleep(1)

if __name__ == __main__:
main()

Raised this error:
Traceback (most recent call last):
  File /usr/lib/pymodules/python2.5/multiprocessing/queues.py, line 242, in 
_feed
send(obj)
TypeError: 'Undefined' object is not callable

The contents of my.conf are like this:
[sec1]
var1 = test1
var2 = test2

I'm using python 2.5.2 on Debian Lenny amd64 with python-multiprocessing 
package (http://packages.debian.org/squeeze/python-multiprocessing).

--
components: None
messages: 104942
nosy: Zaar.Hai
priority: normal
severity: normal
status: open
title: multiprocessing Queue module failes to send INIConfig objects
versions: Python 2.5

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



[issue8313] unprintable AssertionError object message in unittest tracebacks

2010-05-04 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

Very recently, issue8533 changed regrtest.py to use 'backslashreplace' when 
printing errors. This issue seems very similar

--
nosy: +amaury.forgeotdarc, haypo

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



[issue8567] decimal module doesn't respect precedence rules for exceptional conditions

2010-05-04 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Precedence fixed in r80753 through r80756.

That still leaves open the problem of what flags should be set;  however, we 
should discuss this in a separate issue.

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

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



[issue8613] Decimal module flags undetermined when a signal is trapped.

2010-05-04 Thread Mark Dickinson

New submission from Mark Dickinson dicki...@gmail.com:

In an effort to keep to one issue per tracker item, I'm pulling this issue out 
of the comments on issue 8567.

Issue:  if a Decimal operation raises several signals, and one or more of those 
signals is trapped, how should that operation affect flags?

Decimal currently ends up setting some or none of those flags, depending on 
exactly which signal is trapped first.

Stefan points out that cdecimal and decnumber both treat all operations as 
atomic:  *all* flags relevant to that operation are set, and only then are any 
traps acted on.

The specification isn't clear on this.  At 
http://speleotrove.com/decimal/daexcep.html it says:

The value of the trap-enabler for each signal in the context determines 
whether an operation is completed after the condition is detected or whether 
the condition is trapped and hence not necessarily completed (see IEEE 754 §7 
and §8).

There's also this (thanks, Stefan), in 
http://speleotrove.com/decimal/damodel.html

For each of the signals, the corresponding flag is set to 1 when the signal 
occurs. It is only reset to 0 by explicit user action.

However, this doesn't really help: do we regard signals as being raised 
one-by-one during (or at the end of) an operation, or all at once?  And should 
a trap take effect the moment a signal is handled, or should all traps be 
delayed until the end of an operation?

--
assignee: mark.dickinson
messages: 104945
nosy: facundobatista, mark.dickinson, rhettinger, skrah
priority: normal
severity: normal
stage: unit test needed
status: open
title: Decimal module flags undetermined when a signal is trapped.
type: behavior

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



[issue8313] unprintable AssertionError object message in unittest tracebacks

2010-05-04 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

The example raises an AssertionError(u'\n- \ufffd+ \ufffd\ufffd') which is 
converted to string by traceback.format_exception(). This function fails in 
_some_str() on str(value) instruction. You can reproduce the error with:

 str(AssertionError(u\xe9))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 0: 
ordinal not in range(128)

 The problem with creating unicode tracebacks is that they could 
 fail when being output on terminals not capable of showing 
 the full range of unicode characters (the default terminal 
 on Windows is CP1252).

The problem is not related to the terminal encoding: str(value) uses Python 
default encoding (ASCII by default). Python3 is not concerned because 
str(AssertionError(\xe9)) doesn't raise any error: it returns \xe9.

--
components: +Unicode
versions:  -Python 3.2

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



[issue8313] unprintable AssertionError object message in unittest tracebacks

2010-05-04 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 Very recently, issue8533 changed regrtest.py to use
 'backslashreplace' when printing errors. This issue seems 
 very similar

Issue #8533 is not directly related because in this issue the error occurs 
before writing the traceback to the terminal.

--

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



[issue1533] Bug in range() function for large values

2010-05-04 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

On Tue, May 4, 2010 at 8:34 AM, Mark Dickinson rep...@bugs.python.org wrote:
..
 I took the liberty of messing with your patch slightly;  I didn't want
 to ask you to make further changes since the patch was fine, and my
 messing was mostly just to satisfy my own fussiness (only the first
 two items were really necessary):


Thank you for doing it.  The patch is good to go, questions and comments below 
are just for my education.

 Minor updates:
  - add Misc/NEWS entry

What is the standard practice on this?  I thought Misc/NEWS entry was similar 
to commit message and would be written by a committer.  What are the guidelines 
for writing such entries?  I see that some entries simply repeat the title of 
the issues while others got into greater details.

  - remove trailing whitespace and fix spaces that should have been
 a tab

I've looked at my patch through cat -et and couldn't find any tab/space issues. 
 I did notice one empty line with a single space that you removed.  Do you use 
an automated checking tool for this?  I just did grep  $.  BTW, the current 
trunk version (r80752) of Python/bltinmodule.c has two lines with trailing 
white space:

$ cat -n Python/bltinmodule.c | grep  $ | cat -et
   641^I^I^IPyErr_SetString(PyExc_TypeError, $
  2966^I$


  - added some extra tests to check all possible combinations of bad
   arguments, purely to check for refcounting problems

With arguments processing segregated in a common function, I am not sure  
whether additional tests actually increase coverage.  This brings a question: 
what is the recommended way to produce coverage statistics for  C modules?  
regrtest.py --coverage seems to be for python modules only. 

  - initialize low to NULL, to match the Py_XDECREF(low) (could change
   that Py_XDECREF to Py_DECREF instead, but the code's more resistant
   to random refactorings this way --- see next item :)

Good catch.  Wouldn't the same argument apply to ilow?  Wouldn't static code 
checkers complain about redundant initialization?

  - randomly refactor:  regroup blocks for ease of reading

I actually disagree that your regrouping makes the code clearer.  In my 
version, all idiosyncratic argument processing is done with borrowed references 
first followed by common processing in three similar blocks.  This, however, is 
purely matter of taste.  Note that I considered changing i* names to raw* 
names, but decided not to introduce more changes than necessary.  In your 
grouping, however, the similarity of variable names is more of an issue.  This 
said, I don't really have any problem with your choice.

  - don't do PyLong_FromLong(1) until it's needed ('zero' is different,
   since it's always used in the non-error case)

Yes, I considered that. A further micro-optimization would be to initialize a 
static variable in module initialization and reuse it in get_len_of_range_longs 
as well.  I decided to put it next to zero instead to simplify the logic.

  - [micro-optimization]: don't pass a known zero value to
   get_range_long_argument

Is it really worth it?  Default start is probably not that common in case of 
long arguments.


 Any objections or comments?  Can I apply this version of the patch?


The above are not objections.  Please apply this version of the patch.

--

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



[issue1533] Bug in range() function for large values

2010-05-04 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


--
assignee: belopolsky - mark.dickinson

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



[issue8313] unprintable AssertionError object message in unittest tracebacks

2010-05-04 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Attached patch fixes _some_str() function of the traceback module: encode 
unicode exception message to ASCII using backslashreplace error handler. ASCII 
is not the best choice, but str(unicode(...)) uses also ASCII (the default 
encoding) and we don't know the terminal encoding in traceback. We cannot do 
better here in Python2 (without breaking a lot of APIs...).

The right fix is to use Python3 which formats a traceback to unicode (unicode 
characters of the error message are kept unchanged). The choice of the encoding 
and error handler is made only at the end, when writing the output to the 
terminal, which is the right thing to do.

--
Added file: http://bugs.python.org/file17202/traceback_unicode.patch

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



[issue5753] CVE-2008-5983 python: untrusted python modules search path

2010-05-04 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

FWIW I agree with Antoine.

--
nosy: +r.david.murray

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



[issue8576] test_support.find_unused_port can cause socket conflicts on Windows

2010-05-04 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 You mean that socket.create_connection(), httplib (issue 3972) and ftplib 
 (issue 8594) should have used a different API to implement their 
 source_address option?

I'm not sure what you mean.  The problem here is that you cannot reliably bind 
a specific local address because it might be bound already.

This is bad in unit tests because it causes spurious failures that waste 
developer effort forcing people to investigate non-bugs or because it causes 
people to ignore the results of the test suite.

This is bad in real applications because it prevents an application from 
working as it is supposed to.

Perhaps you have an application which requires that HTTP requests are issued 
from (1.2.3.4, 12345).  Then you'd better use an HTTP client library that lets 
you bind to this address when connecting to the HTTP server.  But the 
application is going to be prone to failure.  If you can't get around the 
requirement, then you just get to live with an unreliable application.

There's no such requirement in any unit test, though.  Unit tests can do 
whatever they want in order to achieve the goal of exercising the relevant 
implementation code and verify the results to be correct.  I don't think there 
are any unit tests which need to bind to one specific address in order to 
accomplish this goal.

--

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



[issue8576] test_support.find_unused_port can cause socket conflicts on Windows

2010-05-04 Thread Paul Moore

Paul Moore p.f.mo...@gmail.com added the comment:

One of the tests in test_socket is checking that an attempt to connect to a 
port with no server running gives socket.error. For that, we need a port that's 
guaranteed to have no server present.

I think that one of the tests in test_httplib checks the source_address 
attribute to make sure the port it contains is the one you connected on - 
again, you need a specific port and it can't be in use. (Sorry, I'm not precise 
on the details of this one as it's only in trunk and I'm not at a PC with a 
trunk checkout at the moment).

Arguably these tests are of limited value and could simply be deleted, but they 
are there, and I don't see a way of implementing them without using something 
that gives you an unused port number...

--

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



[issue1533] Bug in range() function for large values

2010-05-04 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

[Some of the Alexander's questions about procedures aren't really related to 
this issue;  I've answered those offline.  Here are the answers to the others.]


  - initialize low to NULL, to match the Py_XDECREF(low) (could change
   that Py_XDECREF to Py_DECREF instead, but the code's more resistant
   to random refactorings this way --- see next item :)

 Good catch.  Wouldn't the same argument apply to ilow?  Wouldn't static code 
 checkers complain about redundant initialization?

ilow doesn't need to be initialized because the PyArgs_ParseTuple is
guaranteed to either fail or initialize it, and I can't see that the
PyArgs_ParseTuple call is likely to change.  But I admit that the lack
of initialization here also makes me uncomfortable, especially in
combination with the assert that's there.  I might add an
initialization.

Do static code checkers really complain about redundant
initializations?  If anything, it seems like good defensive
programming practice to initialize variables, even
unnecessarily---later refactoring might make those initializations
necessary.


  - randomly refactor:  regroup blocks for ease of reading

 I actually disagree that your regrouping makes the code clearer.  In my 
 version, all idiosyncratic argument processing is done with borrowed 
 references first followed by common processing in three similar blocks.  
 This, however, is purely matter of taste.  Note that I considered changing i* 
 names to raw* names, but decided not to introduce more changes than 
 necessary.  In your grouping, however, the similarity of variable names is 
 more of an issue.  This said, I don't really have any problem with your 
 choice.

Okay, fair enough.  I agree it's a matter of taste.  I like the three
separate blocks, one for each argument, especially since the
refcounting semantics are clear:  each block adds exactly one
reference.  But each to his own. :)


  - don't do PyLong_FromLong(1) until it's needed ('zero' is different,
   since it's always used in the non-error case)

 Yes, I considered that. A further micro-optimization would be to initialize a 
 static variable in module initialization and reuse it in 
 get_len_of_range_longs as well.  I decided to put it next to zero instead to 
 simplify the logic.

Hmm.  Possibly.  I have an unhealthy and probably irrational aversion
to non-constant static variables, even if the only time that the
variable is changed is at module initialization.


  - [micro-optimization]: don't pass a known zero value to
   get_range_long_argument

 Is it really worth it?  Default start is probably not that common in case of 
 long arguments.

Yes, possibly not. :)  Partly I made this change because the
assignment 'ilow = zero;' again raises a red flag for me, because it's
not accompanied by a 'Py_INCREF(zero);' as I'd expect it to be.  I
realize that in this case it works out (because ilow is already a
borrowed reference, and we're replacing it with a borrowed reference
to zero), but it's sufficiently unusual that I have to think about it.
 This is personal preference again, I guess.

--

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



[issue8576] test_support.find_unused_port can cause socket conflicts on Windows

2010-05-04 Thread Jean-Paul Calderone

Jean-Paul Calderone exar...@twistedmatrix.com added the comment:

 One of the tests in test_socket is checking that an attempt to connect to a 
 port with no server running gives socket.error. For that, we need a port 
 that's guaranteed to have no server present.

A good way to do this is to create a socket, bind it to an address (any address 
- ie ('', 0)), ask it what its address is, and use that as the destination of 
the connect attempt.  Since you didn't listen() on it, it's not a server, and 
it won't accept any connections.

Doing it this way is again more reliable, since if you try to discover an 
unused address with find_unused_port, a real server might end up re-using that 
address by the time your test gets around to trying to connect to it.

 I think that one of the tests in test_httplib checks the source_address 
 attribute to make sure the port it contains is the one you connected on - 
 again, you need a specific port and it can't be in use.

If you're talking about SourceAddressTest.testHTTPConnectionSourceAddress, I 
see what you mean.  This is basically an integration test between httplib and 
the socket module.  No actual socket is required here.  I would implement this 
test using a fake socket object.  This would allow the test assertion to be 
strengthened (it currently doesn't assert anything about the ip part of the 
address, it only checks the port), and still avoids running into problems 
binding a *real* local address.

 Arguably these tests are of limited value and could simply be deleted

I definitely would not argue this.  These tests seem to cover real 
functionality which isn't directly covered elsewhere.  They shouldn't be 
deleted, but fixed to avoid the potential races they're subject to now.

--

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



[issue8576] test_support.find_unused_port can cause socket conflicts on Windows

2010-05-04 Thread Paul Moore

Paul Moore p.f.mo...@gmail.com added the comment:

Thanks for the suggestions, I'll see if I can implement something based on them.

--

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



[issue1533] Bug in range() function for large values

2010-05-04 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Applied to trunk in r80758.

Do people want this to go into 2.6 as well?  The patch would need to be 
modified to produce a warning for floats instead of giving a TypeError (and the 
tests would need to be modified to test for that warning).

--

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



[issue1533] Bug in range() function for large values

2010-05-04 Thread Alexander Belopolsky

Alexander Belopolsky alexander.belopol...@gmail.com added the comment:

On Tue, May 4, 2010 at 12:32 PM, Mark Dickinson rep...@bugs.python.org wrote:

 Mark Dickinson dicki...@gmail.com added the comment:

 Applied to trunk in r80758.

 Do people want this to go into 2.6 as well?

Also, should additional unit tests forward ported to 3.x?  If so, let
me do it as an exercise in creating a ready to commit patch. :-)

--

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



[issue8008] Allow Arbitrary OpenID providers in this bug tracker

2010-05-04 Thread Jesús Cea Avión

Jesús Cea Avión j...@jcea.es added the comment:

Someway, the closed state vanished.

--
nosy:  -georg.brandl, r.david.murray
priority: normal - 

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



[issue8008] Allow Arbitrary OpenID providers in this bug tracker

2010-05-04 Thread Jesús Cea Avión

Jesús Cea Avión j...@jcea.es added the comment:

Uhmmm... My browser seems crazy.

--
nosy: +georg.brandl, r.david.murray

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



[issue1533] Bug in range() function for large values

2010-05-04 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

+1 for forward-porting/adapting relevant tests to py3k.

--
assignee: mark.dickinson - belopolsky

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



[issue8586] test_imp.py test failures on Py3K Mac OS X

2010-05-04 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

Any idea where this path comes from? I can go spelunking through the code 
myself to investigate.

--

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



[issue8611] Python3 doesn't support locale different than utf8 and an non-ASCII path (POSIX)

2010-05-04 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue8586] test_imp.py test failures on Py3K Mac OS X

2010-05-04 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

Ok, so the cause of the bug is 'simple' - not sure what the best fix is.

When I run python from a freshly built py3k I have the following as sys.path:

['', '/dev/null/lib/python32.zip', '/compile/python-trunk3/Lib', 
'/compile/python-trunk3/Lib/plat-darwin', 
'/compile/python-trunk3/build/lib.macosx-10.4-x86_64-3.2-pydebug', 
'/Volumes/Second Drive/michael/.local/lib/python/3.2/site-packages']

Note that weird second entry!

support.forget(...) trys to unlink the supplied name (+.py + c|o) from every 
path in sys.path.

The unlink function catches OSError, but *only* if the errno is errno.ENOENT. 
On my system the specific error raises is:

OSError: [Errno 20] Not a directory

--

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



[issue8586] test_imp.py test failures on Py3K Mac OS X

2010-05-04 Thread Barry A. Warsaw

Barry A. Warsaw ba...@python.org added the comment:

Maybe you just want to relax the test in the except clause of 
test.support.unlink()?  Or change the test to

if error.errno not in (errno.ENOENT, errno.ENOTDIR)

?

--

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



[issue8586] test_imp.py test failures on Py3K Mac OS X

2010-05-04 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

On trunk the definition of unlink is:


def unlink(filename):
try:
os.unlink(filename)
except OSError:
pass

:-)

Changing it as you suggest fixes the problem though. Ok to commit?

--

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



[issue8614] test_gzip fails on OS X

2010-05-04 Thread Mark Dickinson

New submission from Mark Dickinson dicki...@gmail.com:

test_buffered_reader test_gzip is failing for me since r80720, on trunk on OS X 
10.6.3:

==
ERROR: test_buffered_reader (__main__.TestGzip)
--
Traceback (most recent call last):
  File Lib/test/test_gzip.py, line 91, in test_buffered_reader
lines = [line for line in r]
  File /Users/dickinsm/python/svn/trunk/Lib/gzip.py, line 365, in flush
self.fileobj.flush()
IOError: [Errno 9] Bad file descriptor

--
Ran 16 tests in 1.258s

FAILED (errors=1)
Traceback (most recent call last):
  File Lib/test/test_gzip.py, line 271, in module
test_main(verbose=True)
  File Lib/test/test_gzip.py, line 268, in test_main
test_support.run_unittest(TestGzip)
  File /Users/dickinsm/python/svn/trunk/Lib/test/test_support.py, line 1038, 
in run_unittest
_run_suite(suite)
  File /Users/dickinsm/python/svn/trunk/Lib/test/test_support.py, line 1021, 
in _run_suite
raise TestFailed(err)
test.test_support.TestFailed: Traceback (most recent call last):
  File Lib/test/test_gzip.py, line 91, in test_buffered_reader
lines = [line for line in r]
  File /Users/dickinsm/python/svn/trunk/Lib/gzip.py, line 365, in flush
self.fileobj.flush()
IOError: [Errno 9] Bad file descriptor


Here's a minimal Python script that produces the failure:

import gzip
import io

f = gzip.GzipFile('hamster', 'wb')
f.write(some data)
f.close()

f = gzip.GzipFile('hamster', 'rb')
r = io.BufferedReader(f)
lines = [line for line in r]
r.close()

This gives the following output:

Traceback (most recent call last):
  File test_gzip.py, line 11, in module
r.close()
  File /Users/dickinsm/python/svn/trunk/Lib/gzip.py, line 365, in flush
self.fileobj.flush()
IOError: [Errno 9] Bad file descriptor
[20213 refs]

--
components: Library (Lib)
messages: 104965
nosy: mark.dickinson, pitrou
priority: normal
severity: normal
status: open
title: test_gzip fails on OS X
versions: Python 2.7

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



[issue8614] test_gzip fails on OS X

2010-05-04 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Can you try the following:

 f = open('LICENSE', 'rb')
 f.flush()

--

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



[issue8586] test_imp.py test failures on Py3K Mac OS X

2010-05-04 Thread Barry A. Warsaw

Barry A. Warsaw ba...@python.org added the comment:

+1

--
assignee: barry - michael.foord
resolution: works for me - accepted

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



[issue8614] test_gzip fails on OS X

2010-05-04 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Yep, that's enough to trigger it:

Python 2.7b1+ (trunk:80760, May  4 2010, 19:27:27) 
[GCC 4.2.1 (Apple Inc. build 5659)] on darwin
Type help, copyright, credits or license for more information.
 f = open('LICENSE', 'rb')
[35032 refs]
 f.flush()
Traceback (most recent call last):
  File stdin, line 1, in module
IOError: [Errno 9] Bad file descriptor
[35067 refs]

--

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



[issue8614] test_gzip fails on OS X

2010-05-04 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Ok, can you try the following patch then:

Index: Lib/gzip.py
===
--- Lib/gzip.py (révision 80760)
+++ Lib/gzip.py (copie de travail)
@@ -362,7 +362,7 @@
 if self.mode == WRITE:
 # Ensure the compressor's buffer is flushed
 self.fileobj.write(self.compress.flush(zlib_mode))
-self.fileobj.flush()
+self.fileobj.flush()
 
 def fileno(self):
 Invoke the underlying file object's fileno() method.

--

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



[issue1533] Bug in range() function for large values

2010-05-04 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

I am attaching a py3k patch that adds new tests.  Since there are no end user 
visible changes, I don't believe a Misc/NEWS entry is needed.  A commit message 
may read:

Issue #1533: Tests only. Added tests for consistency in range function argument 
processing. 

Note that the first chunk:

-# Reject floats when it would require PyLongs to represent.
-# (smaller floats still accepted, but deprecated)
+# Reject floats.
+self.assertRaises(TypeError, range, 1., 1., 1.)

is applicable to the trunk as well.

--
versions: +Python 3.1, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file17203/issue1533-py3k-tests.diff

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



[issue8614] test_gzip fails on OS X

2010-05-04 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

That fixes the failure.

--

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



[issue5727] doctest pdb readline broken

2010-05-04 Thread Sriram

Sriram sriramrathinav...@yahoo.com added the comment:

Hi,

On second thoughts, it made more sense to validate pdb directly instead of 
validating doctest's debugger.

I have also used few inputs, I got from irc chat at #python-dev room in writing 
the test case. Thanks to them.

I have attached the svn diff.

Please review them

Thanks
Sriram

--
Added file: http://bugs.python.org/file17204/pdb_doctest_readline.patch

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



[issue8614] test_gzip fails on OS X

2010-05-04 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Thanks, Antoine.  Applied in r80762 through r80765.

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
type:  - behavior

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



[issue5727] doctest pdb readline broken

2010-05-04 Thread Jean-Paul Calderone

Changes by Jean-Paul Calderone exar...@twistedmatrix.com:


--
stage: unit test needed - patch review

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



[issue8483] asyncore.dispatcher's __getattr__ method produces confusing effects

2010-05-04 Thread Giampaolo Rodola'

Giampaolo Rodola' g.rod...@gmail.com added the comment:

As per discussion on #python-dev we think it's better to proceed as follows:

for python 2.7 and 3.2: 
 - fix __getattr__ error message
 - raise a DeprecationWarning if cheap inheritance is used and definitively 
remove its support in the next major version
 - create an alias for __str__

For Python 2.6 and 3.1: just fix __getattr__ error message.

Patch for Python 2.7 is in attachment.

--
assignee:  - giampaolo.rodola
stage:  - commit review
type:  - behavior
versions: +Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file17205/2.7.patch

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



[issue812369] module shutdown procedure based on GC

2010-05-04 Thread cburroughs

Changes by cburroughs chris.burrou...@gmail.com:


--
nosy: +cburroughs

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



[issue7835] Minor bug in 2.6.4 related to cleanup at end of program

2010-05-04 Thread cburroughs

Changes by cburroughs chris.burrou...@gmail.com:


--
nosy: +cburroughs

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



[issue5727] doctest pdb readline broken

2010-05-04 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


--
nosy: +belopolsky

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



[issue8615] turtle.py - backport of 3.1 features

2010-05-04 Thread Gregor Lingl

Gregor Lingl gregorli...@users.sourceforge.net added the comment:

Here, just for your information, the appropriate unified diff (from the version 
in 2.7b1 to the new submitted one.

--
keywords: +patch
Added file: http://bugs.python.org/file17207/turtle27b1_to_turtle27.diff

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



[issue8615] turtle.py - backport of 3.1 features

2010-05-04 Thread Brian Curtin

Changes by Brian Curtin cur...@acm.org:


--
nosy: +benjamin.peterson

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



[issue8616] Changes to content of Demo/turtle

2010-05-04 Thread Gregor Lingl

New submission from Gregor Lingl gregorli...@users.sourceforge.net:

turtleDemo.py contains a string referring to the outdated xturtle.
Should be replaced according to the submitted diff.

Moreover I'd like to propose to add to demo-scripts to the Demo-directory, 
namely tdemo_nim.py and tdemo_round_dance.py as well as to replace the old 
tdemo_paint.py by the enhanced version tdemo_scribble.py. I'll add those files 
subsequently.
Regards,
Gregor

--
components: Demos and Tools
files: turtleDemo_27b1_to_turtleDemo.diff
keywords: patch
messages: 104977
nosy: georg.brandl, gregorlingl, loewis
priority: normal
severity: normal
status: open
title: Changes to content of Demo/turtle
versions: Python 2.7
Added file: http://bugs.python.org/file17208/turtleDemo_27b1_to_turtleDemo.diff

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



[issue8616] Changes to content of Demo/turtle

2010-05-04 Thread Gregor Lingl

Changes by Gregor Lingl gregorli...@users.sourceforge.net:


Added file: http://bugs.python.org/file17209/tdemo_nim.py

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



[issue8616] Changes to content of Demo/turtle

2010-05-04 Thread Gregor Lingl

Changes by Gregor Lingl gregorli...@users.sourceforge.net:


Added file: http://bugs.python.org/file17210/tdemo_round_dance.py

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



[issue8615] turtle.py - backport of 3.1 features

2010-05-04 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Unfortunately, I feel that you are (again) too late here. 2.7 has already seen 
its first beta release, so new features are not acceptable. You can still try 
to petition acceptance of new features with the release manager.

--

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



[issue8616] Changes to content of Demo/turtle

2010-05-04 Thread Gregor Lingl

Changes by Gregor Lingl gregorli...@users.sourceforge.net:


Added file: http://bugs.python.org/file17211/tdemo_scribble.py

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



[issue8432] buildbot: test_send_signal of test_subprocess failure

2010-05-04 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

I get this same failure on Mac OS X 10.6.3 as well.

--
nosy: +michael.foord

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



[issue8615] turtle.py - backport of 3.1 features

2010-05-04 Thread Gregor Lingl

Gregor Lingl gregorli...@users.sourceforge.net added the comment:

As far as I remember, in the past there was a feature - freeze only with the 
appearance of beta2?

Maybe I'm wrong. So there remains only to try to interpret the term new 
feature appropriately, as all those features are already present in Python 
3.1. If there are serious objections against adopting it, I'll accept them of 
course.

I just wanted to serve the community with making Python 2.7 more similar to 
Python 3.1

Regards,
Gregor

--

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



[issue8586] test_imp.py test failures on Py3K Mac OS X

2010-05-04 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

Committed revision 80771.

--
assignee: michael.foord - barry
resolution: accepted - works for me
stage: needs patch - committed/rejected
status: open - closed

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



[issue8615] turtle.py - backport of 3.1 features

2010-05-04 Thread Gregor Lingl

Gregor Lingl gregorli...@users.sourceforge.net added the comment:

I see, that Benjamin Peterson, the release manager, is on the nosy list now. So 
please decide on this issue. If you need any supplementary information, I'll 
try to provide it.

(The issue concerning the adoption of this version of the turtle module for 
Python 3.1 can be found here: http://bugs.python.org/issue5923)

Regards,
Gregor

--

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



[issue8616] Changes to content of Demo/turtle

2010-05-04 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +benjamin.peterson

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



[issue7472] email.encoders.encode_7or8bit(): typo iso-2202. iso-2022 is correct.

2010-05-04 Thread Shashwat Anand

Shashwat Anand anand.shash...@gmail.com added the comment:

Adding unit-test for the patch

--
keywords: +patch
Added file: http://bugs.python.org/file17212/test_email.patch

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



[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-04 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Here is a patch for the first solution: display a fatal error if we are unable 
to get the locale encoding. It does always exit with a fatal error if 
nl_langinfo(CODESET) is not available (and Py_FileSystemDefaultEncoding is not 
set).

I don't think it's a good idea to display an fatal error at runtime. If 
nl_langinfo(CODESET) is not available, configure should fail or we should 
fallback to an hardcoded encoding (ok but which one?).

Extract of the nl_langinfo() manual page (on Linux):

CONFORMING TO
   SUSv2, POSIX.1-2001.

--
keywords: +patch
Added file: http://bugs.python.org/file17213/no_fsencoding_error.patch

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



[issue8617] Non-existent variables documented

2010-05-04 Thread Dave Abrahams

New submission from Dave Abrahams d...@boostpro.com:

http://docs.python.org/library/site.html#module-site mentions two variables 
that don't appear in my Python 2.6.5 installation's site module:

PYTHONNOUSERSITE
New in version 2.6.

PYTHONUSERBASE
New in version 2.6.

--
assignee: d...@python
components: Documentation
messages: 104985
nosy: dabrahams, d...@python
priority: normal
severity: normal
status: open
title: Non-existent variables documented
versions: Python 2.6

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



[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-04 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Patch for the second solution (fallback to utf-8 on get_codeset() failure):

 - create a subfunction initfsencoding() (Py_InitializeEx is already very long)
 - hardcode the encoding to utf-8 if nl_langinfo(CODESET) is missing
 - don't call get_codeset() on Windows or Mac OS X
 - call _PyCodec_Lookup(Py_FileSystemDefaultEncoding) if get_codeset() was not 
called (eg. on Windows) or if get_codeset() failed to ensure that the codec can 
be (and is) loaded: display a fatal error on failure

Since I wrote patches for both solution, I can now compare correctly advantages 
and disavantages. I prefer initfsencoding() because it works on all cases and 
is simpler than no_fsencoding_error.patch.

--
Added file: http://bugs.python.org/file17214/initfsencoding.patch

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



[issue8603] Create a bytes version of os.environ and getenvb()

2010-05-04 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

@loewis: So do you agree to add os.environb and os.getenvb()?

The documentation of os.environb and os.getenvb() in my last patch is very 
short. I'm not inspired.

We told me on IRC to not use function annotations because annotation semantic 
was not decided yet.

I will try to improve the documentation and remove the annotations in my next 
patch.

--

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



[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-04 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
nosy: +pitrou

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



[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-04 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +loewis

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



[issue8618] test_winsound failing on Windows Server 2008

2010-05-04 Thread Brian Curtin

New submission from Brian Curtin cur...@acm.org:

Some of the test_alias_* functions in test_winsound are failing with a 
RuntimeError Failed to play sound when run on Server 2008 R2. 

The sound from each test exists in the registry so the test doesn't end up 
getting skipped. I'm guessing there is some missing privilege, so it's possible 
we should additionally skip based on that.

--
assignee: brian.curtin
components: Tests, Windows
messages: 104988
nosy: brian.curtin
priority: normal
severity: normal
stage: needs patch
status: open
title: test_winsound failing on Windows Server 2008
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

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



[issue8610] Python3/POSIX: errors if file system encoding is None

2010-05-04 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue8313] unprintable AssertionError object message in unittest tracebacks

2010-05-04 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 The downside of using backslashreplace (or repr, for that matter) is
 that it does not preserve lengths, so the diff markers can get
 misaligned. I find that an acceptable tradeoff, but 'replace' is
 another option that preserves lengths, at least more often.

'replace' loose important informations: if the test is about the unicode string 
content, we will be unable to see the error data.

Result of the first example with my patch (backslashreplace):
==
FAIL: test_fffd (__main__.Foo)
--
Traceback (most recent call last):
  File x.py, line 3, in test_fffd   
def test_fffd(self): self.assertEqual(u'\ufffd', u'\ufffd\ufffd') 
AssertionError:   
- \ufffd+ \ufffd\ufffd

Result of the first example with 'replace' error handler:
==
FAIL: test_fffd (__main__.Foo)
--
Traceback (most recent call last):
  File x.py, line 3, in test_fffd
def test_fffd(self): self.assertEqual(u'\ufffd', u'\ufffd\ufffd')
AssertionError:
- ?+ ??

(but this example is irrevelant because U+FFFD is the unicode replacement 
character :-D)

If nobody complains about my patch, I will commit it to Python trunk (only).

You can still reimplement fail() method to encode the message using a more 
revelant encoding and/or error handler.

--

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



[issue665761] reduce() masks exception

2010-05-04 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
nosy: +haypo

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



[issue4265] shutil.copyfile() leaks file descriptors when disk fills

2010-05-04 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
nosy: +haypo

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



[issue4265] shutil.copyfile() leaks file descriptors when disk fills

2010-05-04 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Could you write a test? Use a fake file objects that raise (or not) an IOError 
on close(), and then check that close() was closed on both files. There are 4 
cases: input.close() raises or not an exception, output.close() raises or not 
an exception.

--

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



[issue2091] file accepts 'rU+' as a mode

2010-05-04 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
nosy: +haypo

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



[issue8592] 'y' does not check for embedded NUL bytes

2010-05-04 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Same issue for y#:

y# (...) This variant on s# doesn’t accept Unicode objects, only bytes-like 
objects.

s# (...) The string may contain embedded null bytes.

--

y* might mention that it accepts embedded null bytes.

--

grep 'PyArg_Parse[^]\+[^:;)]*y[^*]' */*.c finds only usage of y# (no usage 
of y format):

 - mmap_gfind(), mmap_write_method()
 - oss_write(), oss_writeall()
 - in getsockaddrarg() with s-sock_family==AF_PACKET
 - in sock_setsockopt() if the option name is a string
 - socket_inet_ntoa(), socket_inet_ntop()

These functions have to support embedded null bytes. So I think that y# should 
specify explicitly that embedded null bytes are accepted.

--
nosy: +haypo

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



[issue8592] 'y' does not check for embedded NUL bytes

2010-05-04 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

See also #8215.

--

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



[issue8215] getargs.c in Python3 contains some TODO and the documentation is outdated

2010-05-04 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

See also #8592.

--

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



[issue7472] email.encoders.encode_7or8bit(): typo iso-2202. iso-2022 is correct.

2010-05-04 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Comments on patch:

We prefer patches to be generated from the top level directory of the checkout, 
so that it can be applied by doing 'patch -p0 xxx.patch' from the top level 
directory without having to look in the patch file to see what directory it was 
generated in.

The test is correct in general outline, but the thing that needs to be tested 
is that when a byte string in a character encoding that is eight bit, but whose 
output encoding (the encoding email will use when writing the message) is 7bit, 
that 7bit will be chosen for the transfer encoding.  If you look in 
Lib/email/charsets.py, there are only two such character sets, euc-jp and 
shift-jis.

We discussed this in IRC, and you found a euc-js character, but then said that 
the test passed even with the fix removed.  The byte string you are using in 
the bytes test you posted does not appear to be encodable in the output 
character set (iso-2022-jp). I'm guessing you used this, and 
_charset='iso-2022-jp', because otherwise the test passes without the fix.

That is, if put in a character, such as 文 ('\xca\xb8' as an euc-jp encoded byte 
stream), and pass _encoding='euc-jp', the test passes without the fix.  So, you 
were exactly right in what you said in IRC, and should have posted that version 
of the unit test :)

Looking at the code even more carefully than I did last time, it turns out that 
as soon as the 'charset' is set, the payload gets translated from the input 
character set to the output character set, and *then* encode_7or8bit is called. 
 As far as I have been able to figure out, there is no way for encode_7or8bit 
to get called with the payload encoded in the input character set (not even if 
it is called directly, since it is passed a message instance and so set_charset 
must already have been called on the message instance it is passed).

So it turns out that the if test is not needed after all.

--

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



[issue8617] Non-existent variables documented

2010-05-04 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

These are references to environment variables.  The markup marks them as such, 
but this does not translate into HTML in a visible way.  Without a text 
description it is also left to guesswork as to how they function. The 2.7 docs 
are even more confusing, adding 'getuserbase'.  Adding Tarek as nosy since he 
has been updating this doc most recently.

--
nosy: +r.david.murray, tarek
stage:  - needs patch
type:  - behavior
versions: +Python 2.7, Python 3.1, Python 3.2

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



[issue7472] email.encoders.encode_7or8bit(): typo iso-2202. iso-2022 is correct.

2010-05-04 Thread Shashwat Anand

Shashwat Anand anand.shash...@gmail.com added the comment:

I was getting a feel that the inner if-test is not being used in any case.  
Submitting the patch which removes the inner if test and adding a unittest.

--

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



[issue7472] email.encoders.encode_7or8bit(): typo iso-2202. iso-2022 is correct.

2010-05-04 Thread Shashwat Anand

Changes by Shashwat Anand anand.shash...@gmail.com:


Added file: http://bugs.python.org/file17215/encoders.patch

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



[issue8615] turtle.py - backport of 3.1 features

2010-05-04 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

Feature freeze begins at beta 1, therefore I'm rejecting this.

--
resolution:  - rejected
status: open - closed

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



  1   2   >