[issue13680] Aifc comptype write fix

2011-12-30 Thread Oleg Plakhotnyuk

New submission from Oleg Plakhotnyuk :

Two changes have been made to the library:
1. Lowercase compression type support have been added to the sample width 
validation routine during write operation. Everywhere else compression types 
are used in both lowercase and uppercase.
2. Redundant invalid compression type check has been removed. It cannot be 
executed using public module interface, therefore I think it is not necessary.

--
components: Library (Lib), Tests
files: aifc_comptypes.patch
keywords: patch
messages: 150365
nosy: Oleg.Plakhotnyuk, ezio.melotti, r.david.murray
priority: normal
severity: normal
status: open
title: Aifc comptype write fix
type: behavior
versions: Python 3.2, Python 3.3
Added file: http://bugs.python.org/file24110/aifc_comptypes.patch

___
Python tracker 

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



[issue13394] Patch to increase aifc lib test coverage

2011-12-30 Thread Oleg Plakhotnyuk

Oleg Plakhotnyuk  added the comment:

Fourth patch goes to issue 13680

--

___
Python tracker 

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



[issue13676] sqlite3: Zero byte truncates string contents

2011-12-30 Thread Petri Lehtinen

Petri Lehtinen  added the comment:

What? Don't you SEE that it works correctly? :)

Attached an updated patch with a test case.

FTR, I also tried to make it possible to have the SQL statement include a zero 
byte, but it seems that sqlite3_prepare() (and also the newer 
sqlite3_prepare_v2()) always stops reading at the zero byte. See:

http://www.sqlite.org/c3ref/prepare.html

--
Added file: http://bugs.python.org/file24111/sqlite3_zero_byte_v2.patch

___
Python tracker 

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



[issue13674] crash in datetime.strftime

2011-12-30 Thread Tim Golden

Tim Golden  added the comment:

Well, the code in 2.x is quite different from that in 3.x.
Specifically, the 2.x code assumes that, for Windows, no
year before 1900 is valid for any of the formats. So a
simple check throws a ValueError for tm_year < 0. For 3.x
the assumption was that Windows can handle any year as far
back as 0; in fact that's not true for the %y format.

I'll propose a patch to timemodule.c but I'll have to take
it to python-dev as I'm not 100% sure of the best place for
it.

--

___
Python tracker 

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



[issue13674] crash in datetime.strftime

2011-12-30 Thread patrick vrijlandt

patrick vrijlandt  added the comment:

Somewhere in the code is also/still a seperate check concerning strftime:

PythonWin 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] on 
win32.
Portions Copyright 1994-2008 Mark Hammond - see 'Help/About PythonWin' for 
further copyright information.
>>> import datetime
>>> datetime.datetime(-1, 1, 1)
Traceback (most recent call last):
  File "", line 1, in 
ValueError: year is out of range
>>> datetime.datetime(0, 1, 1)
Traceback (most recent call last):
  File "", line 1, in 
ValueError: year is out of range
>>> datetime.datetime(1, 1, 1)
datetime.datetime(1, 1, 1, 0, 0)
>>> datetime.datetime(1, 1, 1).strftime("Y")
Traceback (most recent call last):
  File "", line 1, in 
ValueError: year=1 is before 1000; the datetime strftime() methods require year 
>= 1000
>>>

--

___
Python tracker 

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



[issue13679] Multiprocessing system crash

2011-12-30 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Well, have you read http://docs.python.org/library/multiprocessing.html#windows 
?
(especially "Safe importing of main module")

--
nosy: +pitrou

___
Python tracker 

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



[issue9260] A finer grained import lock

2011-12-30 Thread Charles-François Natali

Charles-François Natali  added the comment:

> That's true. Do you think temptatively acquiring the lock (without
> blocking) would solve the issue?

I think it should work. Something along those lines:

while True:
if lock.acquire(0):
lock.tstate = tstate
return True
else:
if detect_circularity():
return False
global_lock.release()
saved = save_tstate()
yield()
restore_tstate(saved)
global_lock.acquire()

However, I find this whole mechanism somewhat complicated, so the
question really is: what are we trying to solve?
If we just wan't to avoid deadlocks, a trylock with the global import
lock will do the trick.
If, on the other hand, we really want to reduce the number of cases
where a deadlock would occur by increasing the locking granularity,
then it's the way to go. But I'm not sure it's worth the extra
complexity (increasing the locking granularity is usually a proven
recipe to introduce deadlocks).

> Isn't this limit only about named semaphores? Or does it apply to
> anonymous semaphores as well?

I'm no FreeBSD expert, but AFAICT, POSIX SEM_NSEMS_MAX limit doesn't
seem to make a distinction between named and anonymous semaphores.
>From POSIX sem_init() man page:
"""
[ENOSPC]
A resource required to initialise the semaphore has been exhausted, or
the limit on semaphores (SEM_NSEMS_MAX) has been reached.
"""

Also, a quick search returned those links:
http://ftp.es.freebsd.org/pub/FreeBSD/development/FreeBSD-CVS/src/sys/sys/ksem.h,v
http://translate.google.fr/translate?hl=fr&sl=ru&tl=en&u=http%3A%2F%2Fforum.nginx.org%2Fread.php%3F21%2C202865%2C202865
So it seems that sem_init() can fail when the max number of semaphores
is reached.

--

___
Python tracker 

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



[issue13674] crash in datetime.strftime

2011-12-30 Thread Tim Golden

Tim Golden  added the comment:

Yes, sorry. I wasn't clear enough. There *are* still checks
in the 3.x code (for the kind of thing you're showing). But
the checks assume 1000 <= year <= maxint is ok for all format
parameters on Windows. In fact, for %y, only 1900 <= year is ok.

--

___
Python tracker 

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



[issue13681] Aifc read compressed frames fix

2011-12-30 Thread Oleg Plakhotnyuk

New submission from Oleg Plakhotnyuk :

This patch resolves two issues:

1. ADPCM compressed audio files reading. Such files have frame size of 4 bits. 
Aifc lib cannot represent 4 bits frame size because it uses integer bytes count 
variable. I have replaced it with bits count.

2. ALAW/ULAW/ADPCM audio data decompression. According to documentation 
(http://docs.python.org/library/audioop.html), adpcm2lin, alaw2lin and ulaw2lin 
are using 'width' argument to represent output frames width. However, in 
audioop.c module there are checks that are raising exceptions if input frames 
length is not multiple of 'width'. I have replaced checking of 'len' to match 
'size' with checking of 'len*size' to match 'size' in order to retain only 
basic length validity checks.

--
components: Library (Lib), Tests
files: aifc_compression.patch
keywords: patch
messages: 150373
nosy: Oleg.Plakhotnyuk, ezio.melotti, r.david.murray
priority: normal
severity: normal
status: open
title: Aifc read compressed frames fix
type: behavior
versions: Python 3.2, Python 3.3
Added file: http://bugs.python.org/file24112/aifc_compression.patch

___
Python tracker 

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



[issue13681] Aifc read compressed frames fix

2011-12-30 Thread Oleg Plakhotnyuk

Oleg Plakhotnyuk  added the comment:

I have put changes to both aifc and audioop module in this single patch. The 
reason is that aifc test reading compressed frames will work properly only 
after audioop fix has been applied.

--

___
Python tracker 

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



[issue13394] Patch to increase aifc lib test coverage

2011-12-30 Thread Oleg Plakhotnyuk

Oleg Plakhotnyuk  added the comment:

The last, fifth, patch goes to issue 13681

--

___
Python tracker 

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



[issue13682] Documentation of os.fdopen() refers to non-existing bufsize argument of builtin open()

2011-12-30 Thread Petri Lehtinen

New submission from Petri Lehtinen :

>From the docs of os.fdopen():

Return an open file object connected to the file descriptor fd. The
mode and bufsize arguments have the same meaning as the corresponding
arguments to the built-in open() function.

However, there's no bufsize argument for builtin open() anymore in py3k.

--
assignee: docs@python
components: Documentation
messages: 150376
nosy: docs@python, petri.lehtinen
priority: normal
severity: normal
status: open
title: Documentation of os.fdopen() refers to non-existing bufsize argument of 
builtin 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



[issue9260] A finer grained import lock

2011-12-30 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> If, on the other hand, we really want to reduce the number of cases
> where a deadlock would occur by increasing the locking granularity,
> then it's the way to go.

Yes, that's the point. Today you have to be careful when mixing imports
and threads. The problems is that imports can be implicit, inside a
library call for example (and putting imports inside functions is a way
of avoiding circular imports, or can also allow to reduce startup time).
Some C functions try to circumvent the problem by calling
PyImport_ModuleNoBlock, which is ugly and fragile in its own way (it
will fail if the import lock is taken, even if there wouldn't be a
deadlock: a very primitive kind of deadlock avoidance indeed).

> Also, a quick search returned those links:
> http://ftp.es.freebsd.org/pub/FreeBSD/development/FreeBSD-CVS/src/sys/sys/ksem.h,v
> http://translate.google.fr/translate?hl=fr&sl=ru&tl=en&u=http%3A%2F%2Fforum.nginx.org%2Fread.php%3F21%2C202865%2C202865
> So it seems that sem_init() can fail when the max number of semaphores
> is reached.

As they say, "Kritirii choice of the number 30 in the XXI century is
unclear." :-)

File objects also have a per-object lock, so I guess opening 30 files
under FreeBSD would fail. Perhaps we need to fallback on the other lock
implementation on certain platforms?

(our FreeBSD 8.2 buildbot looks pretty much stable, was the number of
semaphores tweaked on it?)

--

___
Python tracker 

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



[issue13642] urllib incorrectly quotes username and password in https basic auth

2011-12-30 Thread Michele Orrù

Michele Orrù  added the comment:

> Joonas, this issue seems easy to solve. Do you want to try to post a 
> patch?. Extra credits for patching testsuite too :).
As far as I see, it would be sufficient to add unquote(passed) to 
_open_generic_http. Regarding unittests instead, there is already a method 
called test_userpass_inurl which could be extended with some tests on a 
password containing spaces ( Lib/test/test_urllib.py:263). But what I haven't 
yet understood is: does it really exists a user:pass in python.org?

--
nosy: +maker

___
Python tracker 

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



[issue11812] transient socket failure to connect to 'localhost'

2011-12-30 Thread Charles-François Natali

Charles-François Natali  added the comment:

Seems to be fixed now.

--
resolution:  -> fixed
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



[issue13663] pootle.python.org is outdated.

2011-12-30 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

I'd rather have you maintain poodle.python.org instead of maintaining Python 
translations off-site.

--

___
Python tracker 

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



[issue8623] Aliasing warnings in socketmodule.c

2011-12-30 Thread Charles-François Natali

Charles-François Natali  added the comment:

> This change probably should be backported to 3.2 branch.

I'm not sure about this, I don't feel comfortable backporting a such
path which doesn't solve a "real world problem".

--

___
Python tracker 

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



[issue13683] Docs in Python 3:raise statement mistake

2011-12-30 Thread maniram maniram

New submission from maniram maniram :

In the Python 3 docs for the raise statement, 
http://docs.python.org/py3k/reference/simple_stmts.html#the-raise-statement,the 
docs say "If no exception is active in the current scope, a TypeError exception 
is raised indicating that this is an error (if running under IDLE, a 
queue.Empty exception is raised instead).

This is wrong in Python 3 because raise raises a RuntimeError and IDLE does the 
same (does not raise a queue.Empty Exception).

The text should be "If no exception is active in the current scope, a 
RuntimeError exception is raised indicating that this is an error."

--
assignee: docs@python
components: Documentation
messages: 150382
nosy: docs@python, maniram.maniram
priority: normal
severity: normal
status: open
title: Docs in Python 3:raise statement mistake
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



[issue13684] httplib tunnel infinite loop

2011-12-30 Thread luzakiru

New submission from luzakiru :

readline() can return ''. This is handled in most places in httplib but not 
when a tunnel is used. It leads to a infinite loop that permanently blocks the 
program while wasting CPU cycles.

For the patch I simply copied the fix that is used elsewhere in the file where 
readline() is used. It can be fixed in the same way in 2.6.

--
components: Library (Lib)
files: httplib.patch
keywords: patch
messages: 150383
nosy: luzakiru
priority: normal
severity: normal
status: open
title: httplib tunnel infinite loop
type: crash
versions: Python 2.6, Python 2.7
Added file: http://bugs.python.org/file24113/httplib.patch

___
Python tracker 

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



[issue13679] Multiprocessing system crash

2011-12-30 Thread Rock Achu

Rock Achu  added the comment:

Erm.. No. I was unaware I had to do so.
Next time I'll be more careful.

Anyways, the docs say that python should throw a RuntimeError, but it didn't?
And would it be doable to add a warning at the top of the multiprocessing 
tutorial/page that section?

--

___
Python tracker 

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



[issue9260] A finer grained import lock

2011-12-30 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I believe this new patch should be much more robust than the previous one.
It also adds a test for the improvement (it freezes an unpatched interpreter).

--
Added file: http://bugs.python.org/file24114/implock5.patch

___
Python tracker 

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



[issue13679] Multiprocessing system crash

2011-12-30 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Anyways, the docs say that python should throw a RuntimeError, but it
> didn't?

I think running it directly would raise a RuntimeError, but importing it 
wouldn't.

> And would it be doable to add a warning at the top of the
> multiprocessing tutorial/page that section?

In the introduction you have the following note, together with a link to the 
relevant section:

“Functionality within this package requires that the __main__ module be 
importable by the children. This is covered in Programming guidelines however 
it is worth pointing out here.”

--

___
Python tracker 

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



[issue13679] Multiprocessing system crash

2011-12-30 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Ok, closing this issue.

--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue12641] Remove -mno-cygwin from distutils

2011-12-30 Thread Reuben Garrett

Changes by Reuben Garrett :


--
nosy: +RubyTuesdayDONO

___
Python tracker 

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



[issue13609] Add "os.get_terminal_size()" function

2011-12-30 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

(review posted on http://bugs.python.org/review/13609/show )

--

___
Python tracker 

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



[issue13684] httplib tunnel infinite loop

2011-12-30 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +orsenthil
stage:  -> patch review
versions: +Python 3.2, Python 3.3 -Python 2.6

___
Python tracker 

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



[issue13676] sqlite3: Zero byte truncates string contents

2011-12-30 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

It would be nice to also have tests for the bytes and bytearray cases.
It also seems the generic case hasn't been fixed 
("""PyObject_CallFunction(self->connection->text_factory, "y", val_str)""").

--

___
Python tracker 

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



[issue13645] import machinery vulnerable to timestamp collisions

2011-12-30 Thread Brett Cannon

Brett Cannon  added the comment:

Why change importlib's API and instead add to it? You could add the requisite 
path_size() method to get the value, and assume 0 means unsupported (at least 
until some future version where a deprecation warning about not requiring file 
size comes about). But I don't see how you can get around not exposing these 
details as stored in some API, whether it is by method or object attribute 
since you can't assume stat results since support for non-file storage 
back-ends would be unduly burdened.

--

___
Python tracker 

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



[issue13641] decoding functions in the base64 module could accept unicode strings

2011-12-30 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo

___
Python tracker 

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



[issue13508] ctypes' find_library breaks with ARM ABIs

2011-12-30 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +belopolsky

___
Python tracker 

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



[issue13508] ctypes' find_library breaks with ARM ABIs

2011-12-30 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo

___
Python tracker 

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



[issue12760] Add create mode to open()

2011-12-30 Thread Éric Araujo

Éric Araujo  added the comment:

> This is not a "duplicate issue". The openat solution is no easier than the 
> os.open
> solution.

Amaury did not suggest to use openat, but the new opener argument to open, 
which was especially added for use cases such as the one discussed here:

...
open_exclusive = lambda path, mode: os.open(path, 
mode|os.O_CREAT|os.O_EXCL))
...
fp = open(filename, 'w', opener=open_exclusive)
...

That’s why this bug was initially closed as duplicate.

--

___
Python tracker 

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



[issue13659] Add a help() viewer for IDLE's Shell.

2011-12-30 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I should like it if a separate window were either automatic or a configuration 
option for help on modules and classes, which should cover 'long' output.  The 
Windows workaround, which I will never remember, brings up an extraneous 
cmd.exe window in addition to notepad.

--
nosy: +terry.reedy
versions: +Python 3.3

___
Python tracker 

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



[issue13656] Document ctypes.util and ctypes.wintypes.

2011-12-30 Thread Éric Araujo

Éric Araujo  added the comment:

May I ask why you closed this?  From a quick glance, a few functions from 
ctypes.util are considered public and documented (albeit not with module 
directives, so I’m not sure the indexing works helpfully for people searching); 
I don’t know the status of wintypes.

--
nosy: +eric.araujo

___
Python tracker 

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



[issue13664] UnicodeEncodeError in gzip when filename contains non-ascii

2011-12-30 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

The actual fix in the previous issue, as in Python 3, was to always write the 
filename, but with errors replaced with '?/.

--
nosy: +lars.gustaebel, terry.reedy

___
Python tracker 

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



[issue13665] TypeError: string or integer address expected instead of str instance

2011-12-30 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +amaury.forgeotdarc, meador.inge

___
Python tracker 

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



[issue13655] Python SSL stack doesn't have a default CA Store

2011-12-30 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo, loewis
versions:  -Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.4

___
Python tracker 

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



[issue13655] Python SSL stack doesn't have a default CA Store

2011-12-30 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +pitrou

___
Python tracker 

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



[issue13666] datetime documentation typos

2011-12-30 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

2.6 only gets security updates.

I verified 'rzinfo' typo in x.1.6 in 2.7 and 3.2. Also in both, 
tzinfo.utcoffset begins as Stephen claims. I have not verified that this is 
error.

 Also in both, in x.1.4, class GMT1 has
... def utcoffset(self, dt):
... return timedelta(hours=1) + self.dst(dt)
... def dst(self, dt):
... if self.dston <=  dt.replace(tzinfo=None) < self.dstoff:
... return timedelta(hours=1)
... else:
... return timedelta(0)

while GMT2 has
... def utcoffset(self, dt):
... return timedelta(hours=1) + self.dst(dt)
... def dst(self, dt):
... if self.dston <=  dt.replace(tzinfo=None) < self.dstoff:
... return timedelta(hours=2)
... else:
... return timedelta(0)

Stephen is saying that 'hours=1' should here be 'hours=2'. Should '0' by 
'hours=1' to be just 1 off from 2?

--
nosy: +belopolsky, terry.reedy
stage:  -> needs patch
versions: +Python 2.7, Python 3.2, Python 3.3 -Python 2.6

___
Python tracker 

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



[issue8035] urllib.request.urlretrieve hangs waiting for connection close after a redirect

2011-12-30 Thread Éric Araujo

Éric Araujo  added the comment:

> It could be possible to set up an ad-hoc httpserver for that purpose,
> but that sounds a bit overkill.

Oh, I assumed urllib already had a server for tests.  We have one in 
distutils2/packaging, otherwise we’d have to resort to manual testing against 
the real PyPI, and I’d feel much less confident about regressions.

--
versions:  -Python 3.1

___
Python tracker 

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



[issue13443] wrong links and examples in the functional HOWTO

2011-12-30 Thread Éric Araujo

Éric Araujo  added the comment:

Hi Senthil.  I think you applied a patch that did not have consensus.

--

___
Python tracker 

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



[issue13294] http.server: minor code style changes.

2011-12-30 Thread Éric Araujo

Éric Araujo  added the comment:

Just a note: “Incorporated Michele Orrù's code style changes into the trunk and 
other codelines.”

The policy is to apply only bug fixes and doc fixes and improvements to stable 
branches, not code cleanups (they’re usually compatible but are just not worth 
doing—at one point code is released and should stop being improved).  This is 
not worth reverting now, unless the commit was buggy (I didn’t read all 
messages), I just wanted to restate the policy to avoid such future code 
cleanups in bugfix branches.  Cheers

--

___
Python tracker 

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



[issue13443] wrong links and examples in the functional HOWTO

2011-12-30 Thread Éric Araujo

Éric Araujo  added the comment:

Hm, it was actually Antoine who removed it.

--

___
Python tracker 

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



[issue13614] setup.py register fails if long_description contains ReST

2011-12-30 Thread Éric Araujo

Changes by Éric Araujo :


--
assignee: tarek -> eric.araujo
components: +Distutils2
keywords: +easy
nosy: +alexis
stage:  -> test needed
title: `setup.py register` fails if long_description contains RST -> setup.py 
register fails if long_description contains ReST
type:  -> behavior
versions: +3rd party, 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



[issue13677] correct docstring for builtin compile

2011-12-30 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Flags comment applies to 3.2.2 docs and 2.7.2 docs. There is only one 
additional flag: ast.PyCF_ONLY_AST, so 'flags' should be singular.

As for src and dst, doc has been updated to say 'Compile the source into a code 
or AST object. ... source can either be a string or an AST object.

'source' should be capitalized.

--
nosy: +terry.reedy
versions: +Python 2.7, 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



[issue13683] Docs in Python 3:raise statement mistake

2011-12-30 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Verified for 3.2.2 cmd window and idle. Fix looks good.

--
keywords: +patch
nosy: +terry.reedy
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.3

___
Python tracker 

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



[issue12760] Add create mode to open()

2011-12-30 Thread Devin Jeanpierre

Devin Jeanpierre  added the comment:

> Amaury did not suggest to use openat, but the new opener argument to open, 
> which was especially added for use cases such as the one discussed here:

Sorry, yes. Wrong words, same thought. We can implement this using opener, but 
we could implement this with os.open before. What's changed, except that 
there's more ways to do it? (There is slightly more versatility with the opener 
method, but no more obviousness and no less typing).

My understanding from reading the other thread is that this is not the primary 
use-case of the new parameter for open(). In fact, this ticket was not really 
mentioned at all there.

--

___
Python tracker 

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



[issue13684] httplib tunnel infinite loop

2011-12-30 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

In 3.2, http.client.py, insertion would be at line 718.
However, only one statement is needed to break. 3.2 elsewhere has
if line in (b'\r\n', b'\n', b''):
break
But I note that at 512, there is the code luzakiru patched in. I think that 
should perhaps be changed to above also, unless bare \n from reading a server 
is really impossible.

At 313, i found this misformed code:

 if not line:
# Presumably, the server closed the connection before
# sending a valid response.
 raise BadStatusLine(line)

[I am curious -- is it really intended to simply throw away the tunnel server 
response after the first header?]

--
nosy: +terry.reedy

___
Python tracker 

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



[issue13685] argparse does not sanitize help strings for % signs

2011-12-30 Thread Jeff Yurkiw

New submission from Jeff Yurkiw :

I discovered this while programming the command line interface for a python 
program that can take a passed argument and throw it into the 'where like' 
clause of a SQL expression (intended for a postgresql database).

The wildcard character for where-like statements is generally the percent sign, 
which is how I found this ("WHERE %s LIKE '%--value%')".

If you use any single '%' signs in an ArgumentParser.new_argument(help=)'s help 
description Python 3.2 will throw an error.

Workaround: You can avoid this issue by doubling up on all % signs that you 
want to display in your help text.

parser.add_argument(('--foo', action='store',help='%bar') throws an error.
parser.add_argument(('--foo', action='store',help='%%bar') displays '--foo FOO  
 %bar'.

Suggested fix:
When assigning help strings from add_argument(), throw them through a sanitizer 
and replace all occurrences of '%' with '%%' behind the scenes.

Example code (argparseBug.py):

from argparse import ArgumentParser

parser = ArgumentParser()
parser.add_argument('--foo', action='store', help='%bar')

args = parser.parse_args('-h'.split())

You get the following stacktrace:
Traceback (most recent call last):
  File "/path/to/script/argparseBug.py", line 6, in 
args = parser.parse_args('-h'.split())
  File "/usr/lib/python3.2/argparse.py", line 1701, in parse_args
args, argv = self.parse_known_args(args, namespace)
  File "/usr/lib/python3.2/argparse.py", line 1733, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib/python3.2/argparse.py", line 1939, in _parse_known_args
start_index = consume_optional(start_index)
  File "/usr/lib/python3.2/argparse.py", line 1879, in consume_optional
take_action(action, args, option_string)
  File "/usr/lib/python3.2/argparse.py", line 1807, in take_action
action(self, namespace, argument_values, option_string)
  File "/usr/lib/python3.2/argparse.py", line 994, in __call__
parser.print_help()
  File "/usr/lib/python3.2/argparse.py", line 2331, in print_help
self._print_message(self.format_help(), file)
  File "/usr/lib/python3.2/argparse.py", line 2305, in format_help
return formatter.format_help()
  File "/usr/lib/python3.2/argparse.py", line 279, in format_help
help = self._root_section.format_help()
  File "/usr/lib/python3.2/argparse.py", line 209, in format_help
func(*args)
  File "/usr/lib/python3.2/argparse.py", line 209, in format_help
func(*args)
  File "/usr/lib/python3.2/argparse.py", line 515, in _format_action
help_text = self._expand_help(action)
  File "/usr/lib/python3.2/argparse.py", line 601, in _expand_help
return self._get_help_string(action) % params
ValueError: unsupported format character 'b' (0x62) at index 1

--
components: None
files: argparseBug.py
messages: 150404
nosy: Jeff.Yurkiw
priority: normal
severity: normal
status: open
title: argparse does not sanitize help strings for % signs
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file24115/argparseBug.py

___
Python tracker 

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



[issue13685] argparse does not sanitize help strings for % signs

2011-12-30 Thread Eric V. Smith

Eric V. Smith  added the comment:

This is because the help text support substitution, as mentioned here: 
http://docs.python.org/dev/library/argparse.html#help

It's possible this documentation could be improved.

--
assignee:  -> docs@python
components: +Documentation -None
nosy: +docs@python, eric.smith

___
Python tracker 

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



[issue12760] Add create mode to open()

2011-12-30 Thread Éric Araujo

Éric Araujo  added the comment:

> [...] There is slightly more versatility with the opener method, but no more 
> obviousness
> and no less typing.

I agree with your opinion.  I re-read this report:
- Antoine thinks this fills an important use case, namely avoiding race 
conditions
- Amaury then suggested the opener argument idea, which was implemented in the 
openat bug
- Antoine judged it would be better than what we had before

I don’t have a strong opinion on “opener is generic and good enough” vs. “not 
as ice as it could be”.  Antoine seems to agree with you, so your patch will 
get reviewed and eventually accepted.  Cheers

--

___
Python tracker 

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



[issue13677] correct docstring for builtin compile

2011-12-30 Thread Jim Jewett

Jim Jewett  added the comment:

I'm not sure we're looking at the same thing.  I was talking about the 
docstring that shows up at the interactive prompt in response to 
>>> help(compile)

Going to hg.python.org/cpython and selecting branches, then default, then 
browse, got me to
http://hg.python.org/cpython/file/7010fa9bd190/Python/bltinmodule.c
which still doesn't mention AST.  I also don't see any reference to "src" or 
"dst", or any "source" that looks like it should be capitalized.

I agree that there is (to my knowledge, at this time) only one additional flag. 
 I figured ast or future was needed to get the compilation constants, so it 
made sense to delegate -- but you seem to be reading something newer than I am.

--

___
Python tracker 

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



[issue13590] Prebuilt python-2.7.2 binaries for macosx can not compile c extensions

2011-12-30 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo

___
Python tracker 

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



[issue13640] add mimetype for application/vnd.apple.mpegurl

2011-12-30 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo
stage:  -> patch review
type: behavior -> enhancement
versions:  -Python 2.7, Python 3.1, Python 3.2, Python 3.4

___
Python tracker 

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



[issue13677] correct docstring for builtin compile

2011-12-30 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I am aware that the docstring, shown at help(compile), is what you were talking 
about. The docstring and manuals should say the same thing, or at least not 
contradict each other, so it is common for both to be out of date and both to 
be updated at the same time. So I went and looked at the current py2 and py3 
docs to see if they also need change. And they do, though not quite as much. 
src and dst were unofficial abbreviations for source and output, in reference 
to what you said. Sorry for the confusion.

--

___
Python tracker 

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



[issue13686] Some notes on the docs of multiprocessing

2011-12-30 Thread Eli Bendersky

New submission from Eli Bendersky :

I've decided to study the multiprocessing module a bit, and carefully went over 
the docs (for 2.7). Some small fixes I will commit myself, but a few issues 
came up on which I'd like some opinion from others. In rough order of 
appearance in the doc:

1. In the documentation of the 'name' argument of the multiprocessing.Process 
constructor, it mentions that the length of the generated name depends on the 
"generation", without elaborating. It could be better to briefly describe the 
algorithm in a sentence or two.
2. Section 16.6.2.1. is called "Process and exceptions". It only documents one 
exception from multiprocessing: BufferTooShort. Other exception classes 
exported by the module aren't documented similarly: ProcessError, TiemoutError, 
AuthenticationError.
3. AuthenticationError is documented as 
multiprocessing.connection.AuthenticationError, although in reality it exists 
in the root multiprocessing module, and multiprocessing.connection just imports 
it
4. The doc of JoinableQueue.task_done() says "Used by queue consumer threads". 
Shouldn't that be "consumer processes"?
5. The doc of active_children() should probably mention that it returns a list 
of Process objects (similarly to what current_process() says)
6. multiprocessing.freeze_support() says "If the freeze_support() line is 
omitted then trying to run the frozen executable will raise RuntimeError.". 
*Who* will raise the error?
7. class multiprocessing.Event says "This method returns..." - what method? 
Seems like an irrelevant documentation piece was intermixed here
8. 16.6.2.7. Managers starts by saying that Managers provide a way to create 
data which can be shared between different processes. Since it comes right 
after the section about Shared objects, I think it would be nice to mention in 
a sentence or two what Managers give above normal synchonized objects in 
multiprocessing (i.e. sharing between different machines)
9. In the programming guidelines about "Avoid shared state" it says "It is 
probably best to stick to using queues or pipes for communication between 
processes rather than using the lower level synchronization primitives from the 
threading module.". Surely not the "threading" module is meant here?

--
assignee: docs@python
components: Documentation
messages: 150409
nosy: docs@python, eli.bendersky, pitrou
priority: normal
severity: normal
status: open
title: Some notes on the docs of multiprocessing
type: behavior
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



[issue13687] parse incorrect command line on windows 7

2011-12-30 Thread baleno

New submission from baleno :

i just tested python2.7.2 and python 3.2.2 on windows 7,this bugs at all 
version.

my test code:
import sys
print(sys.argv)

command line:
test.py "%cc%cd%bd"

command result:
['E:\\Codes\\test.py', '%ccE:\\Codesbd']

--
components: None
files: error.png
messages: 150410
nosy: balenocui
priority: normal
severity: normal
status: open
title: parse incorrect command line on windows 7
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file24116/error.png

___
Python tracker 

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



[issue13686] Some notes on the docs of multiprocessing

2011-12-30 Thread Eli Bendersky

Eli Bendersky  added the comment:

10. Unless I'm missing something entirely obvious, except in the examples it 
says that Value has a "value" attribute for actual data access. One is expected 
to look in the docs of ctypes to find that?

--

___
Python tracker 

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



[issue13687] parse incorrect command line on windows 7

2011-12-30 Thread baleno

baleno  added the comment:

% is escape characters for DOS,

--
status: open -> closed

___
Python tracker 

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



[issue13659] Add a help() viewer for IDLE's Shell.

2011-12-30 Thread Ron Adam

Ron Adam  added the comment:

What about having idle open a web browser session with pydocs new browse option?

python3 -m pydoc -b

We've added input fields to the pages that take the same input as help() 
command does.  It also links to the online help pages, and you can view the 
source code of the files directly in the browser.  (Sometimes that's the best 
documentation you can get.)

--
nosy: +ron_adam

___
Python tracker 

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