[issue6420] Fix warning in nismodule.c on OpenBSD

2009-07-06 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Thanks, fixed in r73873, r73874, r73875 and r73876.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue5683] Speed up cPickle's pickling generally

2009-07-06 Thread Jerry Chen

Jerry Chen  added the comment:

Applied collinwinter's patch and svn up'd to r73872; replaced additional
instances of self->write_func with _Pickler_Write.

Passed test_xpickle.py as referenced by issue 5665.

--
nosy: +jcsalterego
Added file: http://bugs.python.org/file14466/cpickle_writes-r73872.patch

___
Python tracker 

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



[issue6431] Fraction fails equality test with a user-defined type

2009-07-06 Thread Case Van Horsen

New submission from Case Van Horsen :

I've ported the GMPY module to Python 3 and found a problem comparing
Fraction to gmpy.mpq. mpq is the rational type in gmpy and knows how to
convert a Fraction into an mpq. All operations appear to work properly
except "Fraction == mpq".

"mpq == Fraction" does work correctly. gmpy's rich comparison routine
recognizes the other argument as Fraction and converts to an mpq value
properly. However, when "Fraction == mpq" is done, the Fraction argument
is converted to a float before gmpy's rich comparison is called.

The __eq__ routine in fractions.py is:

def __eq__(a, b):
"""a == b"""
if isinstance(b, numbers.Rational):
return (a._numerator == b.numerator and
a._denominator == b.denominator)
if isinstance(b, numbers.Complex) and b.imag == 0:
b = b.real
if isinstance(b, float):
return a == a.from_float(b)
else:
# XXX: If b.__eq__ is implemented like this method, it may
# give the wrong answer after float(a) changes a's
# value. Better ways of doing this are welcome.
return float(a) == b

Shouldn't __eq__ return NotImplemented if it doesn't know how to handle
the other argument? I changed "return float(a) == b" to "return
NotImplemented" and GMPY and Python's test suite passed all tests.

I used the same logic for comparisons between gmpy.mpf and Decimal and
they all work correctly. Decimal does return NotImplemented when it
can't convert the other argument.

(GMPY 1.10 alpha2 fails due to this issue.)

--
components: Library (Lib)
messages: 90211
nosy: casevh
severity: normal
status: open
title: Fraction fails equality test with a user-defined type
type: behavior
versions: Python 3.1

___
Python tracker 

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



[issue6420] Fix warning in nismodule.c on OpenBSD

2009-07-06 Thread Henry Precheur

Henry Precheur  added the comment:

It works on OpenBSD, but I don't have any FreeBSD to test. I should be
safe to commit though, the patch is rather trivial.

--

___
Python tracker 

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



[issue6382] test_socketserver fails on trunk in test_ForkingTCPServer

2009-07-06 Thread R. David Murray

R. David Murray  added the comment:

I had to fix one line, but after that it runs successfully.  Updated
patch attached.  The change is to add the 'request' argument to the
close_request call on line 549.

--
keywords: +patch
Added file: http://bugs.python.org/file14465/issue6382.patch

___
Python tracker 

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



[issue6070] Python 2.6 makes .pyc/.pyo bytecode files executable

2009-07-06 Thread R. David Murray

R. David Murray  added the comment:

#ifndef version of the patch applied to trunk in r73870, with tests. 
Leaving open until I merge it.

--
assignee:  -> r.david.murray
nosy: +brett.cannon
resolution:  -> fixed
stage: test needed -> committed/rejected

___
Python tracker 

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



[issue6420] Fix warning in nismodule.c on OpenBSD

2009-07-06 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

What about this new patch?

--
keywords: +patch
Added file: http://bugs.python.org/file14464/nismodule.patch

___
Python tracker 

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




[issue6428] TypeError: __bool__ should return bool or int, returned int

2009-07-06 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

fixed in r73868 (py3k) and r73869 (3.1)
Thanks for the report!

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue2919] Merge profile/cProfile in 3.0

2009-07-06 Thread Alexandre Vassalotti

Changes by Alexandre Vassalotti :


Removed file: http://bugs.python.org/file14376/lsprof.py

___
Python tracker 

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



[issue2919] Merge profile/cProfile in 3.0

2009-07-06 Thread Alexandre Vassalotti

Alexandre Vassalotti  added the comment:

Here's an updated version of my lsprof.py module. I fixed a few bugs,
includes the awful reference leak that was present in the previous
version (i.e., the profiler code was keeping a reference to every frame
executed).

I consider the lsprof.py code functionally equivalent to _lsprof. Now, I
am wondering if I should add the features from profile.py missing in
_lsprof, e.g., the bias argument and the calibration code.

--
Added file: http://bugs.python.org/file14463/lsprof.py

___
Python tracker 

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



[issue6382] test_socketserver fails on trunk in test_ForkingTCPServer

2009-07-06 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

I'm uploading a patched SocketServer.py.  Could you please try it out on 
the gentoo box before I commit it?

--
Added file: http://bugs.python.org/file14462/SocketServer.py

___
Python tracker 

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



[issue6410] Dictionaries should support __add__

2009-07-06 Thread Jean-Paul Calderone

Jean-Paul Calderone  added the comment:

Cool.  I'm convinced.

--

___
Python tracker 

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



[issue6410] Dictionaries should support __add__

2009-07-06 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

ISTM these examples show how little value would come from fattening-up
the dict API.  The examples use the copy/update pattern which is clear,
explicit, and extendable to n-ary cases without incurring O(n**2)
behavior.  Tranforming them to a f=d+e pattern saves a few characters;
doesn't add any speed; makes it less clear that we're operating on
dictionaries; and does not extend well to the n-ary case (f=a+b+c+d+e
which copies a's elements five times, b's four times, etc.)  No new
functionality gets added -- all this is is a piece of syntactic sugar
that obscures what is going-on under the hood.  The dict API is one of
the most fundamental in the language; it needs to be kept as clean and
hazard-free as possible.

--

___
Python tracker 

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



[issue5885] uuid.uuid1() is too slow

2009-07-06 Thread Alexandre Vassalotti

Alexandre Vassalotti  added the comment:

Can you provide a patch?

--
nosy: +alexandre.vassalotti
priority:  -> low
stage:  -> needs patch
versions: +Python 3.2 -Python 2.4, Python 2.5, Python 2.6, Python 3.0, Python 
3.1

___
Python tracker 

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



[issue6428] TypeError: __bool__ should return bool or int, returned int

2009-07-06 Thread Eric Smith

Eric Smith  added the comment:

The patch looks good to me. In particular, removing the test for
using_len looks correct.

The assignment of "result = -1" after PyErr_Format isn't needed, but
doesn't hurt (and it was already there, anyway).

--
keywords:  -needs review
nosy: +eric.smith

___
Python tracker 

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



[issue6420] Fix warning in nismodule.c on OpenBSD

2009-07-06 Thread Henry Precheur

Henry Precheur  added the comment:

FreeBSD does.

http://svn.freebsd.org/viewvc/base/stable/7/include/rpcsvc/ypclnt.h?revision=172506&view=markup

But NetBSD doesn't:

http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/include/rpcsvc/ypclnt.h?rev=1.13&content-type=text/plain&only_with_tag=MAIN

On Mon, Jul 06, 2009 at 11:26:45PM +, Amaury Forgeot d'Arc wrote:
> 
> Amaury Forgeot d'Arc  added the comment:
> 
> Does someone know whether FreeBSD or NetBSD need the same treatment?
> 
> --
> nosy: +amaury.forgeotdarc
> 
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue6382] test_socketserver fails on trunk in test_ForkingTCPServer

2009-07-06 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

How unfortunate.  This means that we need to virtualize the shutdown. I'll 
submit a proposed patch.

--

___
Python tracker 

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



[issue2389] Array pickling exposes internal memory representation of elements

2009-07-06 Thread Alexandre Vassalotti

Alexandre Vassalotti  added the comment:

I know believe that arrays should be pickled as a list of values on
Python 2.x. Doing otherwise makes it impossible to unpickle arrays
coming from Python 2.x using Python 3.x, since pickle on Python 3
decodes all the strings from 2.x to Unicode.

However, we still can use the compact memory representation on Python 3.x.

So, I propose that we change the array module on Python 2.x to emit a
list instead of memory string and implement the portable array pickling
mechanism only on Python 3.x.

--
versions: +Python 3.2 -Python 3.1
Added file: http://bugs.python.org/file14461/portable_array_pickling-2.diff

___
Python tracker 

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



[issue6420] Fix warning in nismodule.c on OpenBSD

2009-07-06 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Does someone know whether FreeBSD or NetBSD need the same treatment?

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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



[issue6428] TypeError: __bool__ should return bool or int, returned int

2009-07-06 Thread Amaury Forgeot d'Arc

Changes by Amaury Forgeot d'Arc :


--
stage: needs patch -> patch review

___
Python tracker 

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



[issue6428] TypeError: __bool__ should return bool or int, returned int

2009-07-06 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Probably a misguided merge. Here is a patch that updates the error 
message, and the documentation.

--
keywords: +needs review, patch
nosy: +amaury.forgeotdarc
Added file: http://bugs.python.org/file14460/bool.patch

___
Python tracker 

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



[issue6410] Dictionaries should support __add__

2009-07-06 Thread Jean-Paul Calderone

Jean-Paul Calderone  added the comment:

FWIW, here are some use cases:

http://twistedmatrix.com/trac/browser/tags/releases/twisted-8.2.0/twisted/python/context.py#L32
http://twistedmatrix.com/trac/browser/tags/releases/twisted-8.2.0/twisted/python/log.py#L270
http://twistedmatrix.com/trac/browser/tags/releases/twisted-8.2.0/twisted/words/xish/utility.py#L23
http://twistedmatrix.com/trac/browser/tags/releases/twisted-8.2.0/twisted/web/microdom.py#L720
http://twistedmatrix.com/trac/browser/tags/releases/twisted-8.2.0/twisted/web/microdom.py#L738
http://twistedmatrix.com/trac/browser/tags/releases/twisted-8.2.0/twisted/test/test_adbapi.py#L370
http://twistedmatrix.com/trac/browser/tags/releases/twisted-8.2.0/twisted/test/test_zshcomp.py#L34
http://twistedmatrix.com/trac/browser/tags/releases/twisted-8.2.0/twisted/mail/scripts/mailmail.py#L345
http://twistedmatrix.com/trac/browser/tags/releases/twisted-8.2.0/twisted/internet/_dumbwin32proc.py#L167
http://twistedmatrix.com/trac/browser/tags/releases/twisted-8.2.0/twisted/lore/default.py#L17

--

___
Python tracker 

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



[issue6410] Dictionaries should support __add__

2009-07-06 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

FWIW, I'm -1 on the proposal because it partially overlaps the existing
capability of dict.update().  To the extent it doesn't overlap, it is
use case challenged (typically, it doesn't make sense to build a
brand-new dictionary from two independent dictionaries and the atypical
case easily fulfilled by a couple of updates on an empty dict).  

Also, the notation itself is at odds with the existing pipe-operator
used by sets and by dict views.

FWIW, there are other alternatives to directly combining dictionaries. 
See http://code.activestate.com/recipes/305268/ for one example.

--

___
Python tracker 

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



[issue3250] datetime.time does not support arithmetic

2009-07-06 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Or use the "original" lib on which this is all based :-)

http://www.egenix.com/products/python/mxBase/mxDateTime/

(and which, of course, does allow subtracting times)

--
nosy: +lemburg

___
Python tracker 

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



[issue6427] Rename float*.[ch] to double.[ch]

2009-07-06 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

As Amaury explains, it's called float because it *is* a floating point
type. 

It is not a double type, as it is not two types, but only a single one
:-) In 2.x, the "int" type was also represented with a C long, yet the
type called "long" was not represented with longs but with shorts.

--
nosy: +loewis
resolution:  -> 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



[issue6430] array.array falsely advertises support for 'w' in documentation

2009-07-06 Thread Alexandre Vassalotti

New submission from Alexandre Vassalotti :

It looks like either array's 'w' support got lost in a merge, or the
documentation is just wrong.


>>> import array
>>> array.array('w', "hello")
Traceback (most recent call last):
  File "", line 1, in 
ValueError: bad typecode (must be b, B, u, h, H, i, I, l, L, f or d)
>>> print(array.__doc__)
This module defines an object type which can efficiently represent
an array of basic values: characters, integers, floating point
numbers.  Arrays are sequence types and behave very much like lists,
except that the type of objects stored in them is constrained.  The
type is specified at object creation time by using a type code, which
is a single character.  The following type codes are defined:

Type code   C Type Minimum size in bytes 
'b' signed integer 1 
'B' unsigned integer   1 
'u' Unicode character  2 (see note) 
'h' signed integer 2 
'H' unsigned integer   2 
'i' signed integer 2 
'I' unsigned integer   2 
'w' unicode character  4 
'l' signed integer 4 
'L' unsigned integer   4 
'f' floating point 4 
'd' floating point 8 

NOTE: The 'u' typecode corresponds to Python's unicode character. On 
narrow builds this is 2-bytes on wide builds this is 4-bytes.

--
assignee: georg.brandl
components: Documentation, Extension Modules
messages: 90190
nosy: alexandre.vassalotti, georg.brandl
priority: low
severity: normal
status: open
title: array.array falsely advertises support for 'w' in documentation
versions: Python 3.1, Python 3.2

___
Python tracker 

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



[issue6428] TypeError: __bool__ should return bool or int, returned int

2009-07-06 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

It's not only the docs, the error message is self-contradictory as well.

--
assignee: georg.brandl -> 
nosy: +pitrou
priority:  -> normal
stage:  -> needs patch
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



[issue3250] datetime.time does not support arithmetic

2009-07-06 Thread Chris Withers

Chris Withers  added the comment:

I think so.

FWIW, I'd recommend looking at:

http://pypi.python.org/pypi/python-dateutil

...for doing things that python's builtin datetime stuff doesn't cater 
for.

--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue6151] Make PyDescr_COMMON conform to standard C

2009-07-06 Thread Alexandre Vassalotti

Alexandre Vassalotti  added the comment:

> I'm not sure what the "new patch" is since you haven't uploaded it

Oh silly me. Here's the new patch.

--
Added file: http://bugs.python.org/file14459/strict-aliasing-pydescr-2.diff

___
Python tracker 

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



[issue6151] Make PyDescr_COMMON conform to standard C

2009-07-06 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I'm not sure what the "new patch" is since you haven't uploaded it, but
the original patch looks ok. In any case, it shouldn't go into 3.1 since
it breaks source-level compatibility.

--
nosy: +pitrou
versions:  -Python 3.1

___
Python tracker 

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



[issue5683] Speed up cPickle's pickling generally

2009-07-06 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Any updates?

--

___
Python tracker 

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



[issue6314] logging.basicConfig(level='DEBUG', ... and setLevel("DEBUG") result in no logging

2009-07-06 Thread R. David Murray

R. David Murray  added the comment:

There is still a problem here, though not something a typical user would
run into:

rdmur...@partner:~/python/trunk>./python
Python 2.7a0 (trunk:73845M, Jul  4 2009, 12:43:10)
[GCC 4.1.2 (Gentoo 4.1.2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>> logging.basicConfig(level=object())
>>> logging.info("test")

However, I've expanded the title to cover a second way this bug can be
encountered that is more likely to bite someone (and thus I am reopening
it):

Python 2.7a0 (trunk:73845M, Jul  4 2009, 12:43:10) 
[GCC 4.1.2 (Gentoo 4.1.2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>> logging.basicConfig(level=logging.DEBUG)
>>> logging.info('test')
INFO:root:test
>>> logging.getLogger().setLevel("DEBUG")
>>> logging.info('test')

Neither one of these is a problem in 3.x in the sense that if you pass a
string argument under 3.x, the result is not silence:

Python 3.2a0 (py3k:73867M, Jul  6 2009, 12:52:11) 
[GCC 4.1.2 (Gentoo 4.1.2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>> logging.basicConfig(level=object())
>>> logging.info("foo")
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/rdmurray/python/py3k/Lib/logging/__init__.py", line 1471,
in info
root.info(msg, *args, **kwargs)
  File "/home/rdmurray/python/py3k/Lib/logging/__init__.py", line 1045,
in info
if self.isEnabledFor(INFO):
  File "/home/rdmurray/python/py3k/Lib/logging/__init__.py", line 1236,
in isEnabledFor
return level >= self.getEffectiveLevel()
TypeError: unorderable types: int() >= object()

However, it seems like it would be much better even in the 3.x case to
have the error occur when the level is set rather than when it is used.

To fix this bug I think setLevel should do a type check.  Log already
does a type check (isintance(level, int)), so that's what I think
setLevel should do.  One could alternatively enhance the logging API to
have setLevel accept a string.  That, however, is an enhancement and not
a bugfix, IMO.

I've included a patch that adds the isinstance check, and tests for
same, and reverts the basicConfig change.  Vinay, if you'd rather have
the level-name-lookup enhancement I'd be happy to do it and also do the
doc update, but I don't think the enhancement bits should be backported
to 2.6 or 3.1 so I would do it as a separate patch.

Oh, and one last note: I didn't do the raiseExceptions test in setLevel
the way 'log' does because I figure an error at the config level should
not be suppressed...but raiseExceptions doesn't seem to be documented
(at least, I couldn't find it) so I'm not sure if that's the right thing
to do.

--
keywords: +patch
nosy: +r.david.murray
priority:  -> normal
resolution: fixed -> 
stage:  -> patch review
status: closed -> open
title: logging.basicConfig(level='DEBUG', ... -> 
logging.basicConfig(level='DEBUG', ... and setLevel("DEBUG") result in no 
logging
versions: +Python 2.6, Python 2.7, Python 3.2
Added file: http://bugs.python.org/file14458/issue6314.patch

___
Python tracker 

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



[issue6429] 2to3: fix_future conflicts with fix_print

2009-07-06 Thread Alexandre Vassalotti

New submission from Alexandre Vassalotti :

Running 2to3 with the default options on the following code:

  from __future__ import print_function
  x,y = 1,2
  print(x, y)

produces the following diff:

  --- future_print.py (original)
  +++ future_print.py (refactored)
  @@ -1,5 +1,5 @@
  -from __future__ import print_function
  +
  
   x = 1
   y = 2
  -print(x, y)
  +print((x, y))

If the "--nofix=future" options is specified, 2to3 produces the correct
output.

I found this while working on a fixer for removing future_builtins
imports. It seems that fixer_util.does_tree_import() is unable to find
the __future__ import node and thus causes FixPrint to be run instead of
being skipped.

--
components: 2to3 (2.x to 3.0 conversion tool)
messages: 90183
nosy: alexandre.vassalotti, benjamin.peterson
priority: normal
severity: normal
stage: needs patch
status: open
title: 2to3: fix_future conflicts with fix_print
type: behavior

___
Python tracker 

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



[issue6382] test_socketserver fails on trunk in test_ForkingTCPServer

2009-07-06 Thread R. David Murray

R. David Murray  added the comment:

I now get a different error, followed by zsh detecting an alarm:

rdmur...@partner:~/python/trunk>./python -m test.regrtest -uall
test_socketserver
Could not find '/home/rdmurray/python/trunk/Lib/test' in sys.path to
remove it
test_socketserver
Exception in thread SocketServer.ForkingUDPServer serving:
Traceback (most recent call last):
  File "/home/rdmurray/python/trunk/Lib/threading.py", line 524, in
__bootstrap_inner
self.run()
  File "/home/rdmurray/python/trunk/Lib/threading.py", line 477, in run
self.__target(*self.__args, **self.__kwargs)
  File "/home/rdmurray/python/trunk/Lib/SocketServer.py", line 226, in
serve_forever
self._handle_request_noblock()
  File "/home/rdmurray/python/trunk/Lib/SocketServer.py", line 283, in
_handle_request_noblock
self.handle_error(request, client_address)
  File "/home/rdmurray/python/trunk/Lib/SocketServer.py", line 281, in
_handle_request_noblock
self.process_request(request, client_address)
  File "/home/rdmurray/python/trunk/Lib/SocketServer.py", line 535, in
process_request
request.close() #close socket handle in parent process
AttributeError: 'tuple' object has no attribute 'close'

zsh: alarm  ./python -m test.regrtest -uall test_socketserver

--

___
Python tracker 

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



[issue6428] TypeError: __bool__ should return bool or int, returned int

2009-07-06 Thread SilentGhost

New submission from SilentGhost :

According to docs
(http://docs.python.org/3.1/reference/datamodel.html#object.__bool__)
__bool__ can return 1 or 0 instead of True or False.
However, when I ran the following code:

Python 3.1 (r31:73574, Jun 26 2009, 20:21:35) [MSC v.1500 32 bit
(Intel)] on win32
>>> class Spam():
def __bool__(self):
return 1


>>> if Spam():
print('ham')

I got the following error:

Traceback (most recent call last):
  File "", line 1, in 
if Spam():
TypeError: __bool__ should return bool or int, returned int

So, do I misunderstand the docs or is it an error in them?

--
assignee: georg.brandl
components: Documentation, Interpreter Core
messages: 90181
nosy: SilentGhost, georg.brandl
severity: normal
status: open
title: TypeError: __bool__ should return bool or int, returned int
type: behavior
versions: Python 3.1

___
Python tracker 

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



[issue6395] Add Pickle Support to the codecs Module

2009-07-06 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

I don't understand the use case for this. 

If the StreamWriter/Reader cannot pickle the underlying stream (which is
probably always the case), why should the object itself be pickleable ?

What we could do is implement .__get/setstate__() and have it raise an
exception to inform the user of the problem.

--
nosy: +lemburg

___
Python tracker 

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



[issue6377] distutils compiler switch ignored

2009-07-06 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

merged in r73866 in py3k


Thanks for the feedback

--
status: open -> closed

___
Python tracker 

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



[issue824371] ntpath.expandvars doesn't expand Windows-style variables.

2009-07-06 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

This is already part of 2.6:

>>> os.path.expandvars("%WIndir%/foo")
'C:\\WINNT/foo'
>>> os.path.expandvars("%invalid%")
'%invalid%'

--
nosy: +amaury.forgeotdarc
resolution:  -> out of date
status: open -> closed

___
Python tracker 

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



[issue6427] Rename float*.[ch] to double.[ch]

2009-07-06 Thread Eric Smith

Eric Smith  added the comment:

-1

The time to change this was 3.0, if it was ever needed. It would break
too much code now. We could develop some strategy using macros, but I
just don't think it's worth it.

And as Amaury points it, the type is known in python as "float", so to
change it would be confusing. That it uses C doubles is an
implementation detail.

--
nosy: +eric.smith

___
Python tracker 

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



[issue6377] distutils compiler switch ignored

2009-07-06 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

done in r73864, waiting for the buildbots to build trunk, then will be
applied in 3.x

--

___
Python tracker 

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



[issue6427] Rename float*.[ch] to double.[ch]

2009-07-06 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

'float' is how python names its floating point number type, and this
won't change.  Yes, it is based on the C double, but I think that the
code is very careful to avoid the confusion.

For example, in the C sources, the word 'float' always has a 'Py'
prefix, or an 'object' suffix, to assert that it refers to the python
type (e.g. PyFloat_FromDouble, floatobject.c)

Do you have a precise example where the distinction is not clear?

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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



[issue3410] platform.version() don't work as expected in Vista in portuguese

2009-07-06 Thread Ezio Melotti

Ezio Melotti  added the comment:

According to Google Translate, in Vietnamese 'Version' is 'Phiên bản'.
If this is true both \S+ and \w+ will fail.
I also noticed a few more regex (namely _release_filename,
_lsb_release_version and _release_version) which contain the words
'version' and 'release' and may fail if these are translated.
I guess I'll have to check with some live cd (since these regex are used
for Linux apparently) and some other language to see if it works.

--

___
Python tracker 

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



[issue3410] platform.version() don't work as expected in Vista in portuguese

2009-07-06 Thread Felipe Portella

Felipe Portella  added the comment:

The same happens in Portuguese version ... the regex fails because ver
returns "Versão" ...

[]'s

On Mon, Jul 6, 2009 at 7:54 AM, Ezio Melotti  wrote:

>
> Ezio Melotti  added the comment:
>
> Won't that fail with Windows versions in Japanese, Chinese, Arab and
> similar?
> If 'Version' is translated in all the languages as a single word and
> it's between whitespaces (or even between a [ and a space), \S+ should
> be safe enough, otherwise \w+ with the re.U flag should work.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--
title: platform.version() don't work as expected in Vista inportuguese -> 
platform.version() don't work as expected in Vista in portuguese
Added file: http://bugs.python.org/file14457/unnamed

___
Python tracker 

___The same happens in Portuguese version ... the regex fails because ver returns 
"Versão" ...[]'sOn Mon, 
Jul 6, 2009 at 7:54 AM, Ezio Melotti rep...@bugs.python.org> 
wrote:


Ezio Melotti ezio.melo...@gmail.com> added the 
comment:

Won't that fail with Windows versions in Japanese, Chinese, Arab 
and
similar?
If 'Version' is translated in all the languages as a single word and
it's between whitespaces (or even between a [ and a space), \S+ should
be safe enough, otherwise \w+ with the re.U flag should work.

--

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

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



[issue3410] platform.version() don't work as expected in Vista in portuguese

2009-07-06 Thread Ezio Melotti

Ezio Melotti  added the comment:

Won't that fail with Windows versions in Japanese, Chinese, Arab and
similar?
If 'Version' is translated in all the languages as a single word and
it's between whitespaces (or even between a [ and a space), \S+ should
be safe enough, otherwise \w+ with the re.U flag should work.

--

___
Python tracker 

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



[issue3410] platform.version() don't work as expected in Vista in portuguese

2009-07-06 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Ezio Melotti wrote:
> Ezio Melotti  added the comment:
> 
> On the Vista machine that returned ('', '6.0.6002', 'SP2',
> 'Multiprocessor Free') there is ActiveState's Python 2.5.2 that includes
> the pywin32 extension.
> 
> I managed to run pdb on it and the result was http://dpaste.com/hold/63642/
> Python 2.5 doesn't have any check for Vista, and in win32_ver(), inside
> the "elif plat == VER_PLATFORM_WIN32_NT:" it only checks for maj <= 4
> and maj == 5. Vista is 6 and 'release' remains unset [1]. In Py 2.6
> there's also if maj == 6 [2] (and now maj == 7 should be added too).

Ah, that makes sense: Vista support only got added in Python 2.6.
We cannot add that support to Python 2.5, since that branch is
closed.

Note however that platform.py does work with multiple Python versions,
so you can always copy the module from a later version and hand-replace
the one from the original distribution with an updated one.

> However, I also tried to run what the OP said and indeed I found some
> problem. With pdb.run('platform._syscmd_ver()'), on Vista in English I get:
> -> info = pipe.read()
> (Pdb) s
>> c:\program files\python26\lib\platform.py(493)_syscmd_ver()
> -> if pipe.close():
> (Pdb) info
> '\nMicrosoft Windows [Version 6.0.6002]\n'
> ...
> -> m = _ver_output.match(info)
> (Pdb) s
>> c:\program files\python26\lib\platform.py(511)_syscmd_ver()
> -> if m is not None:
> (Pdb) m
> <_sre.SRE_Match object at 0x02812AE0>
> (Pdb) m.groups()
> ('Microsoft', 'Windows', '6.0.6002')
> 
> where _ver_output = re.compile(r'(?:([\w ]+) ([\w.]+) '
>  '.*'
>  'Version ([\d.]+))')
> 
> In non-English versions instead the regex doesn't match:
> -> if pipe.close():
> (Pdb) p info
> '\nMicrosoft Windows [Versione 6.0.6002]\n'
> ...
>> c:\program files\python25\lib\platform.py(420)_syscmd_ver()
> -> m = _ver_output.match(info)
> (Pdb) n
>> c:\program files\python25\lib\platform.py(421)_syscmd_ver()
> -> if m:
> (Pdb) m
> (Pdb)

Thanks for checking.

> Since 'Version' is translated, the regex fails if the translation is
> different because it checks specifically for the word 'Version'.
> Replacing it with \S+ as the OP suggested sounds like a reasonable
> solution. It is possible that even other versions of Windows (e.g. XP)
> have 'Version' translated, can you reproduce it with your German XP?

Interesting. In the German XP uses 'Version' as well, so the regexp
matches just fine.

I'll correct the regexp to only try matching on 'Ver\w+'.

> Later I can try on another non-English XP and see if the regex match.
> 
> [1]: /python/branches/release25-maint/Lib/platform.py?view=markup
> [2]: /python/branches/release26-maint/Lib/platform.py?view=markup

--

___
Python tracker 

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



[issue3410] platform.version() don't work as expected in Vista in portuguese

2009-07-06 Thread Ezio Melotti

Ezio Melotti  added the comment:

On the Vista machine that returned ('', '6.0.6002', 'SP2',
'Multiprocessor Free') there is ActiveState's Python 2.5.2 that includes
the pywin32 extension.

I managed to run pdb on it and the result was http://dpaste.com/hold/63642/
Python 2.5 doesn't have any check for Vista, and in win32_ver(), inside
the "elif plat == VER_PLATFORM_WIN32_NT:" it only checks for maj <= 4
and maj == 5. Vista is 6 and 'release' remains unset [1]. In Py 2.6
there's also if maj == 6 [2] (and now maj == 7 should be added too).

However, I also tried to run what the OP said and indeed I found some
problem. With pdb.run('platform._syscmd_ver()'), on Vista in English I get:
-> info = pipe.read()
(Pdb) s
> c:\program files\python26\lib\platform.py(493)_syscmd_ver()
-> if pipe.close():
(Pdb) info
'\nMicrosoft Windows [Version 6.0.6002]\n'
...
-> m = _ver_output.match(info)
(Pdb) s
> c:\program files\python26\lib\platform.py(511)_syscmd_ver()
-> if m is not None:
(Pdb) m
<_sre.SRE_Match object at 0x02812AE0>
(Pdb) m.groups()
('Microsoft', 'Windows', '6.0.6002')

where _ver_output = re.compile(r'(?:([\w ]+) ([\w.]+) '
 '.*'
 'Version ([\d.]+))')

In non-English versions instead the regex doesn't match:
-> if pipe.close():
(Pdb) p info
'\nMicrosoft Windows [Versione 6.0.6002]\n'
...
> c:\program files\python25\lib\platform.py(420)_syscmd_ver()
-> m = _ver_output.match(info)
(Pdb) n
> c:\program files\python25\lib\platform.py(421)_syscmd_ver()
-> if m:
(Pdb) m
(Pdb)

Since 'Version' is translated, the regex fails if the translation is
different because it checks specifically for the word 'Version'.
Replacing it with \S+ as the OP suggested sounds like a reasonable
solution. It is possible that even other versions of Windows (e.g. XP)
have 'Version' translated, can you reproduce it with your German XP?

Later I can try on another non-English XP and see if the regex match.

[1]: /python/branches/release25-maint/Lib/platform.py?view=markup
[2]: /python/branches/release26-maint/Lib/platform.py?view=markup

--

___
Python tracker 

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



[issue6427] Rename float*.[ch] to double.[ch]

2009-07-06 Thread Jack Diederich

New submission from Jack Diederich :

The core types use doubles, not floats.  The file and function names
should reflect that (the docs already do).

--
components: None
messages: 90169
nosy: jackdied
severity: normal
status: open
title: Rename float*.[ch] to double.[ch]
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



[issue3410] platform.version() don't work as expected in Vista in portuguese

2009-07-06 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Ezio Melotti wrote:
> Ezio Melotti  added the comment:
> 
> Here are the results.
> Windows Vista SP2 in English
>   Python 3.0.1:
>   >>> platform.platform()
>   'Windows-Vista-6.0.6002-SP2'
>   >>> platform.version()
>   '6.0.6002'
>   >>> platform.win32_ver()
>   ('Vista', '6.0.6002', 'SP2', 'Multiprocessor Free')
> 
>   Python 2.6.2:
>   >>> platform.platform()
>   'Windows-Vista-6.0.6002-SP2'
>   >>> platform.version()
>   '6.0.6002'
>   >>> platform.win32_ver()
>   ('Vista', '6.0.6002', 'SP2', u'Multiprocessor Free')
> 
> Windows 2003 Server SP2 in English
>   Python 3.1
>   >>> platform.platform()
>   'Windows-2003Server-5.2.3790-SP2'
>   >>> platform.version()
>   '5.2.3790'
>   >>> platform.win32_ver()
>   ('2003Server', '5.2.3790', 'SP2', 'Uniprocessor Free')

Thanks.

> Everything seems fine, however I don't have any non-English Windows
> here. 

Indeed.

> Do you know if it's possible to download and install language
> packs and if they may affect the text in the version? If so, I could try
> to do it and see if I can reproduce the original issue.

I'm not sure whether that would make a difference.

On XP this does not make a difference - I've tested this with
a German Win XP version.

I think the best strategy is to run win32_ver() through the
pdb debugger in step-by-step mode and on the Vista machine
where you saw the problem.

BTW: Do you have the win32 tools installed on that machine ?

--

___
Python tracker 

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



[issue6423] The cgi docs should advertize using "in" instead of "has_key"

2009-07-06 Thread Georg Brandl

Georg Brandl  added the comment:

Patch looks good and is ready to commit.  Py3k seems to have been fixed
already.

--
assignee: georg.brandl -> ezio.melotti
nosy: +ezio.melotti
resolution:  -> accepted

___
Python tracker 

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



[issue6426] imaplib.IMAP4 "command illegal in this state" is unhelpful error message

2009-07-06 Thread Sjoerd

New submission from Sjoerd :

If you do not IMAP4.select(), you get the following error:
imaplib.error: command SEARCH illegal in state AUTH.

This does not inform the user that he has to do IMAP4.select(). Better
would be: 
imaplib.error: command SEARCH illegal in state AUTH, allowed in state
SELECTED.

See also:
http://mail.python.org/pipermail/patches/2006-December/021308.html

--
components: Library (Lib)
messages: 90166
nosy: Sjoerder
severity: normal
status: open
title: imaplib.IMAP4 "command illegal in this state" is unhelpful error message
type: behavior
versions: Python 2.5

___
Python tracker 

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



[issue6425] imaplib.IMAP4.fetch() is missing documentation for message_set parameter

2009-07-06 Thread Sjoerd

New submission from Sjoerd :

The message_set parameter imaplib.IMAP4.fetch(message_set,
message_parts) is not a set or list, but a comma-separated string, it
seems. This could use some documentation.

--
assignee: georg.brandl
components: Documentation
messages: 90165
nosy: Sjoerder, georg.brandl
severity: normal
status: open
title: imaplib.IMAP4.fetch() is missing documentation for message_set parameter
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



[issue1424152] urllib/urllib2: HTTPS over (Squid) Proxy fails

2009-07-06 Thread Jarek

Jarek  added the comment:

+1 for mercurial inoperability from behind proxy

--
nosy: +jarek.jpa

___
Python tracker 

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