[issue1766304] improve xrange.__contains__

2010-06-03 Thread Tal Einat

Tal Einat  added the comment:

In my mind, the reason for this patch is that xrange/range can be thought of as 
a lazy list of integers. However without this patch, membership checking was 
done trivially instead of in a "smart/lazy" manner, which is unexpected for 
users. Finally, conditions such as "num in xrange(3, 1000, 5)" are not trivial 
to express correctly otherwise, and even more so for negative steps.

This patch is already implemented and accepted for 3.2, I just wish to 
back-port it to 2.7 which should be fairly straightforward.

I'll just have a patch ready by tomorrow, and hope that someone finds the time 
to review it and possibly commit it in time for rc1. I realize that this is a 
minor change at the last minute. I will certainly understand if the people 
responsible for preparing rc1 are too busy for this.

--
versions: +Python 2.7 -Python 3.2

___
Python tracker 

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



[issue8883] Proxy exception lookup fails on MacOS in urllib.

2010-06-03 Thread Yuriy Taraday

New submission from Yuriy Taraday :

I have straight IP in my proxy exception list like "192.168.0.2" without mask 
specification.

The proxy_bypass_macosx_sysconf function verifies each item in this list by 
regexp r"(\d+(?:\.\d+)*)(/\d+)?" that produces two groups: IP and mask. The 
mask can be None here (as in my case) and this None case isn't handled, so 
urllib crashes with "TypeError: 'NoneType' object is unsubscriptable".

I couldn't find specification of MacOS proxy exceptions list, so I don't know 
whether you can use just IP or prefix without mask specification. If you can, 
here is small patch that adds nesessary check and guesses mask if it is not 
specified. If you cannot, the last question mark should be removed from regex.

--
components: Library (Lib)
files: urllib.py.diff
keywords: patch
messages: 106933
nosy: yorik.sar
priority: normal
severity: normal
status: open
title: Proxy exception lookup fails on MacOS in urllib.
type: crash
versions: Python 2.6
Added file: http://bugs.python.org/file17526/urllib.py.diff

___
Python tracker 

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



[issue8884] Allow binding to local address in httplib / http.client

2010-06-03 Thread Gaz Davidson

New submission from Gaz Davidson :

The option to bind to a local IP address when creating an HTTP connection would 
be very useful for web testing tools like FunkLoad and webunit. 

For example in FunkLoad it would allow us to run tests with IP-based load 
balancing.

--
components: IO
messages: 106934
nosy: Gaz.Davidson
priority: normal
severity: normal
status: open
title: Allow binding to local address in httplib / http.client
type: feature request
versions: Python 2.7, Python 3.3

___
Python tracker 

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



[issue7724] setup.py ignores SDK root on OSX

2010-06-03 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

I've applied a new version of the patch in r81662.

I'll be monitoring the buildbot farm to ensure that any issues that might crop 
up get fixed ASAP.

--

___
Python tracker 

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



[issue8833] tarfile: broken hardlink handling and testcase.

2010-06-03 Thread Lars Gustäbel

Lars Gustäbel  added the comment:

Thank you very much for this valuable report. Fixed in r81663-81666.

--
resolution:  -> accepted
status: open -> closed
versions: +Python 2.6, Python 3.1, Python 3.2

___
Python tracker 

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



[issue3864] 26.rc1: test_signal issue on FreeBSD 6.3

2010-06-03 Thread Stefan Krah

Stefan Krah  added the comment:

On 2.6, the tests aren't skipped if test_support.verbose is 0.

David, if the fix looks good to you I can apply it.


test_itimer_virtual: timeout: likely cause: machine too slow or load too high.
test test_signal failed -- Traceback (most recent call last):
  File 
"/usr/home/db3l/buildarea/2.6.bolen-freebsd/build/Lib/test/test_signal.py", 
line 183, in test_main
self.fail(tb)
AssertionError: Traceback (most recent call last):
  File 
"/usr/home/db3l/buildarea/2.6.bolen-freebsd/build/Lib/test/test_signal.py", 
line 166, in test_main
self.run_test()
  File 
"/usr/home/db3l/buildarea/2.6.bolen-freebsd/build/Lib/test/test_signal.py", 
line 99, in run_test
self.assertTrue(self.a_called)
  File "/usr/home/db3l/buildarea/2.6.bolen-freebsd/build/Lib/unittest.py", line 
325, in failUnless
if not expr: raise self.failureException, msg
AssertionError

--
keywords: +patch
nosy: +skrah
resolution: fixed -> 
status: closed -> open
Added file: 
http://bugs.python.org/file17527/issue3864-skip-when-not-verbose.patch

___
Python tracker 

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



[issue8885] markerbase declaration errors aren't recoverable

2010-06-03 Thread Mark Nottingham

New submission from Mark Nottingham :

In markupbase.py's ParserBase.parse_declaration, an unexpected character is 
caught like this:

else:
self.error(
"unexpected %r char in declaration" % rawdata[j])

However, the position (j) isn't updated, which means that error() will be 
called again once it returns.

For example, this declaration:

http://www.w3.org/TR/html4/loose.dtd>

(which I think is generated by MS Office) will trigger this behaviour.

Two possible resolutions:

1) increment J and try the next character in this case

2) document that error() is not recoverable; i.e., it MUST raise an exception.

My preference is strongly for #1 (as HTML parsing should be forgiving, and 
HTMLParser is based upon markerbase).

--
components: Library (Lib)
messages: 106938
nosy: mnot
priority: normal
severity: normal
status: open
title: markerbase declaration errors aren't recoverable
type: behavior
versions: Python 2.6

___
Python tracker 

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



[issue7384] curses crash on FreeBSD

2010-06-03 Thread Stefan Krah

Stefan Krah  added the comment:

I think it would be nice to get this into 2.7. I don't expect buildbot
failures, since the 2.7 patch is essentially the same as the py3k version,
which has been tested extensively.

--
Added file: http://bugs.python.org/file17528/issue7384-5-trunk.patch

___
Python tracker 

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



[issue7384] curses crash on FreeBSD

2010-06-03 Thread Mark Dickinson

Mark Dickinson  added the comment:

> I think it would be nice to get this into 2.7.

Agreed.  I think you should go ahead and commit it.

--

___
Python tracker 

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



[issue8886] zipfile.ZipExtFile should be a context manager

2010-06-03 Thread Erik Carstensen

New submission from Erik Carstensen :

It's nice that ZipFile is a context manager in 2.7.  It would be nice and more 
consistent if the objects returned from ZipFile.open() were context managers 
too.

--
components: Library (Lib)
messages: 106941
nosy: sandberg
priority: normal
severity: normal
status: open
title: zipfile.ZipExtFile should be a context manager
type: feature request
versions: Python 2.7, Python 3.3

___
Python tracker 

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



[issue8887] “pydoc str” works but not “ pydoc str.translate”

2010-06-03 Thread Éric Araujo

New submission from Éric Araujo :

Inconsistent behavior:
pydoc3 str: works
pydoc3 str.translate: doesn’t
pydoc3 builtins.str: works
pydoc3 builtins.str.translate: doesn’t

I think pydoc3 str.translate should work. I’ll be able to try to write a patch 
in some weeks.

--
components: Library (Lib)
messages: 106942
nosy: merwok
priority: normal
severity: normal
status: open
title: “pydoc str” works but not “pydoc str.translate”
type: behavior
versions: Python 3.2

___
Python tracker 

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



[issue8888] Promote SafeConfigParser and warn about ConfigParser

2010-06-03 Thread Éric Araujo

New submission from Éric Araujo :

Problems like #8880 could be prevented with a deprecation notice for the 
ConfigParser class, in favor of SafeConfigParser. (Not sure if R. David Murray 
meant just a recommendation or a real deprecation.)

--
assignee: d...@python
components: Documentation
messages: 106943
nosy: d...@python, merwok, r.david.murray
priority: normal
severity: normal
status: open
title: Promote SafeConfigParser and warn about ConfigParser
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

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



[issue8880] ConfigParser.set does not convert non-string values

2010-06-03 Thread Éric Araujo

Éric Araujo  added the comment:

See #

--

___
Python tracker 

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



[issue8886] zipfile.ZipExtFile is a context manager, but that is not documented

2010-06-03 Thread Erik Carstensen

Erik Carstensen  added the comment:

Sorry, my mistake, ZipExtFile is indeed a context manager: I ran into the 
problem in 2.6, and checked whether it was fixed in 2.7; when quickly reading 
zipfile.py I saw that only ZipFile had context manager methods, I missed the 
BufferedIOBase inheritance. And when reading the tests I didn't see any 'with 
ZipFile.open(x) as y' expression.

Maybe it still makes sense to document and test this. Changing the title.

--
title: zipfile.ZipExtFile should be a context manager -> zipfile.ZipExtFile is 
a context manager, but that is not documented

___
Python tracker 

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



[issue8886] zipfile.ZipExtFile is a context manager, but that is not documented

2010-06-03 Thread Erik Carstensen

Erik Carstensen  added the comment:

Patch that makes the zipfile test consistently use with statements to handle 
the return value of ZipFile.open().

--
keywords: +patch
Added file: http://bugs.python.org/file17529/with-ZipExtFile-in-test.patch

___
Python tracker 

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



[issue8741] 2.7 regression in tarfile: IOError: link could not be created

2010-06-03 Thread Lars Gustäbel

Lars Gustäbel  added the comment:

I have just committed the fix. I hope that this code is now more robust. See 
r81667 (trunk) and r81670 (py3k).

Thank you very much for your report!

--
resolution:  -> accepted
stage:  -> committed/rejected
status: open -> closed
versions: +Python 3.2

___
Python tracker 

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



[issue7384] curses crash on FreeBSD

2010-06-03 Thread Stefan Krah

Stefan Krah  added the comment:

Mark, thanks. Committed in r81669; I'll keep an eye on the buildbots.

--

___
Python tracker 

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



[issue8862] curses.wrapper does not restore terminal if curses.getkey() gets KeyboardInterrupt

2010-06-03 Thread July Tikhonov

July Tikhonov  added the comment:

Patch added.

Calls PyErr_CheckSignals(). If nothing happens, raises _curses.error.

--
keywords: +patch
Added file: http://bugs.python.org/file17530/curses-getkey.patch

___
Python tracker 

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



[issue8880] ConfigParser.set does not convert non-string values

2010-06-03 Thread Edwin Pozharski

Edwin Pozharski  added the comment:

Thanks - gotta rtfm :)

On Wed, Jun 2, 2010 at 5:33 PM, R. David Murray wrote:

>
> R. David Murray  added the comment:
>
> Use SafeConfigParser instead, then you can't make the mistake of passing
> non-strings to set.
>
> We really should update the docs so that ConfigParser is doced only in a
> 'deprecated' section.  But that's a different issue.  (Care to open it,
> merwok? :)
>
> --
> nosy: +r.david.murray
> resolution:  -> wont fix
> stage:  -> committed/rejected
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--
Added file: http://bugs.python.org/file17531/unnamed

___
Python tracker 

___Thanks - gotta rtfm :)On Wed, Jun 2, 2010 at 
5:33 PM, R. David Murray rep...@bugs.python.org> 
wrote:

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

Use SafeConfigParser instead, then you can't make the mistake of passing 
non-strings to set.

We really should update the docs so that ConfigParser is doced only in a 
'deprecated' section.  But that's a different issue.  (Care to 
open it, merwok? :)

--
nosy: +r.david.murray
resolution:  -> wont fix
stage:  -> committed/rejected
status: open -> closed

___
Python tracker rep...@bugs.python.org>
http://bugs.python.org/issue8880>
___

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



[issue8883] Proxy exception lookup fails on MacOS in urllib.

2010-06-03 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

Patchs looks file, although the 'None' branch might be a bit too fancy. I 
haven't found a spec either, and therefore your code is probably the safest way 
to deduce a mask.

--
assignee:  -> ronaldoussoren
nosy: +ronaldoussoren

___
Python tracker 

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



[issue8883] Proxy exception lookup fails on MacOS in urllib.

2010-06-03 Thread Yuriy Taraday

Yuriy Taraday  added the comment:

The strange thing is that in both 2.7 and 3.1 branches there is no such code at 
all. Inernet Config is used there without mentioning any exceptions despite the 
fact that ic module is marked as deprecated and proxy bypass is real.

--

___
Python tracker 

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



[issue8883] Proxy exception lookup fails on MacOS in urllib.

2010-06-03 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

2.7 and 3.x use the SystemConfiguration framework (through the _scproxy 
extension)

--

___
Python tracker 

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



[issue8883] Proxy exception lookup fails on MacOS in urllib.

2010-06-03 Thread Yuriy Taraday

Yuriy Taraday  added the comment:

I'm completely lost 2.7 tree in svn.
My last post was about 3.1.2 release. As I understand, System Configuration 
framework is being used since 2.6.5 and 3.2.
So, this bug is about all this versions.

--
versions: +Python 2.7, Python 3.2

___
Python tracker 

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



[issue7724] setup.py ignores SDK root on OSX

2010-06-03 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

Ported to 3.2 in r81673.

--

___
Python tracker 

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



[issue2568] Seconds range in time unit

2010-06-03 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I am reopening this issue because the following note is still not entirely 
correct:

"""
The range really is 0 to 61; according to the Posix standard this accounts for 
leap seconds and the (very rare) double leap seconds. The time module may 
produce and does accept leap seconds since it is based on the Posix standard ...
""" - 
http://docs.python.org/library/datetime.html#strftime-and-strptime-behavior


First, the latest POSIX standard (IEEE Std 1003.1, 2004 Edition) defines 
seconds range as [0, 60]. 

http://www.opengroup.org/onlinepubs/009695399/basedefs/time.h.html

Second, AFAIK, the only way to produce tm structure with tm_sec = 60 using a 
POSIX function is to explicitly pass "60" to a "%S" field in strptime. Other 
functions that fill tm structure, such as localtime or gmtime will never 
produce tm_sec = 60.  This is important because in the current form the comment 
suggests that the common recipe of passing first six elements of 
time.struct_time() to datetime constructor is unsafe while it is only unsafe if 
the time information comes from a non-POSIX system.

Third, POSIX is not a relevant standard for Python.  I have not seen any 
statement of python compliance to any version of Posix.  The relevant standard, 
I believe is C89:

"""
 Python now must be compiled with C89 compilers (after 19 years!).
""" - http://docs.python.org/whatsnew/2.6.html

While strictly speaking this is not a compliance statement, at least it has 
Python and C89 in the same sentence. :-)

AFAIK, the C89 standard does allow double leap seconds.  It may also allow 
compliant systems to produce leap second times from localtime() or gmtime(), 
but I don't have access to the text at the moment.  If this is true, the only 
fix required is s/POSIX/C89/g.

--
assignee:  -> belopolsky
nosy: +mark.dickinson
resolution: fixed -> 
stage: patch review -> needs patch
status: closed -> open
versions: +Python 3.2, Python 3.3

___
Python tracker 

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



[issue4673] Distutils should provide an uninstall command

2010-06-03 Thread Éric Araujo

Changes by Éric Araujo :


--
components: +Distutils2 -Distutils
keywords: +gsoc
versions: +Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2 -Python 
3.3

___
Python tracker 

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



[issue2279] distutils sdist add_defaults does not add data_files

2010-06-03 Thread Éric Araujo

Changes by Éric Araujo :


--
resolution: accepted -> fixed
stage:  -> committed/rejected

___
Python tracker 

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



[issue5300] Distutils ignores file permissions

2010-06-03 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +merwok

___
Python tracker 

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



[issue7724] setup.py ignores SDK root on OSX

2010-06-03 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

Committed for 2.6 in r81674

--

___
Python tracker 

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



[issue6608] asctime causing python to crash

2010-06-03 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Here is a quote from the relevant CERT advisory (MSC33-C):

"""
This function is supposed to output a character string of 26 positions at most, 
including the terminating zero. If we count the length indicated by the format 
directives we arrive at 25. Taking into account the terminating zero, the array 
size of the string appears sufficient.

However, this implementation assumes that the values of the struct tm data in 
timeptr are within normal ranges, and does nothing to enforce this. If any of 
the values print more characters than expected, the sprintf() function may 
overflow the result array. For instance, if tm_year has the value 12345, then 
27 characters (including the terminating null character) are printed, resulting 
in a buffer overflow.

The asctime() function primarily exists for compatibility with older 
implementations. Also, the asctime() function does not support localized date 
and time formats. The POSIX standard developers decided to mark the asctime() 
function obsolescent even though they are in C99 because of the possibility of 
buffer overflow.

C99 also provides the strftime() function which can be used to avoid these 
problems.
""" 
https://www.securecoding.cert.org/confluence/display/seccode/MSC33-C.+Do+not+pass+invalid+data+to+the+asctime%28%29+function

(I am changing the stage back to "needs patch" because the current patch  is 
vulnerable to buffer overflow.)

I think it is best to leave the code as is and possibly add a warning in 
documentation that passing hand-crafted timetuple is unsafe on some systems and 
that locale aware strftime("%c", ..) is preferable to asctime.

--
stage: patch review -> needs patch

___
Python tracker 

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



[issue3864] 26.rc1: test_signal issue on FreeBSD 6.3

2010-06-03 Thread R. David Murray

R. David Murray  added the comment:

I can't believe I messed that up.  Yes, the patch looks fine, please apply.

--

___
Python tracker 

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



[issue5610] email feedparser.py CRLFLF bug: $ vs \Z

2010-06-03 Thread R. David Murray

R. David Murray  added the comment:

I've applied the NLCRE_eol part of the patch, and the test, in r81675.  Tony, 
can you think of a test case that would demonstrate the problem with the 
boundaryre?

--
stage:  -> unit test needed

___
Python tracker 

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



[issue3864] 26.rc1: test_signal issue on FreeBSD 6.3

2010-06-03 Thread Stefan Krah

Stefan Krah  added the comment:

Thanks for looking at the patch! Committed in r81676.

--
resolution:  -> accepted
status: open -> closed

___
Python tracker 

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



[issue8424] Test assumptions for test_itimer_virtual and test_itimer_prof

2010-06-03 Thread Stefan Krah

Stefan Krah  added the comment:

I can't find buildbot failures related to this any longer, so I'm closing
this one.

--
stage: needs patch -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue7724] setup.py ignores SDK root on OSX

2010-06-03 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

And for 3.1 in r81677.

--

___
Python tracker 

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



[issue4487] Add utf8 alias for email charsets

2010-06-03 Thread R. David Murray

R. David Murray  added the comment:

For various reasons the email module has a table of character sets.  What might 
be most effective would be for the email module to look a character set name up 
in the codecs module and find out the cannonical name of the character set, and 
then look that up in its table (ie: remove the aliases table from email 
completely, and instead depend on codecs to resolve the cannonical name).  
Unfortunately the codecs module does not recognize all of the aliases used by 
email, nor is there necessarily any guarantee that the two modules will agree 
on the proper cannonical name.

The attached patch instead uses the codecs module as a fallback if the charset 
name does not appear in the email package's ALIASES or CHARSETS tables.  It 
therefore makes both utf8 and utf_8 work, as well as all the other variants the 
codec module accepts.  The unit test just tests 'utf8', since if that one works 
all the others should too.

I'm tentatively reclassifying this as a bug rather than a feature request, 
since I think it is a reasonable expectation that email would support at least 
the same set of encoding names that the rest of Python does.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue4487] Add utf8 alias for email charsets

2010-06-03 Thread R. David Murray

Changes by R. David Murray :


Added file: http://bugs.python.org/file17532/email_accept_codec_aliases.patch

___
Python tracker 

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



[issue4487] Add utf8 alias for email charsets

2010-06-03 Thread R. David Murray

Changes by R. David Murray :


--
assignee:  -> r.david.murray
stage:  -> patch review
type: feature request -> behavior

___
Python tracker 

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



[issue4487] Add utf8 alias for email charsets

2010-06-03 Thread Éric Araujo

Éric Araujo  added the comment:

Idea: Import the aliases mapping from codecs and extend it with email-specific 
aliases. Alternate idea: Add email’s names to codecs.

Side note: “charset” stands for “character encoding”, not “character set”. See 


--
nosy: +merwok

___
Python tracker 

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



[issue1766304] improve xrange.__contains__

2010-06-03 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

2010/6/3 Tal Einat :
>
> Tal Einat  added the comment:
>
> In my mind, the reason for this patch is that xrange/range can be thought of 
> as a lazy list of integers. However without this patch, membership checking 
> was done trivially instead of in a "smart/lazy" manner, which is unexpected 
> for users. Finally, conditions such as "num in xrange(3, 1000, 5)" are not 
> trivial to express correctly otherwise, and even more so for negative steps.
>
> This patch is already implemented and accepted for 3.2, I just wish to 
> back-port it to 2.7 which should be fairly straightforward.
>
> I'll just have a patch ready by tomorrow, and hope that someone finds the 
> time to review it and possibly commit it in time for rc1. I realize that this 
> is a minor change at the last minute. I will certainly understand if the 
> people responsible for preparing rc1 are too busy for this.

xrange has behaved like this for such a long time that I don't see
what it buys us to commit the patch this late.

--

___
Python tracker 

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



[issue1766304] improve xrange.__contains__

2010-06-03 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
resolution:  -> accepted
status: open -> closed

___
Python tracker 

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



[issue8884] Allow binding to local address in http.client

2010-06-03 Thread Martin v . Löwis

Changes by Martin v. Löwis :


--
title: Allow binding to local address in httplib / http.client -> Allow binding 
to local address in http.client
versions: +Python 3.2 -Python 2.7, Python 3.3

___
Python tracker 

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



[issue8884] Allow binding to local address in http.client

2010-06-03 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Can you please elaborate? Why would binding be useful?

In any case, what's wrong with 2.7's source_address parameter?

--
nosy: +loewis

___
Python tracker 

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



[issue8884] Allow binding to local address in http.client

2010-06-03 Thread Gaz Davidson

Gaz Davidson  added the comment:

Oops, I didn't see that in the 2.7 docs, I'll make sure I RTFM in future!

source_address will do perfectly, sorry for wasting your time and thanks for 
the quick response.

Cheers

Gaz

--

___
Python tracker 

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



[issue8820] IDLE not launching correctly

2010-06-03 Thread Jeff Craig

Jeff Craig  added the comment:

I can confirm this behaviour and error. On Windows Server 2008 R2 64-bit.

--
nosy: +foxxtrot

___
Python tracker 

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



[issue8820] IDLE not launching correctly

2010-06-03 Thread Jeff Craig

Jeff Craig  added the comment:

Further information, this was an issue for me in 2.6.4, but with 2.6.5 it 
appears to no longer be an issue.

--

___
Python tracker 

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



[issue8884] Allow binding to local address in http.client

2010-06-03 Thread Martin v . Löwis

Changes by Martin v. Löwis :


--
resolution:  -> out of date
status: open -> closed

___
Python tracker 

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



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2010-06-03 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I am attaching the next installment of the datetime.timezone class 
implementation.

Here I add ``utc`` class attribute to timezone.  I decided to place it in class 
rather than module namespace because this seems to be more inline with how 
datetime module defines particular instances of its classes such as ``min``, 
``max`` and ``resolution``. I also feel that writing ``timezone.utc`` makes it 
clearer that its is an instance of ``timezone`` class while ``datetime.UTC`` or 
simply ``UTC`` is more ambiguous.

I also changed ``timezone`` constructor to interpret int or float offset as 
number of hours and accept arbitrary timedelta between timedelta(hours=-12) and 
timedelta(hours=12).  The rationale is that most common timezones have offsets 
at whole hours and less common but existing timezones use 1/2 or 1/4 hour 
offsets and thus can be specified as a binary float without any issue.

I've added tests and some preliminary documentation.

--
Added file: http://bugs.python.org/file17533/issue5094a.diff

___
Python tracker 

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



[issue8889] test_support.transient_internet fails on Freebsd because socket has no attribute EAI_NODATA

2010-06-03 Thread R. David Murray

New submission from R. David Murray :

test_support.transient_internet was modified to check for more errors, but one 
of them, socket.EAI_NODATA, is not supported by FreeBSD.  The attached patch 
rewrites transient_internet to only test EAI error codes that exist, and also 
improves the skip message.

--
components: Tests
files: transient_internet.patch
keywords: patch
messages: 106972
nosy: haypo, r.david.murray
priority: normal
severity: normal
status: open
title: test_support.transient_internet fails on Freebsd because socket has no 
attribute EAI_NODATA
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file17534/transient_internet.patch

___
Python tracker 

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



[issue8889] test_support.transient_internet fails on Freebsd because socket has no attribute EAI_NODATA

2010-06-03 Thread R. David Murray

Changes by R. David Murray :


--
assignee:  -> r.david.murray

___
Python tracker 

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



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2010-06-03 Thread Brett Cannon

Brett Cannon  added the comment:

I don't think people would get confused as to what datetime.utc was, but as you 
pointed out, Alexander, the module seems to like class attributes so 
timezone.utc is fine.

As for the float/int argument, I personally am wary of it. Since the timedelta 
constructor accepts hours as a keyword argument, I don't see the benefit of 
having to support both timedeltas and int/floats. And I can see someone messing 
up and putting in a float that is not perfectly representable and getting upset 
at odd behavior. I say keep it simple and just accept timedeltas for now. If 
there really is demand for accepting integers in the constructor than it can be 
added without backwards-compatibility issues. Better to keep the API small and 
expand later than make it too big to start and being burdened with extraneous 
API stuff.

--

___
Python tracker 

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



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2010-06-03 Thread Mark Dickinson

Mark Dickinson  added the comment:

> accept arbitrary timedelta between timedelta(hours=-12) and
> timedelta(hours=12)

Aren't there valid timezones that are offset by more than 12 hours from UTC?

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue8889] test_support.transient_internet fails on Freebsd because socket has no attribute EAI_NODATA

2010-06-03 Thread R. David Murray

R. David Murray  added the comment:

Modified patch based on feedback from Antoine Pitrou on #python-dev.

--
Added file: http://bugs.python.org/file17535/transient_internet.patch

___
Python tracker 

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



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2010-06-03 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

On Thu, Jun 3, 2010 at 3:19 PM, Mark Dickinson  wrote:
..
> Aren't there valid timezones that are offset by more than 12 hours from UTC?

I am not sure.   At this stage treat 12 as a placeholder for whatever
the relevant standard says.  I've seen suggestions that the range
should be (-24, 24) excluding ends
 and
[-14, 14] .

--

___
Python tracker 

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



[issue8889] test_support.transient_internet fails on Freebsd because socket has no attribute EAI_NODATA

2010-06-03 Thread R. David Murray

Changes by R. David Murray :


Removed file: http://bugs.python.org/file17535/transient_internet.patch

___
Python tracker 

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



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2010-06-03 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

On Thu, Jun 3, 2010 at 3:41 PM, Alexander Belopolsky
 wrote:
..
> I am not sure.   At this stage treat 12 as a placeholder for whatever
> the relevant standard says.

Believe it or not, at least one standard, RFC 2822, allows any offset
representable as HHMM: "the zone MUST be within the range -9959
through +9959" .

I am inclined to simply remove any range checking and allow arbitrary
timedelta as an offset.

--

___
Python tracker 

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



[issue8889] test_support.transient_internet fails on Freebsd because socket has no attribute EAI_NODATA

2010-06-03 Thread R. David Murray

R. David Murray  added the comment:

A somewhat more clever version.

--
Added file: http://bugs.python.org/file17536/transient_internet.patch

___
Python tracker 

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



[issue8889] test_support.transient_internet fails on Freebsd because socket has no attribute EAI_NODATA

2010-06-03 Thread R. David Murray

R. David Murray  added the comment:

Final version after more feedback.

--
Added file: http://bugs.python.org/file17537/transient_internet.patch

___
Python tracker 

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



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2010-06-03 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

On Thu, Jun 3, 2010 at 3:15 PM, Brett Cannon  wrote:
..
> As for the float/int argument, I personally am wary of it. Since the
> timedelta constructor accepts hours as a keyword argument, I don't
> see the benefit of having to support both timedeltas and int/floats.

To my taste, timedelta(hours=-5) is just too verbose.  It also forces
you to import timedelta in a module that may otherwise not need it.

> And I can see someone messing up and putting in a float that is not > 
> perfectly representable and getting upset at odd behavior.

Since timedelta accepts floats for hours, this argument does not
really hold.  Also, with timedelta correctly rounding to the nearest
microsecond, it is really hard to mess up with binary vs. decimal
representation.

> I say keep it simple and just accept timedeltas for now. If there
> really is demand for accepting integers in the constructor than it can > be 
> added without backwards-compatibility issues. Better to keep the > API small 
> and expand later than make it too big to start and being
> burdened with extraneous API stuff.
>

This a valid argument.  since it is easier to remove code than to add,
I'll keep int/float support in the patch while we are discussing the
design, but I am ready to remove it.

--

___
Python tracker 

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



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2010-06-03 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
assignee:  -> belopolsky

___
Python tracker 

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



[issue8889] test_support.transient_internet fails on Freebsd because socket has no attribute EAI_NODATA

2010-06-03 Thread R. David Murray

R. David Murray  added the comment:

Committed to trunk in r81678.  I'll wait until the trunk buildbots show the 
test_ssl and test_urllib2net error clear before back/forward porting.

--
stage:  -> commit review

___
Python tracker 

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



[issue8890] Module logging has dangerous examples

2010-06-03 Thread Henri Salo

New submission from Henri Salo :

Module logging has dangerous examples as one can see from: 
 15.6.1.1:

> import logging
> LOG_FILENAME = '/tmp/logging_example.out'
> logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG)
> logging.debug('This message should go to the log file')

It is not very wise to guide programmers to create programming mistakes. More 
information about the situation from: 
.

--
components: None
messages: 106982
nosy: Henri.Salo
priority: normal
severity: normal
status: open
title: Module logging has dangerous examples
type: security
versions: Python 2.6

___
Python tracker 

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



[issue8891] sort files before archiving for consistency

2010-06-03 Thread anatoly techtonik

New submission from anatoly techtonik :

I am troubleshooting local issue with distutils and UAC on Windows, and I need 
to compare resulting binary archives. Unfortunately files to bdist archives are 
added in random order and this complicates comparisons. This patch makes 
distutils archives more deterministic.

--
assignee: tarek
components: Distutils
files: sort_files_in_zip.26.patch
keywords: patch
messages: 106983
nosy: tarek, techtonik
priority: normal
severity: normal
status: open
title: sort files before archiving for consistency
versions: Python 2.6, Python 2.7
Added file: http://bugs.python.org/file17538/sort_files_in_zip.26.patch

___
Python tracker 

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



[issue8891] sort files before archiving for consistency

2010-06-03 Thread anatoly techtonik

Changes by anatoly techtonik :


Added file: http://bugs.python.org/file17539/sort_files_in_zip.27.patch

___
Python tracker 

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



[issue8891] sort files before archiving for consistency

2010-06-03 Thread Éric Araujo

Éric Araujo  added the comment:

This would be a new feature, so it can’t go into 2.6 unless I’m mistaken. It 
may even not go into 2.7.

Your renaming of z to zip does not add much value and shadows a builtin; I 
advise against doing that.

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

___
Python tracker 

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



[issue8890] Module logging has dangerous examples

2010-06-03 Thread Éric Araujo

Éric Araujo  added the comment:

Would you be kind enough to provide a doc patch that would advertise using the 
tempfile module?

--
assignee:  -> d...@python
components: +Documentation -None
nosy: +d...@python, merwok
versions: +Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

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



[issue8891] sort files before archiving for consistency

2010-06-03 Thread anatoly techtonik

anatoly techtonik  added the comment:

On Fri, Jun 4, 2010 at 12:32 AM, Éric Araujo  wrote:
>
> This would be a new feature, so it can’t go into 2.6 unless I’m mistaken. It 
> may even not go into 2.7.

It is not a feature, but a bugfix for wrong order of files in archive.
That means that on different filesystems you will get different
archives. I doubt that having files in random order is a feature.

> Your renaming of z to zip does not add much value and shadows a builtin; I 
> advise against doing that.

I've just copy-pasted the same block from Python 2.7, so the bug with
shadowing is already there.

--

___
Python tracker 

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



[issue8890] Module logging has dangerous examples

2010-06-03 Thread anatoly techtonik

anatoly techtonik  added the comment:

import logging
- LOG_FILENAME = '/tmp/logging_example.out'
+ LOG_FILENAME = 'example.log'
  logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG)
  logging.debug('This message should go to the log file')

--
nosy: +techtonik

___
Python tracker 

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



[issue8890] Module logging has dangerous examples

2010-06-03 Thread Éric Araujo

Éric Araujo  added the comment:

Nice, this example doesn’t require explaining tempfile and is shorter.
Add a notice before the code that you need to be in a directory with
write rights for this to work and I’m +1.

--

___
Python tracker 

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



[issue8891] sort files before archiving for consistency

2010-06-03 Thread Éric Araujo

Éric Araujo  added the comment:

> It is not a feature, but a bugfix for wrong order of files in archive.

That’s debatable. If the docs did advertise ordering and if it’s not a 
regression from an older version, it’s a new feature. I’m not saying I don’t 
like it, just clarifying Python’s process.

> I've just copy-pasted the same block from Python 2.7, so the bug with
> shadowing is already there.

I see in the log that Tarek has done this to respect PEP 8, which advocates 
using meaningful names. Not a big deal here.

FTR, this function has been moved to shutil, still with the zip shadowing and 
without the sorting.

I’ll shut up now and let Tarek and the release manager judge whether this is a 
bugfix or a new feature :)

--

___
Python tracker 

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



[issue8891] sort files before archiving for consistency

2010-06-03 Thread Éric Araujo

Éric Araujo  added the comment:

Sorry for writing when tired. Clearer first sentence: If it does not change the 
code to match the docs or to fix a regression from an older version, it’s a 
feature.

--

___
Python tracker 

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



[issue8892] 2to3 fails with assertion failure on "from itertools import *"

2010-06-03 Thread Dave Malcolm

New submission from Dave Malcolm :

fix_itertools_imports.py fails on a "*" import

2to3 fails on this code:
   from itertools import *

with a traceback:
  File 
"/home/david/coding/python-svn/trunk-2to3-issues/Lib/lib2to3/tests/test_fixers.py",
 line 3680, in test_star
self.warns_unchanged(s, "Cannot handle star imports")
  File 
"/home/david/coding/python-svn/trunk-2to3-issues/Lib/lib2to3/tests/test_fixers.py",
 line 49, in warns_unchanged
self.warns(before, before, message, unchanged=True)
  File 
"/home/david/coding/python-svn/trunk-2to3-issues/Lib/lib2to3/tests/test_fixers.py",
 line 43, in warns
tree = self._check(before, after)
  File 
"/home/david/coding/python-svn/trunk-2to3-issues/Lib/lib2to3/tests/test_fixers.py",
 line 32, in _check
tree = self.refactor.refactor_string(before, self.filename)
  File 
"/home/david/coding/python-svn/trunk-2to3-issues/Lib/lib2to3/refactor.py", line 
359, in refactor_string
self.refactor_tree(tree, name)
  File 
"/home/david/coding/python-svn/trunk-2to3-issues/Lib/lib2to3/refactor.py", line 
393, in refactor_tree
self.traverse_by(self.post_order_heads, tree.post_order())
  File 
"/home/david/coding/python-svn/trunk-2to3-issues/Lib/lib2to3/refactor.py", line 
417, in traverse_by
new = fixer.transform(node, results)
  File 
"/home/david/coding/python-svn/trunk-2to3-issues/Lib/lib2to3/fixes/fix_itertools_imports.py",
 line 24, in transform
assert child.type == syms.import_as_name
AssertionError

(seen when running 2to3 on python-lxml ; see problem in downstream tracker: 
https://bugzilla.redhat.com/show_bug.cgi?id=600036 )

--
components: 2to3 (2.x to 3.0 conversion tool)
messages: 106991
nosy: dmalcolm
priority: normal
severity: normal
status: open
title: 2to3 fails with assertion failure on "from itertools import *"
versions: Python 2.7

___
Python tracker 

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



[issue8892] 2to3 fails with assertion failure on "from itertools import *"

2010-06-03 Thread Dave Malcolm

Dave Malcolm  added the comment:

I'm attaching a reproducer for the test suite (though not a fix)

--
keywords: +patch
Added file: 
http://bugs.python.org/file17540/itertools_import_star_reproducer.patch

___
Python tracker 

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



[issue8882] socketmodule.c`getsockaddrarg() should not check the length of sun_path

2010-06-03 Thread Edward Pilatowicz

Edward Pilatowicz  added the comment:

so i wrote a simple test program that tells me the defined length of
sun_path and then uses bind() with increasingly long paths to determine
the actually supported length of sun_path.  here's what i've found:

Solaris:
defined sun_path = 108
max sun_path = 1024

FreeBSD 8.0:
defined sun_path = 104
max sun_path = 254

Fedora 11:
defined sun_path = 108
max sun_path = 108

i have requested access to an AIX system to check what length of
sun_path is defined and supported there.

while i could request that this value be changed in the OS, that would 
likely cause problems with pre-existing compiled code.  i'm guessing
that most OS vendors would not be eager to update this value, which is
probably why it's been the same small value for such a long time.

--

___
Python tracker 

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



[issue8890] Module logging has dangerous examples

2010-06-03 Thread Vinay Sajip

Vinay Sajip  added the comment:

Documenation fix checked into trunk (r81680).

--
assignee: d...@python -> vinay.sajip
nosy: +vinay.sajip
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue8890] Module logging has dangerous examples

2010-06-03 Thread Éric Araujo

Éric Araujo  added the comment:

Thanks Vinay. You miss a closing paren in your commit.

--

___
Python tracker 

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



[issue8885] markerbase declaration errors aren't recoverable

2010-06-03 Thread Mark Nottingham

Mark Nottingham  added the comment:

Just to be clear -- if error() returns, it will cause an infinite loop.

--

___
Python tracker 

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



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2010-06-03 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I am having second thoughts about dst indicator.  I wrote:
"""
2. Do we want to add a dst indicator and altname attributes? I would say: no. I 
would rather treat DST as a different fixed offset timezone.
"""

and Brett responded: 
"""
2. Keep the class dead-simple. The primary motivator is to support UTC, maybe 
the %z directive for strptime. Otherwise everything else should be left out of 
the stdlib and let third-parties manage it as they will be the ones that need 
to manage the bazillion timezone instances they need. We don't need to dictate 
an interface to them.
"""

Now note, that with fixed offset timezone class, it is possible to produce 
aware local times as follows:

from datetime import datetime, timezone, timedelta
import time
EPOCH = datetime(1970, 1, 1)
def localtime(utctime=None):
if utctime is None:
tm = time.localtime()
else:
seconds = (utctime - EPOCH).total_seconds()
tm = time.localtime(seconds)

tz = (timezone(timedelta(seconds=-time.altzone), time.tzname[1])
  if tm.tm_isdst else
  timezone(timedelta(seconds=-time.timezone), time.tzname[0]))
return datetime(*tm[:6], tzinfo=tz)

(see also attached localtime.py)

The problem with the above implementation is that t.timetuple().tm_isdst will 
always be 0 if t is produced by localtime().

I don't think adding fixed dst offset is much of complication.  We already need 
to override the tzinfo.dst method and if we only allow timedeltas as offset and 
dst arguments to constructor, the constructor code will be extremely simple.

--
Added file: http://bugs.python.org/file17541/localtime.py

___
Python tracker 

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



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2010-06-03 Thread Brett Cannon

Brett Cannon  added the comment:

So you want a third argument that lets you flag if the timezone is DST or not? 
I still don't think that will be necessary. If people want to add that they can 
very easily subclass the timezone class and add support for it. This class 
should be focused on providing a UTC instance and anything needed for a %z 
directive in strptime, nothing more. Anything fancier can be handled by 
libraries like pytz as they need it. Once again, keep the APi as simple as 
possible and add features as needed. I know how tempting it it is to design 
upfront, but just trust me, Alexander, we will all get burned for it later.

--

___
Python tracker 

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



[issue8893] file.{read,readlines} behaviour on Solaris

2010-06-03 Thread Christophe Kalt

New submission from Christophe Kalt :

The following snippet of code is a concise way to exhibit the problem:

import os

wr = open('/tmp/test', 'w')
wr.write('oink\noink\n')
rd = open('/tmp/test', 'r')
rdlns = open('/tmp/test', 'r')
# first, read til EOF is reached (which is right away)
assert len(rd.read()) == 0
assert len(rdlns.readlines()) == 0
# add data to the file
wr.flush()
# try to read again
print 'read : ', rd.read().split() # fails
print 'readlines: ', rdlns.readlines() # fails
print 'readline : ', rdlns.readline().strip() # succeeds
# cleanup
wr.close()
rd.close()
rdlns.close()
os.remove('/tmp/test')


On Linux, here is the output:
$ python2.6 src/readlines.py
read :  ['oink', 'oink']
readlines:  ['oink\n', 'oink\n']
readline :  

On Solaris, here is the output:
$ python src/readlines.py
read :  []
readlines:  []
readline :  oink

The problems comes from the fact that once EOF is reached, nothing more will be 
read from the file on subsequent reads, as noted in the manual page 
(http://docs.sun.com/app/docs/doc/816-5168/getchar-3c?a=view):

"If the stream is at end-of-file, the end-of-file indicator for the stream is 
set and these functions return EOF. For standard-conforming (see standards(5)) 
applications, if the end-of-file indicator for the stream is set, these 
functions return EOF whether or not the stream is at end-of-file."

The attached diff fixes the problem.

--
assignee: theller
components: ctypes
files: fileobject.diff
keywords: patch
messages: 106999
nosy: kalt, theller
priority: normal
severity: normal
status: open
title: file.{read,readlines} behaviour on Solaris
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file17542/fileobject.diff

___
Python tracker 

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



[issue7584] datetime.rfcformat() for Date and Time on the Internet

2010-06-03 Thread R. David Murray

R. David Murray  added the comment:

I just took a look at RFC 3339, and I see what you mean, Anatoly, about the 
meaning of -00:00.  But reading further:

   "While the Internet does have a tradition of accepting reality when creating 
specifications, this should not be done at the expense of interoperability.  
Since interpretation of an unqualified local time zone will fail in 
approximately 23/24 of the globe, the interoperability problems of unqualified 
local time are deemed unacceptable for the Internet."

It seems to me that we should not try to produce an RFC 3339 compliant date 
string from a naive datetime.  It will be practical to accept that restriction 
once issue 5094 is resolved.  Given this, I'd be OK with Z being the default.

--
dependencies: +datetime lacks concrete tzinfo impl. for UTC

___
Python tracker 

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



[issue8810] TZ offset description is unclear in docs

2010-06-03 Thread Sean Reifschneider

Sean Reifschneider  added the comment:

Committed to 2.7 in 81681 and 3.x in 81682.

--
keywords: +needs review -patch
resolution:  -> accepted
stage:  -> committed/rejected
status: open -> closed
type:  -> feature request

___
Python tracker 

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



[issue8810] TZ offset description is unclear in docs

2010-06-03 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

> In this case, the docs.python.org link you point to seems
> to be correct, saying that it returns a timedelta.

This issue is specifically about ReST documentation, not the docstring. I 
explained in the opening comment that 'It is later explained that in fact "the 
value returned must be a timedelta object specifying a whole number of 
minutes", but many users won't read past the first sentence.'  Ironically, you 
not noticing that reaffirms my proposition that "many users won't read past the 
first sentence." :-)

Also, the documentation for tzinfo.dst is similarly unclear with ReST text 
slightly better than docstring.

Finally, please use rN form for revisions in commit comments.  These are 
converted to hyperlinks by the tracker.  For example, your commit comment would 
become:

  Committed to 2.7 in r81681 and 3.x in r81682.

--
status: closed -> open

___
Python tracker 

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



[issue8810] TZ offset description is unclear in docs

2010-06-03 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
stage: committed/rejected -> needs patch

___
Python tracker 

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



[issue8810] TZ offset description is unclear in docs

2010-06-03 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
resolution: accepted -> 

___
Python tracker 

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



[issue8810] TZ offset description is unclear in docs

2010-06-03 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Sean,

It looks like you committed your first patch rather than your second.  Is that 
what you intended?

Also in msg106734, you agree to change "West" to "west", but committed "West."  
Note that "west" is correct.  In English, the West means the western part of 
the world while western direction is the west.

Pedantically, the UTC is not a location, so you cannot say "to the west of 
UTC".  Instead, you should say "to the west of the Greenwich Meridian."

Note how RFC 3339 defines the offset:

"""
   Numeric offsets are calculated as "local time minus UTC".  So the
   equivalent time in UTC can be determined by subtracting the offset
   from the local time.
"""

I think this is preferable because there are locations such as Spain to the 
west of Greenwich which use UTC+1.

--

___
Python tracker 

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



[issue3244] multipart/form-data encoding

2010-06-03 Thread Forest Bond

Forest Bond  added the comment:

Hi,

I believe the attached implementation is reasonable.  I'm not sure if it should 
be called "email.mime.formdata", "rfc2388", etc.

I'd be happy to attach a proper patch with tests given some quick feedback.

Thanks,
Forest

--
nosy: +forest_atq
Added file: http://bugs.python.org/file17543/rfc2388.py

___
Python tracker 

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



[issue3244] multipart/form-data encoding

2010-06-03 Thread Forest Bond

Forest Bond  added the comment:

Oh, hm, looks like I left a hard-coded name="files" in attach_file.  I'll fix 
that in the patch after I've received any other feedback.

--

___
Python tracker 

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



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2010-06-03 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

> So you want a third argument that lets you flag if the timezone is DST or not?

The third argument is not a flag, it is a timedelta just like the offset.  I am 
attaching a python prototype for clarity. (See datetimeex.py.)

Conceptually, a 3-argument timezone is very simple: tzinfo defines three 
abstract methods: utcoffset(..), tzname(..), and dts(..).  The proposed 
concrete implementation lets allows the user to provide constant values to be 
returned from each of these methods.

--
Added file: http://bugs.python.org/file17544/datetimeex.py

___
Python tracker 

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



[issue8893] file.{read,readlines} behaviour on Solaris

2010-06-03 Thread Éric Araujo

Éric Araujo  added the comment:

Thanks for your report. This is not related to ctypes, adjusting component and 
nosy (per Misc/maintainers.rst); also adding keyword. Can you reproduce it with 
3.1 and Subversion checkouts for trunk and py3k? Also, what’s the exact version 
of your OS?

--
assignee: theller -> 
components: +IO -ctypes
keywords: +needs review
nosy: +benjamin.peterson, merwok, pitrou -theller

___
Python tracker 

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



[issue5094] datetime lacks concrete tzinfo impl. for UTC

2010-06-03 Thread Brett Cannon

Brett Cannon  added the comment:

I'm still leary of supporting any form of DST. A proper DST implementation 
would need to have some conditional code to account for the datetime object 
passed into dst, and yet the version you have prototyped doesn't handle it. So 
a proper timezone supporting DST would still need to subclass any concrete 
class.

I still say keep it as simple as possible and let users subclass as needed to 
add DST support. Subclassing __init__ and dst() is not difficult if you want to 
add proper DST support, especially if dst() is set to return timdelta(0) and 
utcoffset() always returns CONSTANT + self.dst().

And just to mention it, the instance attributes you had in your example, 
Alexander, were not "private". For any final code, make sure you make them 
private else you are asking for trouble from people starting to rely on those 
attributes.

--

___
Python tracker 

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