[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2009-12-17 Thread lekma

lekma  added the comment:

> - when importing fcntl, bear in mind that some systems don't have this
> module (e.g. Windows), so you should catch and silence the ImportError

would something like the following be ok?:

try:
import fcntl
except ImportError:
fcntl = False

and then:

if hasattr(socket, "SOCK_CLOEXEC") and fcntl:
tests.append(CloexecLinuxConstantTest)

--

___
Python tracker 

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



[issue7537] test_format fails with -j combined with -v

2009-12-17 Thread Eric Smith

Eric Smith  added the comment:

I can duplicate this on Fedora Core 6, x86, r76872. I simplified the
command line down to:

./python Lib/test/regrtest.py -j1 -v test_format

(and any value for j >= 1 causes the error).

--
nosy: +eric.smith
title: test_format -> test_format fails with -j combined with -v

___
Python tracker 

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



[issue7528] Provide PyLong_AsLongAndOverflow compatibility to Python 2.x

2009-12-17 Thread Case Van Horsen

Case Van Horsen  added the comment:

Uploaded a new version of py3intcompat.c. It should be save to include
with any version of Python, included 2.7 with PyLong_AsLongAndOverflow
added.

The file includes basic documentation on use.

--
Added file: http://bugs.python.org/file15588/py3intcompat-v2.c

___
Python tracker 

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



[issue7528] Provide PyLong_AsLongAndOverflow compatibility to Python 2.x

2009-12-17 Thread Case Van Horsen

Case Van Horsen  added the comment:

I uploaded a patch to add PyLong_AsLongAndOverflow. It was made against
the 2.7a1 source. "make test", gmpy's test suite, and mpmath's test
suite all pass.

Let me know if there is anything else I can do.

--
keywords: +patch
Added file: http://bugs.python.org/file15587/longobject.diff

___
Python tracker 

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



[issue7537] test_format

2009-12-17 Thread James G. sack (jim)

New submission from James G. sack (jim) :

With -r 76870, on Fedora 11, amd x80_64, regrtest of test_format fails 
when the -j  option is combined with the -v option. It happens whether 
testing everything or just the one test.

  ./python -Ebb Lib/test/regrtest -j3 -vv 
or
  ./python -Ebb Lib/test/regrtest -j3 -vv test_format

The error report is like
"""
FAILED (errors=1)
test test_format failed -- Traceback (most recent call last):
  File "/home/jbase/checkouts/py/py32/Lib/test/test_format.py", line 
221, in test_format
testformat("%r", "\u0374", "'\u0374'")   # printable
  File "/home/jbase/checkouts/py/py32/Lib/test/test_format.py", line 20, 
in testformat
(formatstr, args, output), end=' ')
UnicodeEncodeError: 'ascii' codec can't encode character '\u0374' in 
position 8: ordinal not in range(128)
1 test failed:
test_format
"""

~jim

--
components: Tests
messages: 96547
nosy: jgsack
severity: normal
status: open
title: test_format
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



[issue5093] 2to3 with a pipe on non-ASCII script

2009-12-17 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Fixed in r76871.

--
nosy: +benjamin.peterson, collinwinter
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



[issue1578269] Add os.link() and os.symlink() and os.path.islink() support for Windows

2009-12-17 Thread Eric Smith

Eric Smith  added the comment:

I apologize (again) Jason, for taking forever to move forward on this.

With patch 16 on XP, I get this error on test_platform:

==
ERROR: test_architecture_via_symlink (__main__.PlatformTest)
--
Traceback (most recent call last):
  File "Lib/test/test_platform.py", line 22, in
test_architecture_via_symlink
os.symlink(real, link)
NotImplementedError: CreateSymbolicLinkW not found

--
Ran 18 tests in 0.047s

FAILED (errors=1)
Traceback (most recent call last):
  File "Lib/test/test_platform.py", line 204, in 
test_main()
  File "Lib/test/test_platform.py", line 200, in test_main
PlatformTest
  File "c:\home\eric\python\py3k\lib\test\support.py", line 919, in
run_unittest
_run_suite(suite)
  File "c:\home\eric\python\py3k\lib\test\support.py", line 902, in
_run_suite
raise TestFailed(err)
test.support.TestFailed: Traceback (most recent call last):
  File "Lib/test/test_platform.py", line 22, in
test_architecture_via_symlink
os.symlink(real, link)
NotImplementedError: CreateSymbolicLinkW not found

I'll try to spend some time tracking it down over the weekend, but feel
free to look it over.

--

___
Python tracker 

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



[issue7442] decimal.py: format failure with locale specifier

2009-12-17 Thread Eric Smith

Eric Smith  added the comment:

I can reproduce it on a Fedora (fc6) Linux box. It's not a decimal
problem, but a plain locale problem:

>>> import locale
>>> locale.setlocale(locale.LC_NUMERIC, 'fi_FI')
'fi_FI'
>>> locale.localeconv()
Traceback (most recent call last):
  File "", line 1, in 
  File "/root/python/py3k/Lib/locale.py", line 111, in localeconv
d = _localeconv()
ValueError: Cannot convert byte to string
>>> 

Here's the contents of the struct lconv as returned by localeconv():

((gdb) p *l
$1 = {decimal_point = 0xb7b54020 ",", thousands_sep = 0xb7b54022 " ",
grouping = 0xb7b54024 "\003\003", 
  int_curr_symbol = 0x998858 "", currency_symbol = 0x998858 "",
mon_decimal_point = 0x998858 "", mon_thousands_sep = 0x998858 "", 
  mon_grouping = 0x998858 "", positive_sign = 0x998858 "", negative_sign
= 0x998858 "", int_frac_digits = 127 '\177', 
  frac_digits = 127 '\177', p_cs_precedes = 127 '\177', p_sep_by_space =
127 '\177', n_cs_precedes = 127 '\177', 
  n_sep_by_space = 127 '\177', p_sign_posn = 127 '\177', n_sign_posn =
127 '\177', int_p_cs_precedes = 127 '\177', 
  int_p_sep_by_space = 127 '\177', int_n_cs_precedes = 127 '\177',
int_n_sep_by_space = 127 '\177', int_p_sign_posn = 127 '\177', 
  int_n_sign_posn = 127 '\177'}

The problem is thousands_sep:
(gdb) p l->thousands_sep
$2 = 0xb7b54022 " "
(gdb) p (unsigned char)l->thousands_sep[0]
$3 = 160 ' '

--
nosy: +eric.smith

___
Python tracker 

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



[issue5819] Add PYTHONPREFIXES environment variable

2009-12-17 Thread Christopher Dunn

Christopher Dunn  added the comment:

I am not sure that this guy's idea is good, but I think that he deserves
more attention.  In comments elsewhere on the web, I noticed that people
thought the PYTHONUSERBASE site-packages directory could contain .pth
files which would serve the same purpose as his proposed environment
variable.  However, .pth files are not recursive; a .pth file in one
directory does not cause .pth files to be processed in the directories
named by its contents.

I agree with ianb that this is a poor way to mimic virtualenv.  There is
a difference between user additions -- which should affect *all* python
code that he uses -- and separate Python installations.

There might be other reasons for multiple user site-packages
directories.  For example, Python lacks Perl's architecture awareness. 
Perl can load from
  lib/
  lib/5.10.0/
  lib/5.10.0/linux-x86
  lib/5.10.0/linux-x86/auto
and a few other combinations.

Python also lacks a PERL5OPT equivalent.  I am forced to use the
PYTHONUSERBASE mechanism to simulate that behavior (which I use to turn
on code coverage everywhere during testing) but I only get to set that once.

--
nosy: +cdunn2001

___
Python tracker 

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



[issue7532] Extended slicing with classic class behaves strangely

2009-12-17 Thread flox

Changes by flox :


Removed file: http://bugs.python.org/file15585/issue7532_classic_getitem.diff

___
Python tracker 

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



[issue7532] Extended slicing with classic class behaves strangely

2009-12-17 Thread flox

flox  added the comment:

Patch augmented with extensive tests:
 * Classic class or New-style class
 * with or without __getslice__

--
Added file: http://bugs.python.org/file15586/issue7532_classic_getitem_v2.diff

___
Python tracker 

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



[issue7535] logging: Filters on Loggers can't actually filter messages on lower levels of the logging hierarchy

2009-12-17 Thread Leonardo Rochael Almeida

Leonardo Rochael Almeida  added the comment:

At the very least this is a documentation bug. By reading the std docs
on the logging module [1] one gets the impression that if a log record
gets to a certain logger, even if percolated from more specific loggers,
then the filters to that logger should be involved and even get the
chance to change the log record.

[1] http://docs.python.org/library/logging.html

This is reinforced by the documentation and the implementation of the
logging.Filter class, which is supposed to filter-out messages of more
specific loggers, but which would never actually filter out anything if
applied to a Logger of the same "name" (as opposed to a Handler, since
filter handlers do get called for log records of more specific loggers).

--

___
Python tracker 

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



[issue7522] random.choice should accept a set as input

2009-12-17 Thread Leo

Leo  added the comment:

Thanks for the suggestions "random.sample(s, 1)[0]" and 
"x=next(iter(s))". 

A counterpoint: isn't this a classic example of where polymorphism 
enables a more elegant, simple, and clear (dare I say Pythonic) 
approach? The complexity of allowing sets as inputs, even with a naive 
implementation, is still O(n) even in the worst case vs. O(1) for 
arrays. Isn't documenting that distinction good enough?

Thanks,
Leo.

--

___
Python tracker 

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



[issue7471] GZipFile.readline too slow

2009-12-17 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> How about using the first patch with the slicing optimization and 
> additionally enhancing GzipFile with the methods required to make it 
> play nice as a raw stream to an io.BufferedReader object (readable(), 
> writable(), readinto(), etc...).

That's fine with me.

--

___
Python tracker 

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



[issue7471] GZipFile.readline too slow

2009-12-17 Thread Nir Aides

Nir Aides  added the comment:

How about using the first patch with the slicing optimization and 
additionally enhancing GzipFile with the methods required to make it 
play nice as a raw stream to an io.BufferedReader object (readable(), 
writable(), readinto(), etc...).

This way we still get the 350% speed up and keep it fully backward 
compatible, and if someone needs the extra performance they can feed it 
into an io.BufferedReader object thus:

g = gzip.GzipFile(...)
r = io.BufferedReader(g)
for line in r:
...

--

___
Python tracker 

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



[issue7471] GZipFile.readline too slow

2009-12-17 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Thanks for the new patch. The problem with inheriting from
BufferedRandom, though, is that if you call e.g. write() on a read-only
gzipfile, it will appear to succeed because the bytes are buffered
internally.

I think the solution would be to use delegation rather than inheritance.
Something like:

def __init__(self, ...)
if 'w' in mode:
   self.buf = BufferedWriter(...)
for meth in ('read', 'write', etc.):
setattr(self, meth, getattr(self.buf, meth))

It would also be nice to add some tests for the issues I mentioned
earlier (check that IOError is raised when reading a write-only file,
and vice-versa).

By the way, we can't apply this approach to 2.x since
BufferedWriter/BufferedRandom won't accept unicode arguments for write()
and friends, and that would break compatibility. For 3.x it is fine though.

--

___
Python tracker 

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



[issue7532] Extended slicing with classic class behaves strangely

2009-12-17 Thread flox

flox  added the comment:

Mark,

Thank you for your analysis.

I looked at similar implementation of tp_as_sequence->sq_slice slots in
"stringobject.c" (and tuple, list).
I've added extra controls before the _PySlice_FromIndices call to let it
behave like new-style classes.

I have updated the tests.
It should be safe for 2.7, no?

--
keywords: +patch
Added file: http://bugs.python.org/file15585/issue7532_classic_getitem.diff

___
Python tracker 

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



[issue7442] decimal.py: format failure with locale specifier

2009-12-17 Thread Mark Dickinson

Mark Dickinson  added the comment:

What are the multibyte strings that mbstowcs is failing to convert?
On my machine, the separators come out as plain ASCII '.' (for thousands) 
and ',' (for the decimal point).

--

___
Python tracker 

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



[issue7442] decimal.py: format failure with locale specifier

2009-12-17 Thread Mark Dickinson

Mark Dickinson  added the comment:

I'm failing to reproduce this (with py3k) on OS X:

Python 3.2a0 (py3k:76866:76867, Dec 17 2009, 09:19:26) 
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> from decimal import *
>>> locale.setlocale(locale.LC_NUMERIC, 'fi_FI')
'fi_FI'
>>> format(Decimal('1000'), 'n')
'1.000'

The locale command, from the same Terminal prompt, gives me:

LANG="en_IE.UTF-8"
LC_COLLATE="en_IE.UTF-8"
LC_CTYPE="en_IE.UTF-8"
LC_MESSAGES="en_IE.UTF-8"
LC_MONETARY="en_IE.UTF-8"
LC_NUMERIC="en_IE.UTF-8"
LC_TIME="en_IE.UTF-8"
LC_ALL=

Just to be clear, is is true that you still get the same result without 
involving Decimal at all?  That is, am I correct in assuming that:

>>> import locale
>>> locale.setlocale(locale.LC_NUMERIC, 'fi_FI')
'fi_FI'
>>> locale.localeconv()

also gives you that ValueError?

--

___
Python tracker 

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



[issue7532] Extended slicing with classic class behaves strangely

2009-12-17 Thread Mark Dickinson

Mark Dickinson  added the comment:

Issue #974635 looks like the same thing.  That issue was closed as a 
duplicate of issue #723806, though to my eyes #723806 doesn't look quite 
the same.

--

___
Python tracker 

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



[issue7532] Extended slicing with classic class behaves strangely

2009-12-17 Thread Mark Dickinson

Mark Dickinson  added the comment:

Hmm.  This doesn't look like something that's easy to fix without affecting 
existing correct code;  given 
that the behaviour has been around for a while (I'm not sure exactly how long), 
and that the issue is gone 
in 3.x, I suspect it may not be worth trying.

Analysis:  for classic classes, the ceval loop calls PySequence_GetSlice, which 
corrects the negative 
indices by adding the length of the sequence  (as described in the docs) and 
then calls the 
tp_as_sequence->sq_slice slot on the type.  That ends up calling instance_slice 
(in 
Objects/classobject.c), which discovers that the class doesn't implement 
__getslice__ and so passes the 
adjusted slice on to the __getitem__ method.

I'm not sure how this could be changed to get the correct behaviour:  
PySequence_GetSlice would somehow 
need to know that it was going to end up calling __getitem__ rather than 
__getslice__.

Raymond, any thoughts?

--
nosy: +mark.dickinson, rhettinger

___
Python tracker 

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



[issue7534] float('nan')**2 != nan. float('nan')**2 error 33 on windows

2009-12-17 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti
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



[issue7534] float('nan')**2 != nan. float('nan')**2 error 33 on windows

2009-12-17 Thread Mark Dickinson

Mark Dickinson  added the comment:

Great!  For math.pow, see the function math_pow in Modules/mathmodule.c;  
some sort of (careful!) cut-and-paste job from there to float_pow in 
Objects/floatobject.c might do the trick.

--

___
Python tracker 

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



[issue7534] float('nan')**2 != nan. float('nan')**2 error 33 on windows

2009-12-17 Thread Marcos Donolo

Marcos Donolo  added the comment:

I will give it a shot.

On Thu, Dec 17, 2009 at 11:22 AM, Mark Dickinson wrote:

>
> Mark Dickinson  added the comment:
>
> Yep.  There's not much consistency in inf/nan handling across platforms,
> though the situation is slowly getting better.  math.pow makes an effort
> to handle these special cases correctly (for some value of correctly), and
> it would probably make some sense to have the builtin pow behave the same
> way.
>
> Would you be interested in contributing a fix?
>
> --
> stage:  -> needs patch
>
> ___
> Python tracker 
> 
> ___
>

--
title: float('nan')**2 != nan.  float('inf')**2 != inf.  float('nan')**2 error 
33 on windows -> float('nan')**2 != nan. float('nan')**2 error 33 on windows
Added file: http://bugs.python.org/file15584/unnamed

___
Python tracker 

___I will give it a shot.On Thu, Dec 17, 2009 at 
11:22 AM, Mark Dickinson rep...@bugs.python.org> 
wrote:

Mark Dickinson dicki...@gmail.com> added the 
comment:

Yep.  There's not much consistency in inf/nan handling across 
platforms,
though the situation is slowly getting better.  math.pow makes an effort
to handle these special cases correctly (for some value of correctly), and
it would probably make some sense to have the builtin pow behave the same
way.

Would you be interested in contributing a fix?

--
stage:  -> needs patch

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

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



[issue7534] float('nan')**2 != nan. float('inf')**2 != inf. float('nan')**2 error 33 on windows

2009-12-17 Thread Mark Dickinson

Mark Dickinson  added the comment:

Closed 7536 as a duplicate of this issue.

--
title: float('nan')**2 != nan.  float('nan')**2 error 33 on windows -> 
float('nan')**2 != nan.  float('inf')**2 != inf.  float('nan')**2 error 33 on 
windows

___
Python tracker 

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



[issue7536] float('inf')**2 != inf

2009-12-17 Thread Mark Dickinson

Mark Dickinson  added the comment:

This is essentially the same issue as issue7534, but for infinities 
instead of nans.  I'm closing this and folding the issue into that one.

--
nosy: +mark.dickinson
resolution:  -> duplicate
status: open -> closed
superseder:  -> float('nan')**2 != nan.  float('nan')**2 error 33 on windows

___
Python tracker 

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



[issue7536] float('inf')**2 != inf

2009-12-17 Thread Marcos Donolo

New submission from Marcos Donolo :

The ** operator produces an error when it gets inf as an argument.
if I try.
>>>a=float('inf')
>>>a*a 
inf
-but if I try 
>>>a**2 
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: (34, 'Result too large')
I should get inf too.

--
components: Interpreter Core
messages: 96527
nosy: mdonolo, tim_one
severity: normal
status: open
title: float('inf')**2 != inf
type: behavior
versions: Python 2.6

___
Python tracker 

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



[issue7534] float('nan')**2 != nan. float('nan')**2 error 33 on windows

2009-12-17 Thread Mark Dickinson

Mark Dickinson  added the comment:

Yep.  There's not much consistency in inf/nan handling across platforms, 
though the situation is slowly getting better.  math.pow makes an effort 
to handle these special cases correctly (for some value of correctly), and 
it would probably make some sense to have the builtin pow behave the same 
way.

Would you be interested in contributing a fix?

--
stage:  -> needs patch

___
Python tracker 

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



[issue7535] logging: Filters on Loggers can't actually filter messages on lower levels of the logging hierarchy

2009-12-17 Thread Vinay Sajip

Vinay Sajip  added the comment:

This behaviour is by design. Messages logged to logger 'a.b' are not
passed to logger 'a' - they are passed to *the handlers* of logger 'a'
(and so on up until a false value is seen for the logger's 'propagate'
attribute). In this respect, filtering works in the same way as levels
do - for example if logger 'a' has a level of WARNING and logger 'a.b'
has a level of DEBUG, then DEBUG events logged to 'a.b' will still show
up in the logs.

Closing, as it's not a bug, and implementing the alternative would not
be backwards compatible.

--
assignee:  -> vinay.sajip
nosy: +vinay.sajip
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue7535] logging: Filters on Loggers can't actually filter messages on lower levels of the logging hierarchy

2009-12-17 Thread Leonardo Rochael Almeida

New submission from Leonardo Rochael Almeida :

A filter added to, say, logging.getLogger('a').addFilter() never gets
the chance to filter messages logged into logging.getLogger('a.b').

On logging.Logger.handle() the current logger filters are called to
check if the message should be processed or not, but the logger parent
filters are not consulted (and this is ok, IMHO, more generic filters
shouldn't clobber messages of more specific loggers).

However, if none of the current filters block the message,
Logger.handle() then calls Logger.callHandlers(), which calls the
handlers of the current logger and of all the parent loggers as long as
each logger in the hierarchy allows the message to propagate. This is
done without consulting the parent loggers filters.

This means parent handlers get called to process log records even if the
parent logger filters would have otherwise blocked them.

Attached is a very crude patch that allows the parent loggers to filter
events before handling them. I'd prefer to simply call the "handle()" 
or "callHandler()" method of the parent loggers recursively, but
couldn't find a way to do this while still preserving the method
signatures AND properly reporting when no handler could be found.

My preference would be to have callHandlers() do the filtering AND
return a number of handlers invoked, including the parent handlers, so
that handle() could report if no handlers could be found.

--
components: Library (Lib)
files: logging-allow-parent-filtering.diff
keywords: patch
messages: 96524
nosy: leorochael
severity: normal
status: open
title: logging: Filters on Loggers can't actually filter messages on lower 
levels of the logging hierarchy
versions: Python 2.4, Python 2.5, Python 2.6, Python 2.7
Added file: http://bugs.python.org/file15583/logging-allow-parent-filtering.diff

___
Python tracker 

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



[issue7534] float('nan')**2 != nan. float('nan')**2 error 33 on windows

2009-12-17 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +mark.dickinson
priority:  -> normal

___
Python tracker 

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



[issue7534] float('nan')**2 != nan. float('nan')**2 error 33 on windows

2009-12-17 Thread Marcos Donolo

New submission from Marcos Donolo :

I am not getting the expected result for the ** operator on windows,
python 2.6
I do...
a=float('nan')
b=a*a
then b is nan which is right but if I do 
b = a**2 I get.
Traceback (most recent call last):
  File "", line 1, in 
ValueError: (33, 'Domain error')

If I do a**2 on ubuntu, python 2.6 I get nan again.

--
components: Interpreter Core
messages: 96523
nosy: mdon...@vt.edu, tim_one
severity: normal
status: open
title: float('nan')**2 != nan.  float('nan')**2 error 33 on windows
type: behavior
versions: Python 2.6

___
Python tracker 

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



[issue7533] unable to install pycurl in 2.6.4

2009-12-17 Thread Brett Cannon

Brett Cannon  added the comment:

This is not a Python error. It simply looks like you didn't set the 
CURL_DIR variable in the setup.py file that came w/ pycurl. If you can't 
figure out how to set the variable then I would ask the pycurl developers 
how to fix this.

--
nosy: +brett.cannon
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue7533] unable to install pycurl in 2.6.4

2009-12-17 Thread iamraprap

New submission from iamraprap :

first i tried using easy_install pycurl, also set a path to CURL_DIR and
i had error:
   File "setup.py", line 69, in 
assert os.path.isdir(CURL_DIR), "please check CURL_DIR in setup.py"
AssertionError: please check CURL_DIR in setup.py

second attempt, downloaded the 7.19.7 pycurl and built the libcurl.lib
too... but upon installing, i had error again:

[C:\src\build\pycurl\7.19.7]setup.py install
Using curl directory: C:\src\build\pycurl\7.19.7
running install
running build
running build_py
running build_ext
building 'pycurl' extension
error: Unable to find vcvarsall.bat 

please help... :(

--
components: Build
messages: 96521
nosy: iamraprap
severity: normal
status: open
title: unable to install pycurl in 2.6.4
type: compile error
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



[issue7532] Extended slicing with classic class behaves strangely

2009-12-17 Thread flox

New submission from flox :

See attached example.

The Classic class should behave like the New-style class.

--
components: Interpreter Core
files: case_slice.py
messages: 96520
nosy: flox
severity: normal
status: open
title: Extended slicing with classic class behaves strangely
type: behavior
versions: Python 2.6, Python 2.7
Added file: http://bugs.python.org/file15582/case_slice.py

___
Python tracker 

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



[issue7528] Provide PyLong_AsLongAndOverflow compatibility to Python 2.x

2009-12-17 Thread Case Van Horsen

Case Van Horsen  added the comment:

I don't want it to be a 2.7-only feature. I'm trying to maintain 
compatibility with 2.4 and later for gmpy. I would be in favor with 
adding it to 2.7 as long as we could still provide a standalone version 
for earlier releases of Python.

I hadn't realized that PyLong_AsLong accepts PyInt also. Given that, 
the name PyLong_AsLongAndOverflow is fine (and easier)!

--

___
Python tracker 

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



[issue7528] Provide PyLong_AsLongAndOverflow compatibility to Python 2.x

2009-12-17 Thread Mark Dickinson

Mark Dickinson  added the comment:

> I'm specifically not in favor of adding it to the Python 2.7 API.

Out of curiosity, why not?  It seems like a reasonable addition to me.

I'd continue to call it simply PyLong_AsLongAndOverflow, though.  I note
that in 2.x, PyLong_AsLong accepts both ints and longs, so it wouldn't
seem unreasonable for PyLong_AsLongAndOverflow to do so too.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue7529] StreamHandler does not live in logging.Handlers

2009-12-17 Thread Vinay Sajip

Vinay Sajip  added the comment:

Fixed in trunk (r76869). I had to add a .. currentmodule::logging to the
file, even though this is the first currentmodule directive in the file.
Is this a Sphinx glitch? Shouldn't the current module be set by the
module directive until changed via a currentmodule directive? Marking as
pending and assigning to Georg to confirm.

--
assignee: vinay.sajip -> georg.brandl
resolution:  -> fixed
status: open -> pending

___
Python tracker 

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



[issue7511] msvc9compiler.py: ValueError: [u'path']

2009-12-17 Thread Stefan Krah

Stefan Krah  added the comment:

I needed a new Windows VM image anyway, so I can now confirm that the
paths of a fresh VS Express + SDK 64-bit tools install are broken as
described above.

--

___
Python tracker 

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



[issue7531] datetime.timedelta doc has incorrect output

2009-12-17 Thread Mark Dickinson

Mark Dickinson  added the comment:

Perhaps you're misreading the '//'?  It's a division operator, not the
start of a comment.

The example works fine for me:

dicki...@alberti:~> python2.6
Python 2.6.2 (r262:71600, Aug 26 2009, 09:40:44)
[GCC 4.2.1 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import timedelta
>>> year = timedelta(days=365)
>>> ten_years = 10 * year
>>> ten_years, ten_years.days // 365
(datetime.timedelta(3650), 10)

--
nosy: +mark.dickinson
resolution:  -> works for me
status: open -> closed

___
Python tracker 

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



[issue7531] datetime.timedelta doc has incorrect output

2009-12-17 Thread John Gardner

New submission from John Gardner :

The output example for timedelta in datetime package has the wrong 
output for the supplied commands.

For example:
>>> ten_years, ten_years.days // 365
(datetime.timedelta(3650), 10)
should be:
>>> ten_years, ten_years.days 
(datetime.timedelta(3650), 3650)
(or perhaps, days changed to years.

It's very misleading to have these strange numbers as output.

Also, the comments to the right don't seem to be relevant.

--
assignee: georg.brandl
components: Documentation
messages: 96514
nosy: georg.brandl, huxoll
severity: normal
status: open
title: datetime.timedelta doc has incorrect output
type: behavior
versions: Python 2.6, Python 2.7, 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



[issue7523] add SOCK_NONBLOCK and SOCK_CLOEXEC to socket module

2009-12-17 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

A couple of things:
- the test shouldn't be marked as Linux-specific since perhaps these
constants will be supported by other systems some day
- when importing fcntl, bear in mind that some systems don't have this
module (e.g. Windows), so you should catch and silence the ImportError

--
nosy: +pitrou

___
Python tracker 

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



[issue7530] doc of multiprocessing.managers is wrong (server_forever)

2009-12-17 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +jnoller

___
Python tracker 

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



[issue7529] StreamHandler does not live in logging.Handlers

2009-12-17 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
assignee: georg.brandl -> vinay.sajip
nosy: +vinay.sajip

___
Python tracker 

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



[issue7530] doc of multiprocessing.managers is wrong (server_forever)

2009-12-17 Thread Stefan Schwarzburg

New submission from Stefan Schwarzburg :

The documentation of multiprocessing.managers.BaseManager 
(http://docs.python.org/library/multiprocessing.html#module-multiprocessing.managers)
refers to a method "serve_forever". This method is only available at the
server object inside BaseManager (e.g.
manager.get_server().serve_forever() ).

I would rephrase the text to:
"Once created one should call start() or get_server().serve_forever()" 

instead of the current phrase:
"Once created one should call start() or serve_forever()" 

The method description for "serve_forever()" should be removed from
BaseManager, instead there should be an additional section about the
server object returned by get_server().

--
assignee: georg.brandl
components: Documentation
messages: 96512
nosy: georg.brandl, schwarz
severity: normal
status: open
title: doc of multiprocessing.managers is wrong (server_forever)
type: behavior
versions: Python 2.6

___
Python tracker 

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



[issue7381] subprocess.check_output: "docstring has inconsistent leading whitespace"

2009-12-17 Thread flox

Changes by flox :


Removed file: http://bugs.python.org/file15446/issue7381.diff

___
Python tracker 

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



[issue7381] subprocess.check_output: "docstring has inconsistent leading whitespace"

2009-12-17 Thread flox

Changes by flox :


Removed file: http://bugs.python.org/file15447/issue7381_py3k.diff

___
Python tracker 

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



[issue7381] subprocess.check_output: "docstring has inconsistent leading whitespace"

2009-12-17 Thread flox

Changes by flox :


Added file: http://bugs.python.org/file15581/issue7381_py3k_v2.diff

___
Python tracker 

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



[issue7381] subprocess.check_output: "docstring has inconsistent leading whitespace"

2009-12-17 Thread flox

flox  added the comment:

Patch updated to backport r51536 in trunk.
It makes "python -3" happier (do not compare None >= 0).

--
Added file: http://bugs.python.org/file15580/issue7381_v2.diff

___
Python tracker 

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



[issue3588] sysconfig variable LINKFORSHARED has wrong value for MacOS X framework build

2009-12-17 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

I agree with Ronald: making sure all variables in Makefile provide
values that can work in any environment just because distutils offers an
API to read them would be a major pain.

What is planned is to remove sysconfig from distutils, and have it in
the stdlib, with a private module built when ./configure is called, that
would contain these variables. 

And maybe we could filter out some variables in this process to keep
only the ones that can be used by code in all environments.

IOW, if python-config provides what you need, LINKFORSHARED could be
filtered out so the API cannot return it.

--
assignee:  -> tarek

___
Python tracker 

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



[issue7497] configure test for posix_semaphore capability leaves semaphore behind, causing test to fail for other users

2009-12-17 Thread Mark Dickinson

Mark Dickinson  added the comment:

The configure test for enabled POSIX semaphores is now failing for me on 
OS X 10.6:  the test produces

sem_open: Permission denied

--
assignee:  -> mark.dickinson
status: closed -> open

___
Python tracker 

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



[issue7529] StreamHandler does not live in logging.Handlers

2009-12-17 Thread Chris Withers

New submission from Chris Withers :

http://docs.python.org/library/logging.html#module-logging.handlers

...explains that StreamHandler lives in logging but then the class docs
say logging.handlers.

Georg, if this isn't trivial for you to fix, re-assign it to me and I'll
make the changes when I get a chance :-)

cheers,

Chris

--
assignee: georg.brandl
components: Documentation
messages: 96508
nosy: cjw296, georg.brandl
severity: normal
status: open
title: StreamHandler does not live in logging.Handlers
versions: Python 2.6, Python 2.7

___
Python tracker 

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



[issue7518] Some functions in pymath.c should be moved elsewhere.

2009-12-17 Thread Mark Dickinson

Mark Dickinson  added the comment:

So the configure test for tanh(-0.0) is purely informational:  it doesn't 
affect the behaviour of the built Python in any way.  I agree that the 
test is imperfect, in that if atan2 is also non-conformant on the given 
platform then the sign issue with tanh may go undetected, but all that 
happens in that case is that we get a bogus 'preserves sign of -0 ... yes' 
message in the configure output.

The wrapper for atan2 in Modules/mathmodules.c is a separate issue; it 
should ensure that we get the right behaviour for atan2 on all platforms,
including msvc 7.0.  I can't immediately see any reason why it wouldn't be 
working as intended.

> I don't think that python cmath tests will pass with MSVC before
8.0.

Which test(s) do you think will fail?

> May be is good to add depends=['_math.h'], for modules in setup.py.

Good point---thanks!  Done in r76865 (trunk), r76867 (py3k).

--

___
Python tracker 

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



[issue7528] Provide PyLong_AsLongAndOverflow compatibility to Python 2.x

2009-12-17 Thread Case Van Horsen

Case Van Horsen  added the comment:

Attached py3intcompat.c

--
Added file: http://bugs.python.org/file15579/py3intcompat.c

___
Python tracker 

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



[issue7528] Provide PyLong_AsLongAndOverflow compatibility to Python 2.x

2009-12-17 Thread Case Van Horsen

New submission from Case Van Horsen :

When I ported gmpy to Python 3.x, I began to use
PyLong_AsLongAndOverflow frequently. I found the code to slightly faster
and cleaner than using PyLong_AsLong and checking for overflow. I had
several code fragments that looked like:

#if PY_MAJOR_VERSION == 2
if(PyInt_Check(b)) {
temp = PyInt_AS_LONG(b));
Do stuff with temp.
}
#endif
if(PyLong_Check(b)) {
#if PY_MAJOR_VERSION == 3
temp = PyLong_AsLongAndOverflow(b, &overflow);
if(overflow) {
#else
temp = PyLong_AsLong(b);
if(PyErr_Occurred()) {
PyErr_Clear();
#endif
Convert b to an mpz.
} else {
Do stuff with temp.
}
}

I wanted to use the PyLong_AsLongAndOverflow method with Python 2.x so I
extracted the code for PyLong_AsLongAndOverflow, tweeked it to accept
either PyInt or PyLong, and called it PyIntOrLong_AsLongAndOverflow. I
also defined PyIntOrLong_Check.

The same code fragment now looks like:

if(PyIntOrLong_Check(b)) {
temp = PyIntOrLong_AsLongAndOverflow(b, &overflow);
if(overflow) {
Convert b to an mpz.
} else {
Do stuff with temp.
}
}

Is it possible to include a py3intcompat.c file with Python 2.7 that
provides this function (and possibly others) for extension authors to
include with their extension? A previous example is pymemcompat.h which
was made available in the Misc directory.

I'm specifically not in favor of adding it to the Python 2.7 API but
just in providing a file for extension authors to use. I've attached a
initial version that compiles successfully with Python 2.4+.

I'm willing to add additional functions, documentation, etc.

--
components: Extension Modules
messages: 96505
nosy: casevh
severity: normal
status: open
title: Provide PyLong_AsLongAndOverflow compatibility to Python 2.x
type: feature request
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