[issue8510] update to autoconf2.65

2010-05-09 Thread Mark Dickinson

Mark Dickinson  added the comment:

r81004: Remove extra closing bracket and comma introduced in r80969.  (This was 
causing misdetection of the OS X 10.5 SDK on Linux and OS X, and a 
test_platform failure on OS X.)

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue8324] add a distutils test command

2010-05-09 Thread Michael Foord

Michael Foord  added the comment:

Adapting the setuptools command is a great way to start of course. Please see 
my note about using unittest/unittest2 test discovery as a default command if 
unitest2 is available and no test_suite is specified. I'm very happy to help 
with this.

--

___
Python tracker 

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



[issue8635] enumerate() docstring doesn't cover optional start argument

2010-05-09 Thread Daniel Urban

Daniel Urban  added the comment:

Attached a patch. It changes the docstring to:
"enumerate(iterable[, start]) -> iterator for index, value of iterable

Return an enumerate object.  iterable must be another object that supports
iteration, start must be an integer (defaults to 0).  The enumerate object
yields pairs containing a count (from start) and a value yielded by the
iterable argument.  enumerate is useful for obtaining an indexed list:
(0, seq[0]), (1, seq[1]), (2, seq[2]), ..."

--
keywords: +patch
nosy: +durban
Added file: http://bugs.python.org/file17271/issue8635.diff

___
Python tracker 

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



[issue8644] timedelta.total_seconds needlessly inaccurate, especially for negative timedeltas

2010-05-09 Thread Mark Dickinson

Mark Dickinson  added the comment:

Perfect!  Applied in r81020.

You're correct that n/10**6 and n/1e6 aren't the same thing, at least for n 
large enough:

Python 2.7b2+ (trunk:81019:81020, May  9 2010, 10:33:17) 
[GCC 4.2.1 (Apple Inc. build 5659)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from __future__ import division
[35402 refs]
>>> (2**53+1)/10**6
9007199254.740993
[35404 refs]
>>> (2**53+1)/1e6
9007199254.740992
[35404 refs]

In the second case, 2**53+1 first gets converted to a float, and then the 
division is performed, so there are two points at which a rounding error can be 
introduced.  The first case only involves one rounding error.

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



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

2010-05-09 Thread Mark Dickinson

Mark Dickinson  added the comment:

Hmm.  The 'delay_traps' context manager idea doesn't quite work here.  A 
problem occurs if (for example) an Overflow occurs during the with block;  in 
that case, Overflow should be raised at the end of the with block.  That's 
fine, except that we no longer know what sign it should be raised with---the 
flags accumulated in the temporary context that's active within the with block 
don't remember this information.  So something more elaborate (though probably 
still along the same lines) would be necessary.

The decimal module has a major defect that's making this awkward, namely that 
there's currently no easy way to implement custom trap handling.  A custom trap 
handler could simply record each exception as it occurred.  IEEE 754-2008 
recommends that such trap handling exists (in section 8), though the language 
used is "should" (i.e., is recommended to), rather than "shall" (is required 
to).

One simple change that might help would be to have all Decimal exceptions 
derive from a common `DecimalException` superclass, making it easier to catch 
just decimal exceptions in a try-except block.

--

___
Python tracker 

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



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

2010-05-09 Thread Mark Dickinson

Mark Dickinson  added the comment:

Umm.  Please pretend I didn't write this:

> One simple change that might help would be to have all Decimal 
> exceptions derive from a common `DecimalException` superclass, making
> it easier to catch just decimal exceptions in a try-except block.

DecimalException already exists, of course.

--

___
Python tracker 

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



[issue4768] email.generator.Generator object bytes/str crash - b64encode() bug?

2010-05-09 Thread garazi111

garazi111  added the comment:

Hi,

I think the bug is also present in the function encode_quopri which should look 
like this :

def encode_quopri(msg):
"""Encode the message's payload in quoted-printable.

Also, add an appropriate Content-Transfer-Encoding header.
"""
orig = msg.get_payload()
encdata = _qencode(orig)
data = str(encdata, "ASCII")
msg.set_payload(data)
msg['Content-Transfer-Encoding'] = 'quoted-printable'

--
nosy: +garazi111

___
Python tracker 

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



[issue8324] add a distutils test command

2010-05-09 Thread Dan Buch

Dan Buch  added the comment:

Should I assume that unittest2 is an installation requirement of distutils2, or 
is it preferable to try using unittest2 and falling back to a custom 
TestLoader?  Sorry if I'm reading too much into this :-/

--

___
Python tracker 

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



[issue8324] add a distutils test command

2010-05-09 Thread Éric Araujo

Éric Araujo  added the comment:

unittest2 is the name of the independent release of the improved unittest 
package in 2.7’s and 3.2’s stdlib.

--

___
Python tracker 

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



[issue8324] add a distutils test command

2010-05-09 Thread Dan Buch

Dan Buch  added the comment:

@merwok I know ;-)  ... should I assume that it's an installation requirement a 
la `install_requires=['unittest2']`, or do::

try:
load_tests_with_unittest2()
except ImportError:
load_tests_with_custom_test_loader()

?

--

___
Python tracker 

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



[issue8588] test_urllib2.py test failures on Py3K Mac OS X

2010-05-09 Thread Mark Dickinson

Mark Dickinson  added the comment:

Fixed in r81024 (py3k), r81025 (release31-maint).

--
components: +Library (Lib)
nosy: +mark.dickinson
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue8324] add a distutils test command

2010-05-09 Thread Éric Araujo

Éric Araujo  added the comment:

Not a unittest expert, but I suspect that usual test for features will work:

try:
from unittest.something.discovery import Loader
except ImportError:
from unittest2.something.discovery import Loader

Adding Konrad to nosy, since adding new commands will be his GSoC work.

(Also adjusting versions and removing the gsoc keyword that means “Issue is a 
good candidate for Google’s Summer of Code”, not “Issue part of an accepted 
GSoC project”)

--
versions: +Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 
3.3

___
Python tracker 

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



[issue8324] add a distutils test command

2010-05-09 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +konryd

___
Python tracker 

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



[issue8324] add a distutils test command

2010-05-09 Thread Éric Araujo

Changes by Éric Araujo :


--
keywords:  -gsoc

___
Python tracker 

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



[issue8665] "make pycremoval" fails

2010-05-09 Thread Éric Araujo

Éric Araujo  added the comment:

Suggestion: rm -rf __pycache__ dirs before using find for stray pycs.

--
nosy: +merwok

___
Python tracker 

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



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

2010-05-09 Thread Foehn of blue

Foehn of blue  added the comment:

Can you teach me how to Writing programs?
Please!!!
I'm from Taiwan
That's my e-mail:foehnofb...@kimo.com

--
nosy: +foehn blue

___
Python tracker 

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



[issue8324] add a distutils test command

2010-05-09 Thread Michael Foord

Michael Foord  added the comment:

unittest2 is used for distutils2 development, but *not* a required dependency 
for *using* distutils2 (if I understand correctly(.

Well, if there is no test runner and no test suite specified but the test 
command is invoked then the steps should probably be something like:

* If Python version 2.7+ or 3.2+ then use test discovery from unittest
* If Python version 3.0, 3.1 or 2.6- then attempt to import unittest2 and do 
test discovery
* Otherwise do nothing

Test discovery is done with unittest(2).TestLoader.discover(...)

If a specific test runner or suite is provided then distutils2 should use those 
and need not attempt test discovery (again - my understanding).

So test discovery is a useful default if no test command is configured for a 
project. We may also want ways to configure that (for example allow a project 
to have test discovery for its test command but provide a different pattern for 
finding test files).

--

___
Python tracker 

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



[issue8324] add a distutils test command

2010-05-09 Thread Michael Foord

Michael Foord  added the comment:

Documentation for unittest.TestLoader.discover(...) is at:

http://docs.python.org/dev/library/unittest.html#unittest.TestLoader.discover

--

___
Python tracker 

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



[issue8671] A small erorr on http://docs.python.org/library/re.html

2010-05-09 Thread bones7456

New submission from bones7456 :

In section \b , original text is:

Matches the empty string, but only at the beginning or end of a word. A word is 
defined as a sequence of alphanumeric or underscore characters, so the end of a 
word is indicated by whitespace or a non-alphanumeric, non-underscore 
character. Note that \b  is defined as the boundary between \w and \ W, so the 
precise set of characters deemed to be alphanumeric depends on the values of 
the UNICODE and LOCALE flags. Inside a character range, \b  represents the 
backspace character, for compatibility with Python’s string literals.

NOTE: there is space between "\" and "W", I think it is not needed.

--
assignee: d...@python
components: Documentation
messages: 105391
nosy: bones7456, d...@python
priority: normal
severity: normal
status: open
title: A small erorr on http://docs.python.org/library/re.html
versions: Python 2.6

___
Python tracker 

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



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

2010-05-09 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--

___
Python tracker 

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



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

2010-05-09 Thread Éric Araujo

Éric Araujo  added the comment:

Foehn, bugs.python.org is used for discussing and solving bugs in Python, not 
general discussion about programming. There are Web forums and IRC rooms where 
your question could get answered.

I will answer you, but please do not post other unrelated messages. Try the 
tutorials on docs.python.org/tutorial or diveintopython3.org

--
nosy: +merwok

___
Python tracker 

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



[issue8324] add a distutils test command

2010-05-09 Thread Dan Buch

Dan Buch  added the comment:

@mfoord thank you for the clarification! :)

--

___
Python tracker 

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



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

2010-05-09 Thread anatoly techtonik

anatoly techtonik  added the comment:

Let's quote RFC 3339:
"""
4.3. Unknown Local Offset Convention

   If the time in UTC is known, but the offset to local time is unknown,
   this can be represented with an offset of "-00:00".  This differs
   semantically from an offset of "Z" or "+00:00", which imply that UTC
   is the preferred reference point for the specified time.  RFC2822
   [IMAIL-UPDATE] describes a similar convention for email.
"""

The phrase "this CAN be represented" doesn't mean that it SHOULD be 
represented. Do we have information to decide if offset to local zone is 
unknown or if UTC is the preferred reference point for specified time? I guess 
no, and I am afraid that most users just don't care or don't want to bog into 
details - all they need is a good Atom looking timestamp. As we are not aiming 
at making a reference library for generating all possible forms of valid RFC 
3339 timestamps, it makes sense to use 'Z' in the end because it is easier to 
handle.

rfcformat(dt).replace("Z", "-00:00") in case somebody need a -00:00 is easier 
than reverse operation if you need 'Z' in the end:

dstr = rfcformat(dt)
if dstr.endswith("-00:00") or dstr.endswith("+00:00"):
dstr = dstr[:-6] + 'Z'

--

___
Python tracker 

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



[issue8671] A small erorr on http://docs.python.org/library/re.html

2010-05-09 Thread Eric Smith

Eric Smith  added the comment:

Fixed in:
trunk: r81026
release26-maint: r81027

It was already correct in py3k and release31-maint.

Thanks!

--
nosy: +eric.smith
resolution:  -> accepted
stage:  -> committed/rejected
status: open -> closed
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



[issue6878] changed return type from tkinter.Canvas.coords

2010-05-09 Thread Éric Araujo

Éric Araujo  added the comment:

Attaching patch based on py3k, please review. (Mercurial diff, use patch -p1)

--
keywords: +patch
nosy: +gpolo, merwok
stage: needs patch -> patch review
title: outdated docstring in tkinter.Canvas.coords -> changed return type from 
tkinter.Canvas.coords
Added file: http://bugs.python.org/file17272/fix-6878.patch

___
Python tracker 

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



[issue6320] Standard string encodings should include GSM0.38

2010-05-09 Thread Éric Araujo

Éric Araujo  added the comment:

Are there many GSM libraries or applications out there? If not, maybe the codec 
is best left in your lib, since it wouldn’t be useful for a wide range of uses.

Note also that 2.7 is frozen, so substitute “py3k branch” for “trunk” in 
Antoine’s previous comment.

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



[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-09 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Daniel Stutzbach wrote:
> 
> Daniel Stutzbach  added the comment:
> 
> On Sat, May 8, 2010 at 11:35 AM, Marc-Andre Lemburg
>  wrote:
>> One of the more important cases you are missing is the
>> argument parser in Python:
> 
> Thanks.  I've had my head buried in c-api/unicode.html and unicodeobject.h.
> 
>> Py_UNICODE *x;
>> Py_ssize_t y;
>> PyArg_ParseTuple(args, "u#", &x, &y);
> 
> My plan is to not define Py_UNICODE in Unicode-agnostic mode, to
> prevent that from compiling.
>

And later...

undefined, I wonder if it would be sufficient to declare Py_UNICODE like this:
>
> struct PY_UNICODE_TYPE;
> typedef struct PY_UNICODE_TYPE Py_UNICODE;
>
> That would allow extensions to pass opaque Py_UNICODE pointers around, but 
> not allow them to
dereference the pointers nor evaluate sizeof(Py_UNICODE).
>
> That would make PyUnicodeObject safe, as well as PyUnicode_Encode* and 
> several other functions
(anything that doesn't manipulate individual characters, basically).

Please make sure that these compiler tricks are portable
enough across the supported Python platforms. Just checking
with GCC 4.3 is not good enough.

I suppose you could use the buildbots to gather information
on how different compilers behave (e.g. by checking in a patch,
letting the buildbots run and then reverting it, if there's
a problem). I'm just not sure how you could check for optimization
compiler bugs/features using the buildbots.

--

___
Python tracker 

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



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

2010-05-09 Thread R. David Murray

R. David Murray  added the comment:

I think Daniel's suggestion of having an option to control this is the best way 
to handle the different use cases.  And I think the default should be -00:00, 
as he suggested.

Removing 2.7 and 3.1 since 3.2 is the only branch open to new features at this 
point.

--
nosy: +r.david.murray
versions:  -Python 2.7, Python 3.1

___
Python tracker 

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



[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-09 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

On Sat, May 8, 2010 at 8:07 AM, Martin v. Löwis wrote:

> 1. add a flag to PyModuleDef, indicating whether the module was built in
> UCS-2 or UCS-4 mode. Then let the interpreter refuse the load the module,
> instead of having the dynamic linker do so.

I just thought of another risk inherit in this approach.  If the extension
module is composed of more than one C file, the extension author may
inadvertently compile the file defining the PyModuleDef in Unicode-agnostic
mode but compile another file in Unicode-sensitive mode.  Then they would
have a Unicode-sensitive extension as Unicode-agnostic, which would lead to
mysterious crashes if the Unicode settings are mismatched. :-(

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

___
Python tracker 

___On Sat, May 8, 2010 at 8:07 AM, Martin v. Löwis rep...@bugs.python.org> 
wrote:
1. add a flag to PyModuleDef, indicating whether the module was built in UCS-2 
or UCS-4 mode. Then let the interpreter refuse the load the module, instead of 
having the dynamic linker do so.I just thought of another 
risk inherit in this approach.  If the extension module is composed of more 
than one C file, the extension author may inadvertently compile the file 
defining the PyModuleDef in Unicode-agnostic mode but compile another file in 
Unicode-sensitive mode.  Then they would have a Unicode-sensitive extension as 
Unicode-agnostic, which would lead to mysterious crashes if the Unicode 
settings are mismatched. :-(

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



[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-09 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

On Sun, May 9, 2010 at 10:12 AM, Marc-Andre Lemburg
wrote:

> I'm just not sure how you could check for optimization
> compiler bugs/features using the buildbots.
>

Once I have a patch that I'm modestly confident in, I'll write automated
tests to go with it.

The tests will (at minimum):

- Create a tweaked copy of pyconfig.h that uses the opposite Unicode
settings (UCS4 v UCS2)

- Build an extension module in Unicode-agnostic mode
- Make sure it loads and works

- Build an extension module in Unicode-sensitive mode
- Make sure it doesn't load

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

___
Python tracker 

___On Sun, May 9, 2010 at 10:12 AM, Marc-Andre Lemburg 
rep...@bugs.python.org> 
wrote:
I'm just not sure how you could check for optimization
compiler bugs/features using the buildbots.Once I 
have a patch that I'm modestly confident in, I'll write automated tests 
to go with it.The tests will (at minimum):- Create a tweaked 
copy of pyconfig.h that uses the opposite Unicode settings (UCS4 v UCS2)
- Build an extension module in Unicode-agnostic mode- Make sure it 
loads and works- Build an extension module in Unicode-sensitive mode
- Make sure it doesn't load
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-09 Thread Daniel Stutzbach

Changes by Daniel Stutzbach :


Removed file: http://bugs.python.org/file17273/unnamed

___
Python tracker 

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



[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-09 Thread Daniel Stutzbach

Changes by Daniel Stutzbach :


Removed file: http://bugs.python.org/file17274/unnamed

___
Python tracker 

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



[issue8312] Add post/pre hooks for distutils commands

2010-05-09 Thread Konrad Delong

Changes by Konrad Delong :


--
nosy: +konryd

___
Python tracker 

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



[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

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

Martin v. Löwis  added the comment:

> I just thought of another risk inherit in this approach.  If the extension
> module is composed of more than one C file, the extension author may
> inadvertently compile the file defining the PyModuleDef in Unicode-agnostic
> mode but compile another file in Unicode-sensitive mode.

I wouldn't worry about this case.

--

___
Python tracker 

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



[issue4972] let's equip ftplib.FTP with __enter__ and __exit__

2010-05-09 Thread Stuart Axon

Stuart Axon  added the comment:

It would be good for consistency, yes.

--

___
Python tracker 

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



[issue1474680] pickling files works with protocol=2.

2010-05-09 Thread Éric Araujo

Éric Araujo  added the comment:

Antoine, I think the goal here is to disable pickling, not making it work.

Alexandre, is it ok for a class to define pickle magic methods just to raise an 
exception? Doesn’t it break expectations?

One question hasn’t been answered: When did the protocol change? Was it 
intentional or is it a bug?

--
nosy: +merwok

___
Python tracker 

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



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

2010-05-09 Thread Daniel Urban

Daniel Urban  added the comment:

Here is a new patch.

The name of the optional argument is "default_utcoffset" which is obviously too 
long, but I can't think a better name. Any suggestions? (I think simply 
"utcoffset" would be misleading, because the value of the argument is only used 
for naive instances.)

In Modules/datetimemodule.c (in line 4375) I call Py_INCREF on the PyUnicode 
instance returned by PyArg_ParseTupleAndKeywords. I'm not sure this is the 
right thing to do. I'm doing it because the doc says that the reference count 
of an object returned by PyArg_ParseTupleAndKeywords shouldn't be decremented, 
and I think PyUnicode_AppendAndDel calls Py_XDECREF on its second argument.
Can anyone correct or confirm me on this? Thanks.

--
Added file: http://bugs.python.org/file17275/issue7584_2.diff

___
Python tracker 

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



[issue6878] changed return type from tkinter.Canvas.coords

2010-05-09 Thread Guilherme Polo

Guilherme Polo  added the comment:

Weird.. I was almost sure that was fixed at some point.

The patch is fine, but I would suggest adding some simple testcase(s).
This will probably require a new file (test_canvas.py) at
Lib/tkinter/test/test_tkinter.

--

___
Python tracker 

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



[issue3704] cookielib doesn't handle URLs with / in parameters

2010-05-09 Thread John J Lee

John J Lee  added the comment:

It looks to me that it's just request_path that's wrong, so no need to add 
extra arguments to that function.  It should discard the query and fragment 
(still keeping the "parameters" -- using urlparse.urlsplit instead of 
urlparse.urlparse would make that simpler).

request_path is only called in three places:

 * We're agreed that the default cookie path should omit the query (and 
fragment)
 * Netscape cookies aren't checked for path on setting cookies 
(.set_ok_path()), so the value of request_path isn't checked in that case
 * Netscape cookies are checked for path on returning cookies, but including 
the query & fragment will never make a difference to the .startswith check in 
.path_return_ok()

Finally, even RFC 2965, which nobody cares about, and which does include the 
path check on setting the cookie, refers to RFC 2396 for the definition of 
request-URI, and both RFC 2396 and RFC 3986, which obsoletes it, agree that the 
path doesn't include the query (nor the fragment).

Incidentally: the request_path function docstring claims to return the 
request-URI, but obviously the docstring should say it returns the path 
component of the request-URI.

--

___
Python tracker 

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



[issue4972] let's equip ftplib.FTP with __enter__ and __exit__

2010-05-09 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

A patch including tests and doc changes is in attachment.

--
versions: +Python 3.2 -Python 2.7, Python 3.1
Added file: http://bugs.python.org/file17276/ftplib.patch

___
Python tracker 

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



[issue4972] let's equip ftplib.FTP with __enter__ and __exit__

2010-05-09 Thread Éric Araujo

Éric Araujo  added the comment:

Magic methods usually don’t have docstrings, since they implement one operation 
that is described in one place (think __len__ vs. len). You could remove the 
doc of __enter__ and turn the doc of __exit__ into a comment or move it to the 
reST file when you say that FTP supports the context management protocol.

What did you add a cmd_noop method that does the same thing as cmd_user for?

Will the change from handler to handler_instance not break third-party code?

--
nosy: +merwok

___
Python tracker 

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



[issue8425] a -= b should be fast if a is a small set and b is a large set

2010-05-09 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
nosy: +belopolsky

___
Python tracker 

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



[issue4972] let's equip ftplib.FTP with __enter__ and __exit__

2010-05-09 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

> Magic methods usually don’t have docstrings, since they implement one 
> operation that is described in one place (think __len__ vs. len).

Agreed, I only left it since it was there in the first place.

> What did you add a cmd_noop method that does the same thing as
> cmd_user for?

Basically all DummyFTPHandler commands are no-ops except pasv, port, retr, stor 
and some others. There's no real reason why I added NOOP except for consistency 
with the FTP procol.
What I wanted to do in the new tests was just sending a command and receive a 
response and the "correct" way to do that in FTP is using NOOP.

> Will the change from handler to handler_instance not break 
> third-party code?

Not sure what you mean by "third party code" but it shouldn't break the 
existing tests if that's what you're worried about.
I did that because the original server behavior was to accept only one 
connection and I needed to connect more than one client in the same test.

--

___
Python tracker 

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



[issue4972] let's equip ftplib.FTP with __enter__ and __exit__

2010-05-09 Thread Éric Araujo

Éric Araujo  added the comment:

Re-reading the patch, I notice it’s in the test module, not on the FTP
class, so I guess it’s perfectly fine. Is the string returned by a real
FTP server “331 username ok”? (My point is that I think it would be
better to have different strings for cmd_noop and cmd_user.)

I meant code outside the standard library. I thought this was in ftplib,
but since it’s in test_ftplib we don’t have to fear breaking other
people’s code.

In summary, the diff for ftplib seems good to me, with a minor remark
about the docstrings, and I don’t feel confident enough to give a review
about the tests.

--

___
Python tracker 

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



[issue6588] insert cookies into cookie jar - cookielib.py

2010-05-09 Thread John J Lee

John J Lee  added the comment:

Jon,

If you want to get these changes applied you need to:

 1. Split up these three separate issues
 2. Most important: explain in full detail exactly how you used cookielib, what 
you expected it to do, and what it actually did, and then justify why your 
expectation is correct.
 3. Ensure that automated tests cover each change
 4. Respond to the review comments that are likely to follow

--
nosy: +jjlee

___
Python tracker 

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



[issue6588] insert cookies into cookie jar - cookielib.py

2010-05-09 Thread Éric Araujo

Éric Araujo  added the comment:

Minor remarks:
- generate your patch from the top-level directory, so that people can just 
apply the patch from there (see http://www.python.org/dev/patches/);
- don’t put two statements on one line (“if thing: dostuff()”), as per PEP 8.

--
nosy: +merwok

___
Python tracker 

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



[issue4972] let's equip ftplib.FTP with __enter__ and __exit__

2010-05-09 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

> Is the string returned by a real FTP server “331 username ok”? (My 
> point is that I think it would be better to have different strings for 
> cmd_noop and cmd_user.)

Whoops! No that should have been "200 noop ok". 
I copied cmd_user code and forgot to modify the response string. 
Thanks.

New patch in attachment (I changed the doc a little bit including the "with" 
example usage in ftplib.rst other than just in what's new).

--
Added file: http://bugs.python.org/file17277/ftplib.patch

___
Python tracker 

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



[issue4972] let's equip ftplib.FTP with __enter__ and __exit__

2010-05-09 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


Removed file: http://bugs.python.org/file17276/ftplib.patch

___
Python tracker 

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



[issue4972] let's equip ftplib.FTP with __enter__ and __exit__

2010-05-09 Thread Éric Araujo

Éric Araujo  added the comment:

Ah, I’m glad I had one interesting comment out of three in my first
message :)

This change, although nice, seems a bit trivial for warranting taking so
much place in the what’s new. Or perhaps it’s a good thing; I don’t know
if people are aware of the goodness of the with statement far and wide.
I’m sure amk will edit the document if he thinks the example is out of
place.

--

___
Python tracker 

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



[issue5537] LWPCookieJar cannot handle cookies with expirations of 2038 or greater on 32-bit platforms

2010-05-09 Thread John J Lee

John J Lee  added the comment:

Shouldn't module time be changed to use a cross-platform implementation that 
uses a 64 bit time_t-like type?  Apparently Perl 6 has made the equivalent 
change.

Admittedly there seems to be no sign of that actually happening.

--
nosy: +jjlee

___
Python tracker 

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



[issue8653] urlparse.urlparse/urlsplit doc missing

2010-05-09 Thread Dave Abrahams

Dave Abrahams  added the comment:

At Sat, 08 May 2010 22:18:13 +,
Éric Araujo wrote:
> 
> 
> Éric Araujo  added the comment:
> 
> I think you mean 
> http://docs.python.org/library/urlparse.html#urlparse.urlparse
> 
> Dave, perhaps you were looking at an older version? Doc fixes for
> maintainance branches are welcome.

No, I was looking at (and reporting on) the docstrings.

--

___
Python tracker 

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



[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-09 Thread Daniel Stutzbach

Changes by Daniel Stutzbach :


Removed file: http://bugs.python.org/file17248/unicode.patch

___
Python tracker 

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



[issue8324] add a distutils test command

2010-05-09 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

@Eric: I asked for the gsoc keyword to make my work easier in bug triage. And 
as a matter of fact, it means that the issue part of the GSoC.

--
keywords: +gsoc

___
Python tracker 

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



[issue4908] Implement PEP 376

2010-05-09 Thread Tarek Ziadé

Changes by Tarek Ziadé :


--
resolution: accepted -> duplicate
superseder:  -> Implement pkgutil APIs as described in PEP 376

___
Python tracker 

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



[issue4908] Implement PEP 376

2010-05-09 Thread Tarek Ziadé

Changes by Tarek Ziadé :


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



[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-09 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

Here is a new patch.

Usage, short version: 

By default, modules compile in Unicode-agnostic mode, where Py_UNICODE is an 
incomplete type.  Unicode-agnostic modules will load in both UCS2 and UCS4 
interpreters.

If a module defines PY_REAL_PY_UNICODE before including Python.h, Py_UNICODE 
will be a complete type.  The module can then dereference Py_UNICODE pointers 
and use sizeof(Py_UNICODE).  Attempting to load the module into a mismatched 
interpreter will cause an ImportError.

Longer version:

In Unicode-agnostic mode, extensions can pass around Py_UNICODE pointers 
freely, but they will get a compilation error if they attempt to dereference 
the pointer or use sizeof(Py_UNICODE).  In Unicode-agnostic mode, the following 
are never defined: Py_UNICODE_SIZE, Py_UNICODE_WIDE, HAVE_USABLE_CHAR_T, and 
functions and macros take Py_UNICODE as parameter or return it.

Passing a Py_UNICODE pointer to a function that expects a wchar_t * (or 
something similar) will compile, but will generate an incompatible pointer 
types warning.

Per MvL's suggestion, the patch adds a flag field to PyModuleDef_Base and 
defines two flags: one to indicate if the module depends on the Unicode width, 
and another to indicate the width the module was compiled with.  These flags 
are checked in PyModule_Create2.

The patch includes unit tests to ensure that importing works or doesn't work in 
the correct cases.

19 of the 77 modules in Modules/ needed PY_REAL_PY_UNICODE.  

18 of them failed to compile without it (good!).

1 of them (_tkinter.c) output an "incompatible pointer types" warning without 
it, but compiled anyway (resulting in bad code - without evidence to the 
contrary it assumed Python was UCS2).

I ran the test suite with a UCS2 Python and a UCS4 Python on Linux.  I had 
hoped to run the test suite on Windows as well, but many tests are failing on 
Windows even without the patch.

--
Added file: http://bugs.python.org/file17278/unicode.patch

___
Python tracker 

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



[issue8672] Error decompressing valid zlib data

2010-05-09 Thread Matthew Brett

New submission from Matthew Brett :

I have a valid zlib compressed string, attached here as 'mat.bin' (1.7M), that 
cause and error on zlib.decompress decompression:

>>> import zlib
>>> data = open('mat.bin', 'rb').read()
>>> out = zlib.decompress(data)
Traceback (most recent call last):
  File "", line 1, in 
error: Error -5 while decompressing data

I know these data are valid, because I get the string I was expecting with:

>>> dc_obj = zlib.decompressobj()
>>> out = dc_obj.decompress(data)

As expected, there is no remaining data after this read:

>>> assert dc_obj.flush() == ''
>>> 

I believe that the behavior of zlib.decompress(data) and 
zlib.decompressobj().decompress(data) should be equivalent, and that the error 
for zlib.decompress(data) is therefore the symptom of a bug.

--
components: IO
files: mat.bin
messages: 105420
nosy: matthew.brett
priority: normal
severity: normal
status: open
title: Error decompressing valid zlib data
type: behavior
versions: Python 2.6, Python 3.1
Added file: http://bugs.python.org/file17279/mat.bin

___
Python tracker 

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



[issue8672] Error decompressing valid zlib data

2010-05-09 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
components: +Library (Lib) -IO
stage:  -> needs patch
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



[issue4256] optparse/argparse: provide a simple way to get a programmatically useful list of options

2010-05-09 Thread Filip Gruszczyński

Filip Gruszczyński  added the comment:

So, is there any decision here, so that I could get down to providing better 
patch?

--

___
Python tracker 

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



[issue8256] TypeError: bad argument type for built-in operation

2010-05-09 Thread Filip Gruszczyński

Filip Gruszczyński  added the comment:

Bump! Is there anything happening about this bug? Is my patch any good or 
should I try to work on something different?

--

___
Python tracker 

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



[issue8666] Allow ConfigParser.get*() to take a default value

2010-05-09 Thread Tim Chase

Tim Chase  added the comment:

Yes, the use-case is the same as a dict.get(key, default) which I frequently 
use -- so it can be used in things like

  result = some_function(
 cp.get('MySection', 'MyValue', default='hello'),
 cp.getint('MySection', 'MyInt', default=42)
 )

To write something similar with the current ConfigParser requires a lot more 
code or an inelegant wrapper (either passing the config-parser object each 
call, or capturing the parser object in a closure which makes the "def" 
something repeated):

  try:
mv = cp.get('MySection', 'MyValue')
  except (NoSectionError, NoOptionError), e:
mv = 'hello'
  try:
mi = cp.getint('MySection', 'MyInt')
  except (NoSectionError, NoOptionError), e:
mi = 42
  result = some_function(mv, mi)
  del mv, mi  # leaving the namespace as it was before

The above can be done in a scattering of wrapper functions, but the addition in 
stock ConfigParser prevents a lot of duplicate code.  This is the fourth 
project in which I've used the ConfigParser and have reached for a default 
value in every one of them, to be frustrated by the lack.

The old-style "raise ValueError" you mention was the original code (just 
indented), but I've changed it to the preferred format.

For the dangling close-paren or "):" on its own line, I tend to do it for the 
same reason a trailing comma is allowed/encouraged in lists/tuples/dicts/param 
lists, so it's easy to add further comma-separated entries without giving 
cluttered diffs.  The source against which I'm patching has several dangling 
close-parens already (search for "^\s*)" to find the calls to re.compile).

I pulled down the branches/py3k and patched against it. (attached)

--
Added file: http://bugs.python.org/file17280/configparser.diff

___
Python tracker 

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



[issue3704] cookielib doesn't handle URLs with / in parameters

2010-05-09 Thread Tres Seaver

Tres Seaver  added the comment:

As long as we don't care about preserving backward compatibility, we
could indeed just change the behavior of 'request_path'.  It isn't
documented as an API of the cookielib module, but it does have a
docstring which promises certain semantics.

--

___
Python tracker 

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



[issue4256] optparse/argparse: provide a simple way to get a programmatically useful list of options

2010-05-09 Thread Steven Bethard

Steven Bethard  added the comment:

2010/5/9 Filip Gruszczyński :
> So, is there any decision here, so that I could get down to providing better 
> patch?

I guess I'd like to hear from someone about how these things work in
zsh. If we're going to add a hidden flag to *all* parsers, we should
really make sure it's compatible/useful for as many of the shells that
support this kind of autocomplete as possible...

--

___
Python tracker 

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