[issue14187] add "annotation" entry to Glossary

2012-05-10 Thread Chris Rebert

Chris Rebert  added the comment:

Any reactions to the strawman wording for the entry?

--

___
Python tracker 

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



[issue14245] float rounding examples in FAQ are outdated

2012-05-10 Thread Mark Dickinson

Mark Dickinson  added the comment:

Zbyszek, have you signed a contributor agreement form? [1]

If not, please could you do so?  Then I can apply this doc contribution.

Thanks!


[1] http://www.python.org/psf/contrib/

--

___
Python tracker 

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



[issue14769] Add test to automatically detect missing format units in skipitem()

2012-05-10 Thread Larry Hastings

New submission from Larry Hastings :

I recently fixed an old bug: some time ago someone added support for a new 
"format unit", 'Z', to PyArg_Parse(), but neglected to add matching support for 
it to skipitem().  Benjamin asked for a regression test.  Initially I said, 
okay, how the hell do I test that?  A quick grep showed that there was already 
a test like that, for the format unit 'C'.  I figured adding another one-off 
test was dumb, and there had to be a better way.

Attached is a patch against trunk that adds a new function to 
_testcapimodule.c: test_skipitem_parity().  The comment at the top describes 
says it best:

 * This function brute-force tests all** ASCII characters (1 to 127
 * inclusive) as format units, checking to see that
 * PyArg_ParseTupleAndKeywords() return consistent errors both when
 * the unit is attempted to be used and when it is skipped.  If the
 * format unit doesn't exist, we'll get one of two specific error
 * messages (one for used, one for skipped); if it does exist we
 * *won't* get that error--we'll get either no error or some other
 * error.  If we get the "does not exist" error for one test and
 * not for the other, there's a mismatch, and the test fails.
 *
 *   ** Okay, it actually skips some ASCII characters.  Some characters
 *  have special funny semantics, and it would be difficult to
 *  accomodate them here.

I also removed the old test just for 'C', as this test subsumes that one.

Right now, the test runs to completion without complaint.  To test that it's 
really working, comment out an existing case statement in skipitem().  Or, add 
a new case statement, for a character that isn't otherwise supported (yet), to 
the top paragraph of case statements.  Doing either of these will cause a 
failure.

... you happy now, Benjamin?

--
assignee: larry
components: Interpreter Core
files: larry.test_skipitem_parity.1.diff
keywords: patch
messages: 160329
nosy: benjamin.peterson, larry
priority: normal
severity: normal
stage: patch review
status: open
title: Add test to automatically detect missing format units in skipitem()
type: enhancement
versions: Python 3.3
Added file: http://bugs.python.org/file25515/larry.test_skipitem_parity.1.diff

___
Python tracker 

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



[issue14767] urllib.request.HTTPRedirectHandler raises HTTPError when Location header is relative

2012-05-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

See issue12275. Seems like a common request.

--
nosy: +pitrou

___
Python tracker 

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



[issue13815] tarfile.ExFileObject can't be wrapped using io.TextIOWrapper

2012-05-10 Thread Lars Gustäbel

Lars Gustäbel  added the comment:

Okay, I attached a patch that I hope we can all agree upon. It restores the 
ExFileObject class as a small subclass of BufferedReader as Amaury suggested. 
Does the documentation have to be changed, too? It states that an 
io.BufferedReader object is returned by extractfile() not a subclass thereof.

--
Added file: http://bugs.python.org/file25516/tarfile-exfileobj.diff

___
Python tracker 

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



[issue14245] float rounding examples in FAQ are outdated

2012-05-10 Thread Zbyszek Szmek

Zbyszek Szmek  added the comment:

Done now.

Thanks,
Zbyszek

--

___
Python tracker 

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



[issue14770] Minor documentation fixes

2012-05-10 Thread Michael Foord

New submission from Michael Foord :

A bunch of minor fixes for the documentation suggested by Kurt Robinson to the 
webmaster email address:


Below, you will find 15 snippets from the Python 2.7.2 Library and Extension
FAQ (http://docs.python.org/faq/library.html), categorized by problem type,
accompanied by changes I would suggest or by questions I would have for the
author.


** Wrong word or missing word **

(1) CURRENT TEXT:  "Eventually you'll learn what's in the standard library
and will able to skip this step."

SUGGESTION:  Change "will able" to "will be able".


(2) CURRENT TEXT:   "The location of the sendmail program varies between
systems; sometimes it is /usr/lib/sendmail, sometime /usr/sbin/sendmail."

SUGGESTION:  Replace "sometime" with "sometimes".

(3) CURRENT TEXT:  "The Python parent can of course explicitly flush the
data it sends to the child before it reads any output, but if the child is a
naive C program it may have been written to never explicitly flush its
output, even if it is interactive, since flushing is normally automatic."

QUESTION:  Is "naive C program" the intended wording or should it be "native
C program"?


(4) CURRENT TEXT:  "[HTMLgen is] used when you are writing in Python and
wish to synthesize HTML pages for generating a web or for CGI forms, etc."

QUESTION:   I believe "web" should be "webpage". Correct?


(5) CURRENT TEXT:  "The default format used by the pickle module is a slow
one that results in readable pickles. Making it the default, but it would
break backward compatibility."

QUESTION:  It looks like some words have been left out of the second
sentence. What is the intended meaning there?


** Punctuation issues **

(6) CURRENT TEXT:  "The standard Python source distribution comes with a
curses module in the Modules/ subdirectory, though it's not compiled by
default (note that this is not available in the Windows distribution - there
is no curses module for Windows)." 

SUGGESTIONS: I believe the major style guides are in agreement that a
complete-sentence parenthetical note falling at the end of another sentence
should be punctuated as a separate sentence. I also think a semicolon would
be more comfortable doing what that dash is doing, but I suppose that's a
judgment call. Here's my suggested rewrite for the end of the sentence:
".though it's not compiled by default. (Note that this is not available in
the Windows distribution; there is no curses module for Windows)."


(7) CURRENT TEXT:  "Thus, to read n bytes from a pipe p created with
os.popen(), you need to use p.read(n)."

SUGGESTION:  Put commas before and after "p", or remove the "a" in front of
"pipe".


(8) CURRENT TEXT:  'For example to send name= "Guy Steele, Jr." .'

SUGGESTIONS:  Though it won't be apparent in this email, the quotation mark
before "Guy" is a close-quote symbol (”). It should be an open-quote
symbol (“). I would also put a comma after "for example".


(9) CURRENT TEXT:  "For example loading a half megabyte of data may take
less than a third of a second."

SUGGESTION:  Insert a comma after "For example".


** Ambiguity (or at least a momentary miscue) **

(10) CURRENT TEXT:  "For testing, it helps to write the program so that it
may be easily tested by using good modular design."

SUGGESTION:  Though it will be clear for most readers that "by using good
modular design" describes the writing process and not the testing process, a
rewrite could avoid the miscue and improve the flow: "To get the most out of
testing, you should use good modular design in your program."


(11) CURRENT TEXT:  "A test suite can be associated with each module which
automates a sequence of tests."

SUGGESTION:  Though we can figure out that it's the test suite and not the
module which automates a sequence of tests, a rewrite could avoid the miscue
and improve readability: "A test suite that automates a sequence of tests
can be associated with each module."


(12) CURRENT TEXT:  "Instead of trying to guess how long a time.sleep()
delay will be enough, it's better to use some kind of semaphore mechanism."

SUGGESTION:  Insert "of" after "how long" to avoid leading to the reader
down the path of "how long a time.sleep() delay will last."


(13) CURRENT TEXT:  "The Queue class maintains a list of objects with
.put(obj) to add an item to the queue and .get() to return an item."

SUGGESTIONS:   Again, we can figure out that those are methods on the class
not methods on the objects, but rephrasing the sentence so that it says that
unambiguously makes for easier reading: "The Queue class maintains a list of
objects and has a .put(obj) method, which adds items to the queue, and
.get() method, which returns an item.

Shifting momentarily to "content perspective", I think it could be helpful
to be more specific about what .get() does. I would suggest changing
"returns an item" to something like "returns the item which has been in the
queue the longest".


*

[issue14457] Unattended Install doesn't populate registry

2012-05-10 Thread Joe Eaves

Joe Eaves  added the comment:

There is an old bug report against 2.5 which dealt with a very similar problem, 
maybe the answers are the same?

http://bugs.python.org/issue4567

Basically the location in the registry has changed from HKLM to HKCU. Here is 
the last message in the thread directly:

http://bugs.python.org/msg78058

--
nosy: +Joe.Eaves

___
Python tracker 

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



[issue14766] Non-naive time comparison throws naive time error

2012-05-10 Thread Greg Weller

Greg Weller  added the comment:

I think this is a documentation bug.  The criteria for datetime and time 
objects being aware are slightly different.  A datetime object d is aware if 
d.tzinfo.utcoffset(d) does not return None, while a time object t is aware if 
t.tzinfo.utcoffset(None) does not return None (time objects call utcoffset with 
None while datetime objects call utcoffset with self).

This accounts for the TypeError in the original example:
>>> import pytz, datetime
>>> UTC_TZ = pytz.utc
>>> EASTERN_TZ = pytz.timezone('America/New_York')
>>> d1 = datetime.time(10, tzinfo=UTC_TZ)
>>> d2 = datetime.time(10, tzinfo=EASTERN_TZ)
>>> repr(d1.tzinfo.utcoffset(None))
'datetime.timedelta(0)'
>>> repr(d2.tzinfo.utcoffset(None))
'None'
>>> d1 < d2
Traceback (most recent call last):
  File "", line 1, in 
TypeError: can't compare offset-naive and offset-aware times

It looks like this example is flawed according to http://pytz.sourceforge.net/ 
: "Unfortunately using the tzinfo argument of the standard datetime 
constructors ‘’does not work’’ with pytz for many timezones. It is safe for 
timezones without daylight savings trasitions though, such as UTC."  (If you 
think about it, the error still makes sense: the UTC time is aware and the 
eastern time is naive -- any DST time object has to be naive -- but this has 
more to do with pytz).

It doesn't make sense to have time objects pass self to utcoffset because 
utcoffset expects a datetime object.  You shouldn't be able to infer what the 
UTC offset is from a time object unless the offset is constant, in which case 
you don't even need the time object.  If the UTC offset isn't constant, you 
need the date, which a time object doesn't have.  I think this is the logic 
behind having datetime objects call utcoffset(self) and time objects call 
utcoffset(None).

I've attached a small patch for the documentation.

--
keywords: +patch
nosy: +greg.weller
Added file: http://bugs.python.org/file25517/14766.patch

___
Python tracker 

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



[issue14457] Unattended Install doesn't populate registry

2012-05-10 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Joe: this is indeed likely the explanation.

Paul: can you confirm?
Also: try adding "ALLUSERS=1" to the msiexec command line.

--

___
Python tracker 

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



[issue14763] string.split maxsplit documented incorrectly

2012-05-10 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 0415ecd7b0e3 by Ezio Melotti in branch '2.7':
#14763: document default maxsplit value for str.split.
http://hg.python.org/cpython/rev/0415ecd7b0e3

New changeset 62659067f5b6 by Ezio Melotti in branch '3.2':
#14763: document default maxsplit value for str.split.
http://hg.python.org/cpython/rev/62659067f5b6

New changeset bcc964092437 by Ezio Melotti in branch 'default':
#14763: merge with 3.2.
http://hg.python.org/cpython/rev/bcc964092437

--

___
Python tracker 

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



[issue14763] string.split maxsplit documented incorrectly

2012-05-10 Thread Ezio Melotti

Ezio Melotti  added the comment:

I now documented it in the documentation of str.split too.  I left the 
docstrings alone since they don't need to be as exhaustive as the official 
documentation, and there's normally no reason to use -1 directly.

--

___
Python tracker 

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



[issue14759] BSDDB license missing from liscense page in 2.7.

2012-05-10 Thread R. David Murray

R. David Murray  added the comment:

Given the way Oracle is currently behaving, I personally think he is wise to 
delete it.  It's optional at build-time anyway.

--

___
Python tracker 

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



[issue13815] tarfile.ExFileObject can't be wrapped using io.TextIOWrapper

2012-05-10 Thread R. David Murray

R. David Murray  added the comment:

I don't think a doc change is needed.  An isinstance check based on the docs 
will succeed, and the rest is an implementation detail, I think.

--

___
Python tracker 

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



[issue14366] Supporting lzma compression in zip files

2012-05-10 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Serhiy, just to be sure we communicated well: I'm not asking that all the 
missing features for a 6.3 level zip library must be implemented. Instead, we 
need to detect whether an unsupported feature is used, and raise an exception 
reporting what the feature is that is unsupported. This is necessary as we 
otherwise may return incorrect data.

--

___
Python tracker 

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



[issue14766] Non-naive time comparison throws naive time error

2012-05-10 Thread R. David Murray

R. David Murray  added the comment:

My, that's embarrassing.  I somehow entirely missed the fact that we were 
dealing with times and not dates here.

What you say makes sense to me, and the doc patch looks good.

--

___
Python tracker 

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



[issue14770] Minor documentation fixes

2012-05-10 Thread Ezio Melotti

Ezio Melotti  added the comment:

Attached a patch that addresses these problems:

1) done;
2) done;
3) I think "naive" is correct here (i.e. a naive program won't take care of 
flushing);
4) I remove the list of modules and left the link to the wiki page;
5) In the rst source there's a note that says "update this, default protocol is 
2/3", but the pickle doc says "If a protocol is not specified, protocol 0 is 
used.".  I left this unchanged for now;
6) done, but the dash seems ok to me, so I left it;
7) the comma sounds wrong to me, but I turned p to italic;
8) I think this is a Sphinx glitch (there might be already an issue for this 
somewhere).  I added the comma;
9) done;
10) I rephrased the sentence;
11) done;
12) I rephrased the sentence;
13) I rephrased the sentence;
14) done;
15) done;

--
assignee: docs@python -> ezio.melotti
keywords: +patch
nosy: +eric.araujo, ezio.melotti, r.david.murray, sandro.tosi
stage: needs patch -> patch review
type:  -> enhancement
Added file: http://bugs.python.org/file25518/issue14770.diff

___
Python tracker 

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



[issue10765] Build regression from automation changes on windows

2012-05-10 Thread Ezio Melotti

Ezio Melotti  added the comment:

Avoiding spaces in the dir names might not be so easy, if e.g. you are trying 
to install it in "Program Files", "Users/Name Surname", or some other system 
directory that has spaces in there (sure, you could install it elsewhere, but 
in 2012 this shouldn't be an issue anymore).

--
stage:  -> patch review

___
Python tracker 

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



[issue14770] Minor documentation fixes

2012-05-10 Thread Georg Brandl

Georg Brandl  added the comment:

Re 5: the sentence needs to be rephrased in any case, because it's ungrammatical
Re 8: it's not text, it's code, so it needs to go in code markup

--
nosy: +georg.brandl

___
Python tracker 

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



[issue14738] Amazingly faster UTF-8 decoding

2012-05-10 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset e08c3791f035 by Antoine Pitrou in branch 'default':
Issue #14738: Speed-up UTF-8 decoding on non-ASCII data.  Patch by Serhiy 
Storchaka.
http://hg.python.org/cpython/rev/e08c3791f035

--
nosy: +python-dev

___
Python tracker 

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



[issue14738] Amazingly faster UTF-8 decoding

2012-05-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The patch is now committed. Well done and thanks for your contribution.

--
resolution:  -> fixed
stage: patch review -> 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



[issue11352] Update cgi module doc

2012-05-10 Thread Pierre Quentel

Pierre Quentel  added the comment:

I attach a new version after sharing thought with Glenn

CGI scripts are still unable to define which encoding to use to print the 
strings received from the user agent. A patch was proposed #11066 but the issue 
is still pending. The new version documents this issue

--
Added file: http://bugs.python.org/file25519/cgi-doc.patch

___
Python tracker 

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



[issue14770] Minor documentation fixes

2012-05-10 Thread Ezio Melotti

Ezio Melotti  added the comment:

Addressed 5) and 8).

--
Added file: http://bugs.python.org/file25520/issue14770-2.diff

___
Python tracker 

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



[issue14753] multiprocessing treats negative timeouts differently from before

2012-05-10 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 99ef4501205b by Richard Oudkerk in branch 'default':
Issue #14753: Make multiprocessing treat negative timeouts as it did in 3.2
http://hg.python.org/cpython/rev/99ef4501205b

--
nosy: +python-dev

___
Python tracker 

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



[issue14766] Non-naive time comparison throws naive time error

2012-05-10 Thread Chris Bergstresser

Chris Bergstresser  added the comment:

That patch fixes the documentation there, but the description at the top of the 
distinction between naive and aware time objects at the top datetime module is 
still wrong.  Here it is:

-

There are two kinds of date and time objects: “naive” and “aware”. This 
distinction refers to whether the object has any notion of time zone, daylight 
saving time, or other kind of algorithmic or political time adjustment. Whether 
a naive datetime object represents Coordinated Universal Time (UTC), local 
time, or time in some other timezone is purely up to the program, just like 
it’s up to the program whether a particular number represents metres, miles, or 
mass. Naive datetime objects are easy to understand and to work with, at the 
cost of ignoring some aspects of reality.

--

The distinction is not whether the object has any notion of "time zone, 
daylight saving time, or other kind of algorithmic or political time 
adjustment", but instead whether, in the context it's being used, it can 
calculate an offset to UTC.  A naive time can be used to create an aware 
datetime.

--

___
Python tracker 

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



[issue14187] add "annotation" entry to Glossary

2012-05-10 Thread Éric Araujo

Éric Araujo  added the comment:

Looks good to me, with the proviso that it should be “function annotation”.

--
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



[issue13241] llvm-gcc-4.2 miscompiles Python (XCode 4.1 on Mac OS 10.7)

2012-05-10 Thread Tom Pinckney

Tom Pinckney  added the comment:

FWIW, clang from Xcode 4.3.2 build 4E2002 w/ command line tools built 
everything fine for me too (i.e., ./configure CC=clang).

LM-SJN-00377886:cpython tom$ uname -a
Darwin LM-SJN-00377886 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 
PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64

LM-SJN-00377886:cpython tom$ /usr/bin/clang --version
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.3.0
Thread model: posix

LM-SJN-00377886:cpython tom$ hg summary
parent: 76839:bb30116024ac tip
 Minor fix for test_multiprocessing
branch: default
commit: (clean)
update: (current)

--
nosy: +thomaspinckney3

___
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

2012-05-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I had forgotten to tackle threadless builds, this patch fixes it.

--
Added file: http://bugs.python.org/file25521/module_locks9.patch

___
Python tracker 

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



[issue1508475] transparent gzip compression in urllib

2012-05-10 Thread Tom Pinckney

Tom Pinckney  added the comment:

What if this gzip decompression was optional and controlled via a flag or 
handler instead of making it automagic?

It's not entirely trivial to implement so it is nice to have the option of this 
happening automatically if one wishes.

Then, the caller would be aware that Content-length / Accept-encoding / 
Content-encoding etc have been modified iff they requested gzip decompression.

--
nosy: +thomaspinckney3

___
Python tracker 

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



[issue6696] Profile objects should be documented

2012-05-10 Thread Tom Pinckney

Tom Pinckney  added the comment:

Looking at the current docs for 3.3, it looks like there are a bunch of other 
ways that the docs could be clarified:

1) Proper documentation of the complete profile.Profile() and 
cProfile.Profile() interfaces. 

2) Adding other examples to the quick start section at the top for how to 
process the resulting stats without printing them to stdout or writing them to 
a file.

I'll take a stab at this.

--
nosy: +thomaspinckney3

___
Python tracker 

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



[issue14771] Occasional failure in test_ioctl

2012-05-10 Thread Antoine Pitrou

New submission from Antoine Pitrou :

This happens from time to time on my desktop computer:

[151/354/1] test_ioctl
test test_ioctl failed -- Traceback (most recent call last):
  File "/home/antoine/cpython/32/Lib/test/test_ioctl.py", line 36, in test_ioctl
self.assertIn(rpgrp, ids)
AssertionError: 25242 not found in (23865, 23615)

--
components: Library (Lib), Tests
messages: 160357
nosy: neologix, pitrou
priority: low
severity: normal
status: open
title: Occasional failure in test_ioctl
type: behavior
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



[issue14157] time.strptime without a year fails on Feb 29

2012-05-10 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset f2ea7505c0d7 by Antoine Pitrou in branch '3.2':
Issue #14157: Fix time.strptime failing without a year on February 29th.
http://hg.python.org/cpython/rev/f2ea7505c0d7

New changeset a5a254e8a291 by Antoine Pitrou in branch 'default':
Issue #14157: Fix time.strptime failing without a year on February 29th.
http://hg.python.org/cpython/rev/a5a254e8a291

--
nosy: +python-dev

___
Python tracker 

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



[issue14157] time.strptime without a year fails on Feb 29

2012-05-10 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 69d407b016c1 by Antoine Pitrou in branch '2.7':
Issue #14157: Fix time.strptime failing without a year on February 29th.
http://hg.python.org/cpython/rev/69d407b016c1

--

___
Python tracker 

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



[issue14157] time.strptime without a year fails on Feb 29

2012-05-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Patch committed and pushed, thank you!

--
assignee: belopolsky -> 
resolution:  -> fixed
stage: commit review -> 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



[issue14082] shutil doesn't copy extended attributes

2012-05-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The patch looks ok, but it would be nice if someone with non-broken xattr 
support could test it. Although I suppose you did run the test suite, Hynek?

--

___
Python tracker 

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



[issue14082] shutil doesn't copy extended attributes

2012-05-10 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

I did. The only error I got was

ERROR: test_idna (test.test_socket.GeneralModuleTests)
--
Traceback (most recent call last):
  File "/home/vagrant/p2/Lib/test/test_socket.py", line 1182, in test_idna
socket.gethostbyname('испытание.python.org')
socket.gaierror: [Errno -3] Temporary failure in name resolution

I presume it's unrelated. :)

--

___
Python tracker 

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



[issue14772] Return destination values in some shutil functions

2012-05-10 Thread Brian Curtin

New submission from Brian Curtin :

Attached is a patch to return the final destination of files or directories 
sent through shutil's copy, copy2, and move functions. This removes the need to 
construct the destination path on your own.

This is especially useful for copy/copy2 where you copy a file into a directory 
and need to know that resulting path. Rather than calling os.path.join(dest, 
os.path.basename(source)) you could get that path from copy/copy2 (which does 
that join internally).

Patch has docs and tests.

--
assignee: brian.curtin
components: Library (Lib)
files: shutil_return_values.diff
keywords: needs review, patch
messages: 160363
nosy: brian.curtin
priority: normal
severity: normal
stage: patch review
status: open
title: Return destination values in some shutil functions
type: enhancement
versions: Python 3.3
Added file: http://bugs.python.org/file25522/shutil_return_values.diff

___
Python tracker 

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



[issue14773] fwalk breaks on dangling symlinks

2012-05-10 Thread Hynek Schlawack

New submission from Hynek Schlawack :

I'm implementing a safe rmtree using fwalk. Everything works perfectly except 
for one thing: if the directory contains dangling symlinks, fwalk goes belly-up:

$ ls -l test/
total 0
lrwxrwxrwx 1 vagrant vagrant 4 May 10 16:36 doesntwork -> this

$ ./python
Python 3.3.0a3+ (default:b32baa5b7626+, May 10 2012, 14:56:20) 
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
[71253 refs]
>>> list(os.fwalk('test'))
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/vagrant/p/Lib/os.py", line 342, in fwalk
for x in _fwalk(topfd, top, topdown, onerror, followlinks):
  File "/home/vagrant/p/Lib/os.py", line 361, in _walk
if st.S_ISDIR(fstatat(topfd, name).st_mode):
FileNotFoundError: [Errno 2] No such file or directory


Unfortunately this makes it impossible to implement rmtree. The reason is the 
following code:

for name in names:
# Here, we don't use AT_SYMLINK_NOFOLLOW to be consistent with
# walk() which reports symlinks to directories as directories. We do
# however check for symlinks before recursing into a subdirectory.
if st.S_ISDIR(fstatat(topfd, name).st_mode):
dirs.append(name)
else:
nondirs.append(name)

The "unsafe" walk tree uses os.path.isdir() instead of os.fstatat() and handles 
this case gracefully.

A simple try-except protection with a symlink check fixes it and the tests 
pass. This is a blocker for #4489. I have expanded the test of the WalkerTests 
suite.

Tested on Linux (= works) and OS X (= skipped).

--
assignee: hynek
components: Library (Lib)
files: make-fwalk-handle-dangling-symlinks.diff
keywords: patch
messages: 160364
nosy: hynek, neologix
priority: normal
severity: normal
stage: patch review
status: open
title: fwalk breaks on dangling symlinks
type: behavior
versions: Python 3.3
Added file: 
http://bugs.python.org/file25523/make-fwalk-handle-dangling-symlinks.diff

___
Python tracker 

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



[issue14772] Return destination values in some shutil functions

2012-05-10 Thread Hynek Schlawack

Changes by Hynek Schlawack :


--
nosy: +hynek

___
Python tracker 

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



[issue4489] shutil.rmtree is vulnerable to a symlink attack

2012-05-10 Thread Hynek Schlawack

Changes by Hynek Schlawack :


--
assignee: tarek -> 
dependencies: +fwalk breaks on dangling symlinks
keywords:  -patch
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



[issue14753] multiprocessing treats negative timeouts differently from before

2012-05-10 Thread Richard Oudkerk

Changes by Richard Oudkerk :


--
resolution:  -> fixed
stage: patch review -> 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



[issue14769] Add test to automatically detect missing format units in skipitem()

2012-05-10 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Can you see if you can write that test in Python? Perhaps simply providing a 
wrapper to cal PyArg_Parse with the arguments you want.

--

___
Python tracker 

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



[issue14774] _sysconfigdata.py doesn't support multiple build configurations

2012-05-10 Thread Dave Malcolm

New submission from Dave Malcolm :

When building from source, if I create multiple configuration directories and 
build from there e.g.:

mkdir configs
cd configs
mkdir config-A
cd config-A
../../configure
make
cd ..
mkdir config-B
cd config-B
../../configure --enable-shared
make
cd ../config-A
./python -c "import sysconfig; print(sysconfig.get_config_var('CONFIG_ARGS')

then sysconfig's settings are the same for *every* config, reflecting those of 
the last build (config-B above, rathern than those of config-A).

This turns out to be due to this:
   ./python -SE -m sysconfig --generate-posix-vars
This generates $(srcdir)/Lib/_sysconfigdata.py for whichever config was last

Is there a way of fixing this whilst keeping it a python file?  Or do we need 
to build from a C file, perhaps?

--
components: Build
messages: 160366
nosy: dmalcolm
priority: normal
severity: normal
status: open
title: _sysconfigdata.py doesn't support multiple build configurations
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



[issue14774] _sysconfigdata.py doesn't support multiple build configurations

2012-05-10 Thread Dave Malcolm

Dave Malcolm  added the comment:

Note to self: workaround is to
  rm ../../Lib/_sysconfigdata.py || make ../../Lib/_sysconfigdata.py
before running my tests in either configuration, to force the file to be 
regenerated using what "make" thinks the settings are

--

___
Python tracker 

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



[issue14775] Slow unpickling of certain dictionaries in python 2.7 vs python 2.6

2012-05-10 Thread stw

New submission from stw :

I've found that unpickling a certain kind of dictionary is substantially slower 
in python 2.7 compared to python 2.6. The dictionary has keys that are tuples 
of strings - a 1-tuple is enough to see the effect. The problem seems to be 
caused by garbage collection, as turning it off eliminates the slowdown. Both 
pickle and cPickle modules are affected.


I've attached two files to demonstrate this. The file 'make_file.py'
creates a dictionary of specified size, with keys containing 1-tuples of random 
strings. It then dumps the dictionary to a pickle file using a specified pickle 
module.

The file 'load_file.py' unpickles the file created by 'make_file.py', using a 
specified pickle module, and prints the time taken. The code can be run with 
garbage collection either on or off.

The results below are for a dictionary of 20 entries. Each entry is the 
time taken in seconds with garbage collection on / garbage collection off. The 
row headings are the module used to pickle the data, the column headings the 
module used to unpickle it.


python 2.6, n = 20

   sizepickle  cPickle
pickle 4.3M3.02/2.65   0.786/0.559 
cPickle3.4M2.27/2.04   0.66/0.443 


python 2.7, n = 20

   sizepickle  cPickle
pickle 4.3M10.5/2.67   6.62/0.563 
cPickle2.4M1.45/1.39   0.362/0.325 


When pickle is used to pickle the data, there is a significant slowdown in 
python 2.7 compared to python 2.6 with garbage collection on. With garbage 
collection off the times in python 2.7 are essentially identical to those in 
python 2.6.

When cPickle is used to pickle the data, both unpicklers are faster in python 
2.7 than in python 2.6. Presumably the speedup is due to the dictionary 
optimizations introduced from issue #5670.


Both pickle and cPickle show a slowdown when data pickled in python 2.6 is 
unpickled in python 2.7:


pickled in python 2.6, unpickled in python 2.7, n = 20

  sizepickle (2.7)cPickle (2.7)
pickle (2.6)  4.3M10.4/2.66   6.64/0.56 
cPickle (2.6) 3.4M8.73/2.08   6.1/0.452 


I don't know enough about the internals of the pickle modules or garbage 
collector to offer an explanation/fix. The list of optimizations for python 2.7 
indicates changes to both pickle modules (issues #5670 and #5084) and the 
garbage collector (issues #4074 and #4688). It seems possible that the slowdown 
is the result of some interaction between these changes.


Further notes:

1. System details: python 2.6.5 and python 2.7.3 on Ubuntu 10.04, 1.73GHz 
Pentium M processor.

2. Only pickle files created with protocols 1 and 2 are affected. Pickling with 
protocol 0 gives similar timings on python 2.6 and 2.7.

3. The fact that the dictionary's keys are tuples is relevant, although the 
length of the tuple is not. Unpickling a dictionary whose keys are strings does 
not show any slowdown.

--
files: make_file.py
messages: 160368
nosy: stw
priority: normal
severity: normal
status: open
title: Slow unpickling of certain dictionaries in python 2.7 vs python 2.6
type: performance
versions: Python 2.7
Added file: http://bugs.python.org/file25524/make_file.py

___
Python tracker 

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



[issue14775] Slow unpickling of certain dictionaries in python 2.7 vs python 2.6

2012-05-10 Thread stw

Changes by stw :


Added file: http://bugs.python.org/file25525/load_file.py

___
Python tracker 

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



[issue14775] Slow unpickling of certain dictionaries in python 2.7 vs python 2.6

2012-05-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> When pickle is used to pickle the data, there is a significant slowdown

> Both pickle and cPickle show a slowdown when data pickled in python 2.6 is 
> unpickled in python 2.7:

This sounds rather weird. Presumably the structure of the pickle streams 
shouldn't have changed from 2.6 to 2.7.
You can use the pickletools.dis() function to disassemble a pickle stream, and 
examine whether there are any differences between the various files.

--
nosy: +pitrou

___
Python tracker 

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



[issue14772] Return destination values in some shutil functions

2012-05-10 Thread Brian Curtin

Brian Curtin  added the comment:

Here's a patch that fixes the trailing whitespace Hynek noticed as well as adds 
an additional test case for copy/copy2.

--
Added file: http://bugs.python.org/file25526/issue14772.diff

___
Python tracker 

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



[issue14772] Return destination values in some shutil functions

2012-05-10 Thread Brian Curtin

Brian Curtin  added the comment:

Added another test using move as renaming the destination file.

--
Added file: http://bugs.python.org/file25527/issue14772_v2.diff

___
Python tracker 

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



[issue14772] Return destination values in some shutil functions

2012-05-10 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

Code LGTM, a deeper discussion happened on IRC. :)

I'd still suggest for the sake of consistency to return the destination from 
copytree() too, but that can be done separately.

--
stage: patch review -> commit review

___
Python tracker 

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



[issue14366] Supporting lzma compression in zip files

2012-05-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I understand you, Martin. The time it took me to read the specification
and understand where should be the checks in the module. The patch
updated. The list of compression methods extended (in the future it can
be used for detailed output in the printdir()), flag of strict
encryption is checked directly, encrypted or compressed central
directory just will not be found (BadZipFile will be raised).

--
Added file: http://bugs.python.org/file25528/lzma_in_zip_3.patch

___
Python tracker 

___diff -r e08c3791f035 Doc/library/zipfile.rst
--- a/Doc/library/zipfile.rst   Thu May 10 16:36:02 2012 +0200
+++ b/Doc/library/zipfile.rst   Thu May 10 23:17:48 2012 +0300
@@ -97,12 +97,20 @@
 
.. versionadded:: 3.3
 
+.. data:: ZIP_LZMA
+
+   The numeric constant for the LZMA compression method.  This requires the
+   lzma module.
+
+   .. versionadded:: 3.3
+
.. note::
 
   The ZIP file format specification has included support for bzip2 
compression
-  since 2001. However, some tools (including older Python releases) do not
-  support it, and may either refuse to process the ZIP file altogether, or
-  fail to extract individual files.
+  since 2001, and for LZMA compression since 2006. However, some tools
+  (including older Python releases) do not support these compression
+  methods, and may either refuse to process the ZIP file altogether,
+  or fail to extract individual files.
 
 
 .. seealso::
@@ -133,11 +141,11 @@
adding a ZIP archive to another file (such as :file:`python.exe`).  If
*mode* is ``a`` and the file does not exist at all, it is created.
*compression* is the ZIP compression method to use when writing the archive,
-   and should be :const:`ZIP_STORED`, :const:`ZIP_DEFLATED`; or
-   :const:`ZIP_DEFLATED`; unrecognized
-   values will cause :exc:`RuntimeError` to be raised.  If 
:const:`ZIP_DEFLATED` or
-   :const:`ZIP_BZIP2` is specified but the corresponded module
-   (:mod:`zlib` or :mod:`bz2`) is not available, :exc:`RuntimeError`
+   and should be :const:`ZIP_STORED`, :const:`ZIP_DEFLATED`,
+   :const:`ZIP_BZIP2` or :const:`ZIP_LZMA`; unrecognized
+   values will cause :exc:`RuntimeError` to be raised.  If 
:const:`ZIP_DEFLATED`,
+   :const:`ZIP_BZIP2` or :const:`ZIP_LZMA` is specified but the corresponded 
module
+   (:mod:`zlib`, :mod:`bz2` or :mod:`lzma`) is not available, 
:exc:`RuntimeError`
is also raised. The default is :const:`ZIP_STORED`.  If *allowZip64* is
``True`` zipfile will create ZIP files that use the ZIP64 extensions when
the zipfile is larger than 2 GB. If it is  false (the default) 
:mod:`zipfile`
@@ -161,7 +169,7 @@
   Added the ability to use :class:`ZipFile` as a context manager.
 
.. versionchanged:: 3.3
-  Added support for :mod:`bzip2` compression.
+  Added support for :mod:`bzip2` and :mod:`lzma` compression.
 
 
 .. method:: ZipFile.close()
diff -r e08c3791f035 Lib/test/support.py
--- a/Lib/test/support.py   Thu May 10 16:36:02 2012 +0200
+++ b/Lib/test/support.py   Thu May 10 23:17:48 2012 +0300
@@ -45,6 +45,11 @@
 except ImportError:
 bz2 = None
 
+try:
+import lzma
+except ImportError:
+lzma = None
+
 __all__ = [
 "Error", "TestFailed", "ResourceDenied", "import_module",
 "verbose", "use_resources", "max_memuse", "record_original_stdout",
@@ -62,7 +67,7 @@
 "get_attribute", "swap_item", "swap_attr", "requires_IEEE_754",
 "TestHandler", "Matcher", "can_symlink", "skip_unless_symlink",
 "import_fresh_module", "requires_zlib", "PIPE_MAX_SIZE", "failfast",
-"anticipate_failure", "run_with_tz", "requires_bz2"
+"anticipate_failure", "run_with_tz", "requires_bz2", "requires_lzma"
 ]
 
 class Error(Exception):
@@ -513,6 +518,8 @@
 
 requires_bz2 = unittest.skipUnless(bz2, 'requires bz2')
 
+requires_lzma = unittest.skipUnless(lzma, 'requires lzma')
+
 is_jython = sys.platform.startswith('java')
 
 # Filename used for testing
diff -r e08c3791f035 Lib/test/test_zipfile.py
--- a/Lib/test/test_zipfile.py  Thu May 10 16:36:02 2012 +0200
+++ b/Lib/test/test_zipfile.py  Thu May 10 23:17:48 2012 +0300
@@ -13,7 +13,7 @@
 from random import randint, random
 from unittest import skipUnless
 
-from test.support import TESTFN, run_unittest, findfile, unlink, 
requires_zlib, requires_bz2
+from test.support import TESTFN, run_unittest, findfile, unlink, 
requires_zlib, requires_bz2, requires_lzma
 
 TESTFN2 = TESTFN + "2"
 TESTFNDIR = TESTFN + "d"
@@ -361,6 +361,55 @@
 self.assertEqual(openobj.read(1), b'1')
 self.assertEqual(openobj.read(1), b'2')
 
+@requires_lzma
+def test_lzma(self):
+for f in (TESTFN2, TemporaryFile(), io.BytesIO()):
+self.zip_test(f, zipfile.ZIP_LZMA)
+
+@requires_lzma
+def test_open_lzma(self):
+for f in (TESTFN2

[issue14776] Add SystemTap static markers

2012-05-10 Thread Dave Malcolm

New submission from Dave Malcolm :

I'm attaching a patch which adds static markers for SystemTap for two probeable 
events within CPython's bytecode interpreter, along with test cases and 
documentation.

I'm hoping to get this merged for 3.3; is this PEP-worthy, or can this be done 
through patch review?

Note: issue #4111 was originally opened on 2008-10-12 as "Add DTrace probes", 
and was generalized on 2009-12-08 to "Add Systemtap/DTrace probes".  That issue 
was closed on 2011-11-14 to be superceded by issue #13405 ("Add DTrace 
probes"), hence I'm opening this as a separate issue.

I believe that although DTrace and SystemTap are similar, they are sufficiently 
different from each other that it's going to take separate work to support one 
or the other (and that the maintainers of the support for each within CPython 
are likely to be different people).  I hope that once one of them is merged, 
the other will become a lot easier to merge.

Potentially other markers could be added for other events (the DTrace patch in 
issue #13405 has gained some), but I wanted to start small for now.

--
components: Interpreter Core
files: cpython-systemtap-2012-05-10-001.patch
keywords: needs review, patch
messages: 160374
nosy: dmalcolm
priority: normal
severity: normal
stage: patch review
status: open
title: Add SystemTap static markers
type: enhancement
versions: Python 3.3
Added file: 
http://bugs.python.org/file25529/cpython-systemtap-2012-05-10-001.patch

___
Python tracker 

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



[issue13405] Add DTrace probes

2012-05-10 Thread Dave Malcolm

Dave Malcolm  added the comment:

I've refreshed my SystemTap patch, and opened a new issue, issue #14776 to 
cover SystemTap.

Issue #4111 was originally opened on 2008-10-12 as "Add DTrace probes", and was 
generalized on 2009-12-08 to "Add Systemtap/DTrace probes".  That issue was 
closed on 2011-11-14 to be superceded by issue #13405 ("Add DTrace probes"), 
hence I opened the SystemTap RFE as a separate issue to this one.

As noted in issue #14776: I believe that although DTrace and SystemTap are 
similar, they are sufficiently different from each other that it's going to 
take separate work to support one or the other (and that the maintainers of the 
support for each within CPython are likely to be different people).  I hope 
that once one of them is merged, the other will become a lot easier to merge.

--

___
Python tracker 

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



[issue13734] Add a generic directory walker method to avoid symlink attacks

2012-05-10 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

It would be nice if the documentation of fwalk() explained why you would want 
to use it over walk().

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue10376] ZipFile unzip is unbuffered

2012-05-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This is not because zipfile module is unbuffered. This is the difference 
between expensive function call and cheap bytes slicing. Replace 
`zf.open(namelist [0])` to `io.BufferedReader(zf.open(namelist [0]))` to see 
the effect of a good buffering. In 3.2 zipfile read() implemented not optimal, 
so it slower (twice), but in 3.3 it will be almost as fast as using 
io.BufferedReader. It is still several times more slowly than bytes slicing, 
but there's nothing you can do with it.

Here is a patch, which is speeds up (+20%) the reading from a zip file by small 
chunks. Microbenchmark:

./python -m zipfile -c test.zip python
./python -m timeit -n 1 -s "import zipfile;zf=zipfile.ZipFile('test.zip')"  
"with zf.open('python') as f:"  "  while f.read(1):pass"

Python 3.3 (vanilla):  1 loops, best of 3: 36.4 sec per loop
Python 3.3 (patched):  1 loops, best of 3: 30.1 sec per loop
Python 3.3 (with io.BufferedReader):  1 loops, best of 3: 30.2 sec per loop
And, for comparison, Python 3.2:  1 loops, best of 3: 74.5 sec per loop

--
components:  -Documentation
keywords: +patch
versions:  -Python 2.7, Python 3.2
Added file: http://bugs.python.org/file25530/zipfile_optimize_read.patch

___
Python tracker 

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



[issue10376] ZipFile unzip is unbuffered

2012-05-10 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +pitrou

___
Python tracker 

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



[issue14777] Tkinter clipboard_get() decodes characters incorrectly

2012-05-10 Thread Thomas Kluyver

New submission from Thomas Kluyver :

With the text 'abc€' copied to the clipboard, on Linux, where UTF-8 is the 
default encoding:

Python 3.2.3 (default, Apr 12 2012, 21:55:50) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>> root = tkinter.Tk()
>>> root.clipboard_get()
'abcâ\x82¬'
>>> 'abc€'.encode('utf-8').decode('latin-1')
'abcâ\x82¬'

I see the same behaviour in 2.7.3 as well (it returns a unicode string 
u'abc\xe2\x82\xac').

If the clipboard is only accessible at a bytes level, I think clipboard_get 
should return a bytes object. But I can reliably copy and paste non-ascii 
characters between programs, so it looks like it's possible to return unicode.

--
components: Tkinter
messages: 160378
nosy: takluyver
priority: normal
severity: normal
status: open
title: Tkinter clipboard_get() decodes characters incorrectly
type: behavior
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



[issue14766] Non-naive time comparison throws naive time error

2012-05-10 Thread Greg Weller

Greg Weller  added the comment:

I agree that the language in the quoted paragraph makes it sound as if any 
object with a non-None tzinfo is aware, which isn't the case.  I've changed the 
first couple sentences to, I think, better reflect what characterizes an object 
as being aware.

--
Added file: http://bugs.python.org/file25531/14766.patch

___
Python tracker 

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



[issue14777] Tkinter clipboard_get() decodes characters incorrectly

2012-05-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Still worse. I get 'abc?'. Linux, Python 3.1, 3.2, and 3.3, UTF-8 locale.

--
nosy: +storchaka
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



[issue14778] IrrationalVersionError should include the project name

2012-05-10 Thread Nick Wilson

New submission from Nick Wilson :

IrrationalVersionError in packaging/distutils2 should include the name of the 
project responsible for the error. It currently only includes the version:

  >>> import packaging.pypi.xmlrpc
  >>> client = packaging.pypi.xmlrpc.Client()
  >>> client.search_projects('req')
  Irrational version error found: 0.0.0-prealpha
  Irrational version error found: 0.1dev-20110502
  ...

--
assignee: eric.araujo
components: Distutils2
messages: 160381
nosy: alexis, eric.araujo, njwilson, tarek
priority: normal
severity: normal
status: open
title: IrrationalVersionError should include the project name
versions: 3rd party, Python 3.3

___
Python tracker 

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



[issue14779] test_buffer fails on OS X universal 64-/32-bit builds

2012-05-10 Thread Ned Deily

New submission from Ned Deily :

test_buffer can fail when run on an OS X 64-/32-bit universal build of Python 
is run in 32-bit mode.

$ /usr/local/bin/python3.3 -m test test_buffer
[1/1] test_buffer
1 test OK.
$ /usr/local/bin/python3.3-32 -m test -v test_buffer
== CPython 3.3.0a3 (v3.3.0a3:0b53b70a40a0, May 1 2012, 11:39:35) [GCC 4.2.1 
(Apple Inc. build 5666) (dot 3)]
==   Darwin-11.4.0-x86_64-i386-64bit little-endian
==   /private/var/folders/fm/9wjgctqx61n796zt88qmmnxcgn/T/test_python_56263
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, 
dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, 
verbose=0, bytes_warning=0, quiet=0, hash_randomization=1)
[1/1] test_buffer
[...]
test_memoryview_construction (test.test_buffer.TestBufferProtocol) ... FAIL
test_ndarray_format_shape (test.test_buffer.TestBufferProtocol) ... FAIL
test_ndarray_format_strides (test.test_buffer.TestBufferProtocol) ... FAIL
test_ndarray_getbuf (test.test_buffer.TestBufferProtocol) ... FAIL
test_ndarray_multidim (test.test_buffer.TestBufferProtocol) ... FAIL
test_ndarray_slice_assign_single (test.test_buffer.TestBufferProtocol) ... FAIL
[...]

The test is incorrectly testing a compile-time configuration variable which is 
not meaningful for universal builds since each architecture can have different 
values.  Further, the platform.architecture fallback test is also unreliable; 
as noted in the docs for the platform module, sys.maxsize should be used for 
run-time tests.  The attached patch fixes the test for OS X.

--
files: issueX_test_buffer.patch
keywords: patch
messages: 160382
nosy: ned.deily, skrah
priority: normal
severity: normal
stage: patch review
status: open
title: test_buffer fails on OS X universal 64-/32-bit builds
versions: Python 3.3
Added file: http://bugs.python.org/file25532/issueX_test_buffer.patch

___
Python tracker 

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



[issue14778] IrrationalVersionError should include the project name

2012-05-10 Thread Éric Araujo

Éric Araujo  added the comment:

Setting to easy for the next sprints.  To do: add an argument to the 
IrrationalVersion constructor, add a test to make sure the result of __str__ 
includes it, and adapt the rest of the codebase to pass the project name when 
the exception is raised.

--
keywords: +easy

___
Python tracker 

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



[issue6696] Profile objects should be documented

2012-05-10 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo
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



[issue1508475] transparent gzip compression in urllib

2012-05-10 Thread Éric Araujo

Éric Araujo  added the comment:

Enabled by default with a knob to turn it off sounds good.  Maybe the original 
headers could be preserved in some object.

--
keywords:  -easy, patch

___
Python tracker 

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



[issue14774] _sysconfigdata.py doesn't support multiple build configurations

2012-05-10 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo, pitrou

___
Python tracker 

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



[issue14774] _sysconfigdata.py doesn't support multiple build configurations

2012-05-10 Thread Éric Araujo

Éric Araujo  added the comment:

Would always recreating _sysconfigdata.py solve the problem?

--

___
Python tracker 

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



[issue14772] Return destination values in some shutil functions

2012-05-10 Thread Éric Araujo

Éric Araujo  added the comment:

packaging/distutils2 definitely needs that; the similar functions in 
distutils.file_util used to return the file paths, this was lost in the 
conversion to shutil, and there is at least one open bug that needs it back.

--
nosy: +eric.araujo

___
Python tracker 

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



[issue14772] Return destination values in some shutil functions

2012-05-10 Thread Brian Curtin

Brian Curtin  added the comment:

When you say "needs that", do you mean the patch as-is, or Hynek's suggestion 
to return consistently?

--

___
Python tracker 

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



[issue14776] Add SystemTap static markers

2012-05-10 Thread Éric Araujo

Éric Araujo  added the comment:

I think the doc may be more at home in the Developer’s Guide (like the doc 
about GDB) rather that the new-user-oriented “Setup and Usage” doc.

--
nosy: +eric.araujo

___
Python tracker 

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



[issue14776] Add SystemTap static markers

2012-05-10 Thread Éric Araujo

Éric Araujo  added the comment:

BTW if you don’t get feedback in a week or two you could go to python-dev; if 
there is no controversy nor implications on third-party code this will likely 
not require a PEP, only agreement between the core devs.  Good luck!

--

___
Python tracker 

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



[issue14772] Return destination values in some shutil functions

2012-05-10 Thread Éric Araujo

Éric Araujo  added the comment:

I meant that packaging needs some shutil functions to return the destination, 
but haven’t checked to see if that includes copytree.

--

___
Python tracker 

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



[issue14770] Minor documentation fixes

2012-05-10 Thread Éric Araujo

Éric Araujo  added the comment:

A lot of good editions!

  +``$PATH``::

Would it be worth using :envvar:`PATH` here?  Python-specific envvars (e.g. 
PYTHONPATH) are documented and can be linked to, maybe a small entry to explain 
common envvars like HOME and PATH would be a useful addition for novice 
programmers.

  +module in the :file:`Modules` subdirectory,

You can also use :source:`Modules` to generate a link to the repo; for people 
who don’t know how to get a Python clone or source distribution (or don’t want 
to), a link is better than just a file name.

  +When run, this will produce the following output::

Using “.. code-block:: none” here would avoid misleading colorization.

  -Thus, to read n bytes from a pipe p created with :func:`os.popen`, you need 
to
  +Thus, to read n bytes from a pipe *p* created with :func:`os.popen`, you 
need to

I’d mark up *n* too.

  +varies between systems; sometimes it is ``/usr/lib/sendmail``, sometimes

That’s a program name too, so for consistency you could use :program:, although 
I’m not sure that role is worth using.

  +By default :mod:`pickle` uses a relatively old and slow format for backward
  +compatibility.

I trust you will update that comment for the 3.x version.

--

___
Python tracker 

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



[issue14780] SSL should use OpenSSL-defined default certificate store if ca_certs parameter is omitted

2012-05-10 Thread James Oakley

New submission from James Oakley :

OpenSSL provides a method, SSL_CTX_set_default_verify_paths(), for loading a 
default certificate store, which is used by many distributions.

In openSUSE, the default store is not a bundle, but a directory-based store, 
which is not supported at all by the SSL module in Python 2.7. A bug related to 
this was assigned to me here:

https://bugzilla.novell.com/show_bug.cgi?id=761501

I created patches for the Python 2.7.3 and 3.2.3 SSL modules that will load the 
distribution-specific store if ca_certs is omitted.

--
components: Library (Lib)
files: python-2.7.3-ssl_default_certs.patch
keywords: patch
messages: 160392
nosy: jfunk
priority: normal
severity: normal
status: open
title: SSL should use OpenSSL-defined default certificate store if ca_certs 
parameter is omitted
type: enhancement
Added file: 
http://bugs.python.org/file25533/python-2.7.3-ssl_default_certs.patch

___
Python tracker 

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



[issue14780] SSL should use OpenSSL-defined default certificate store if ca_certs parameter is omitted

2012-05-10 Thread James Oakley

James Oakley  added the comment:

Here's the patch for Python 3.

--
Added file: 
http://bugs.python.org/file25534/python-3.2.3-ssl_default_certs.patch

___
Python tracker 

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



[issue14588] PEP 3115 compliant dynamic class creation

2012-05-10 Thread Nick Coghlan

Nick Coghlan  added the comment:

Based on the python-dev thread [1], the proposed name for this API is now 
"types.new_class()".

This parallels the existing imp.new_module() naming scheme and avoids various 
problems with the idea of using a static method on type itself (descriptors on 
type behave strangely, and the type namespace is accessible through *all* type 
objects, which would be weird in this case).

Since types is a Python module, we now have to choose between 3 implementation 
strategies:
- reimplement in pure Python (my preferred choice)
- implement in terms of __build_class__ (would work, but may not be portable to 
other implementations and/or serves as a de facto promotion of __build_class__ 
up to being part of the language specification)
- move Daniel's existing operator module based solution over to a new _types C 
extension module (again, may not help other implementations)

The reason I find the idea of a pure Python reimplementation appealing is that 
it can then serve as a cross-check for any other implementations implementing 
PEP 3115 for their class statements.

[1] http://mail.python.org/pipermail/python-dev/2012-May/119318.html

--

___
Python tracker 

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



[issue14662] shutil.move doesn't handle ENOTSUP raised by chflags on OS X

2012-05-10 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset e12efebc3ba6 by Ned Deily in branch '2.7':
Issue #14662: Prevent shutil failures on OS X when destination does not
http://hg.python.org/cpython/rev/e12efebc3ba6

New changeset ae141eebcf96 by Ned Deily in branch '3.2':
Issue #14662: Prevent shutil failures on OS X when destination does not
http://hg.python.org/cpython/rev/ae141eebcf96

New changeset 93599d5e0a23 by Ned Deily in branch 'default':
Issue #14662: Prevent shutil failures on OS X when destination does not
http://hg.python.org/cpython/rev/93599d5e0a23

--
nosy: +python-dev

___
Python tracker 

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



[issue14662] shutil.move doesn't handle ENOTSUP raised by chflags on OS X

2012-05-10 Thread Ned Deily

Ned Deily  added the comment:

Thanks for the patch!  Tested with an NFS-mounted file system on OS X.  Applied 
for 2.7.4, 3.2.4, and 3.3.0.

--
resolution:  -> fixed
stage: patch review -> 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



[issue14780] SSL should use OpenSSL-defined default certificate store if ca_certs parameter is omitted

2012-05-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Well, this is basically a change in behaviour, so it could only go in the 
default branch (3.3). But 3.3 already has 
SSLContext.set_default_verify_paths(), so it's not obvious why the patch is 
needed.

(furthermore, automatically selecting the system-wide certificates could be 
surprising. There may be applications where you don't want to trust them.)

--
nosy: +pitrou

___
Python tracker 

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



[issue14780] SSL should use OpenSSL-defined default certificate store if ca_certs parameter is omitted

2012-05-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

By the way, I see that the original bug is against the python-requests library? 
Perhaps it would be better to advocate the use of load_verify_locations() 
there, since it's a more adequate place for a policy decision.

(that said, Python's own urllib.request could perhaps grow a similar option)

--

___
Python tracker 

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



[issue12029] ABC registration of Exceptions

2012-05-10 Thread James Henstridge

James Henstridge  added the comment:

The documentation for ABCMeta.register() says that it makes the other class a 
"virtual subclass".  That would make the ABC a "virtual base class".

So whether the current behaviour is correct depends on whether you consider a 
"virtual base" to count as a base.  From the reasoning behind the introduction 
of ABCs, it certainly sounds like it should count.

Also, this is a feature that works correctly in Pyton 2.7, so could trip people 
up who are trying to move to Python 3.

--
nosy: +jamesh

___
Python tracker 

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



[issue14776] Add SystemTap static markers

2012-05-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Well, at least it looks much cleaner that the dtrace patch.

Two comments still:
- is pysystemtap.h meant to be a public header? otherwise it should perhaps not 
end up in Include (I'm not sure what our policy is here)
- perhaps get_frame_marker_info() and friends could still be a in separate 
ceval-systemtap.h file? that way the only added complication in ceval.c would 
be a couple of includes, and the two `if`s in the eval loop

--
nosy: +jcea, loewis, pitrou

___
Python tracker 

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



[issue14774] _sysconfigdata.py doesn't support multiple build configurations

2012-05-10 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Is there a way of fixing this whilst keeping it a python file?  Or do
> we need to build from a C file, perhaps?

Well I hope we don't make it a C file just for that reason. It would complicate 
the generation code quite a bit (right now it's just 3 lines long).

I tend to use separate clones myself (actually, I use "hg share" to avoid 
multiple pulls).

--

___
Python tracker 

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



[issue4841] io's close() not handling errors correctly

2012-05-10 Thread Hynek Schlawack

Changes by Hynek Schlawack :


--
nosy: +hynek

___
Python tracker 

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