[issue9937] _winreg.EnumValue causes MemoryError

2010-09-27 Thread Hirokazu Yamamoto

Changes by Hirokazu Yamamoto :


Removed file: http://bugs.python.org/file18999/py27_winreg_EnumValue.patch

___
Python tracker 

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



[issue9937] _winreg.EnumValue causes MemoryError

2010-09-27 Thread Hirokazu Yamamoto

Changes by Hirokazu Yamamoto :


Removed file: 
http://bugs.python.org/file19021/py27_fix_winreg_EnumValue_op1.patch

___
Python tracker 

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



[issue9937] _winreg.EnumValue causes MemoryError

2010-09-27 Thread Hirokazu Yamamoto

Hirokazu Yamamoto  added the comment:

I've withdrew my patch... It has still problem, and
I cannot fix it yet. I suppose option 2 is easy.
ANSI API's limitation makes it harder to implement
correctly.

--

___
Python tracker 

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



[issue9937] _winreg.EnumValue causes MemoryError

2010-09-27 Thread STINNER Victor

STINNER Victor  added the comment:

Can't we use RegEnumValueW and RegQueryInfoKeyW?

--

___
Python tracker 

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



[issue9958] (c)elementTree missing children

2010-09-27 Thread Valentin Kuznetsov

New submission from Valentin Kuznetsov :

Hi, I found that parsing XML file with identical structure leads to missing 
children item at some point. In my test case which I attach it happens at 
id=183. Basically I have XML with bunch of elements of the following structure:









when I parse them recursively, all, except the one with id=183, are parsed 
identically. The one with id=183 does not contain children. I tried the code 
with python 2.6 and python 2.7 on Mac and Linux. Bug exists in both version of 
ElementTree and cElementTree. Code and testbed XML are attached. Please untar 
and run as python test_bug.py.
Thanks,
Valentin

--
files: em_bug.tar
messages: 117440
nosy: vkuznet
priority: normal
severity: normal
status: open
title: (c)elementTree missing children
type: behavior
versions: Python 2.6, Python 2.7
Added file: http://bugs.python.org/file19028/em_bug.tar

___
Python tracker 

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



[issue9958] (c)elementTree missing children

2010-09-27 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

The given script yields an item on a "start" event; but the element may not be 
fully populated at this point. please read 
http://docs.python.org/library/xml.etree.elementtree.html#xml.etree.ElementTree.iterparse

You should use the "end" events instead.

--
nosy: +amaury.forgeotdarc
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



[issue2972] arguments and default path not set in site.py and sitecustomize.py

2010-09-27 Thread Geoffrey Bache

Geoffrey Bache  added the comment:

I also just ran into this. Is it likely that an enhancement request to provide 
access to the "raw" command line, as requested by the previous commenter, would 
be accepted? It's sometimes useful to have some idea about what kind of Python 
process is being started at this point.

--
nosy: +gjb1002

___
Python tracker 

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



[issue2972] arguments and default path not set in site.py and sitecustomize.py

2010-09-27 Thread Tim Golden

Tim Golden  added the comment:

Merely from a Windows point-of-view, you could get the full
command line fairly easily:



import ctypes
pstring = ctypes.windll.kernel32.GetCommandLineW ()
print (ctypes.c_wchar_p (pstring).value)



TJG

--
nosy: +tim.golden

___
Python tracker 

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



[issue9959] int(math.log(4,2)) == 1 instead of 2

2010-09-27 Thread akira

New submission from akira <4kir4...@gmail.com>:

$ python3.1 -c'import math; f = math.log(4,2); print(int(f), 
f.as_integer_ratio())'
2 (2, 1)

$ python3.2 -c'import math; f = math.log(4,2); print(int(f), 
f.as_integer_ratio())'
1 (9007199254740991, 4503599627370496)

Python 3.2a2+ (py3k:85028, Sep 27 2010, 16:46:11) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> f = math.log(32, 2)
>>> f
4.999
>>> int(f)
4
>>> f.as_integer_ratio()
(5629499534213119, 1125899906842624)

I'm not sure whether it is a bug, but it is an unexpected change in behavior 
between 3.1 and 3.2.

--
components: Library (Lib)
messages: 117444
nosy: akira
priority: normal
severity: normal
status: open
title: int(math.log(4,2)) == 1 instead of 2
type: behavior
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



[issue2972] arguments and default path not set in site.py and sitecustomize.py

2010-09-27 Thread Geoffrey Bache

Geoffrey Bache  added the comment:

Interesting. Any idea if something similar is possible on Linux?

--

___
Python tracker 

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



[issue9955] multiprocessing.Pipe segmentation fault when recv of unpicklable object

2010-09-27 Thread Brian Curtin

Changes by Brian Curtin :


--
nosy: +asksol

___
Python tracker 

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



[issue2972] arguments and default path not set in site.py and sitecustomize.py

2010-09-27 Thread Tim Golden

Tim Golden  added the comment:

I'm afraid I don't know; might be worth asking that on the main python mailing 
list.

--

___
Python tracker 

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



[issue9959] int(math.log(4,2)) == 1 instead of 2

2010-09-27 Thread Mark Dickinson

Mark Dickinson  added the comment:

No, it's not really a bug:  math.log(x, 2) isn't an atomic operation: it's 
computed internally as something like log(x) / log(2), and since each of the 
three steps (computation of the logs, division) can introduce a small rounding 
error, you shouldn't be surprised if the result doesn't come out exactly.

The difference between 3.1 and 3.2 was a side-effect of a change to remove the 
dependence of the math module on the internal long integer representation.

Having said that, it would be possible to improve the algorithm that's used to 
compute log of an integer (see the loghelper function in Modules/mathmodule.c): 
currently, for positive k, log(2**k) ends up being computed as log(0.5) + 
(k+1)*log(2), which doesn't help;  it would be slightly better if it were 
computed directly as k*log(2) instead.  But you still can't (and shouldn't) 
rely on log(x, 2) giving exact results for powers of 2.

I'm not sure what you're using math.log(x, 2) for, but you may be interested in 
the int.bit_length method.

--
assignee:  -> mark.dickinson
nosy: +mark.dickinson

___
Python tracker 

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



[issue9960] test_structmembers fails on s390x (bigendian 64-bit): int/Py_ssize_t issue

2010-09-27 Thread Dave Malcolm

New submission from Dave Malcolm :

test test_structmembers crashed -- :
string too long
Traceback (most recent call last):
  File "/builddir/build/BUILD/Python-2.7/Lib/test/regrtest.py", line 863, in 
runtest_inner
the_package = __import__(abstest, globals(), locals(), [])
  File "/builddir/build/BUILD/Python-2.7/Lib/test/test_structmembers.py", line 
12, in 
9.9, 10.1010101010, "hi")
ValueError: string too long

_testcapimodule.c: test_structmembers_new's fmt has:
  "s#"
and these args:
  &s, &string_len

for grabbing this data:
const char *s = NULL;
Py_ssize_t string_len = 0;

However, the module doesn't define PY_SSIZE_T_CLEAN, which leads to &string_len 
being treated as an (int*) rather than a (Py_ssize_t*) and thus written to with 
just the first 32-bits of the size, rather than the full size.

The PyArgs_ call without PY_SSIZE_T_CLEAN writes the size of the string (2) 
through (int*)&string_len, writing 0x0002 to the first 4 bytes, setting the 
64-bit "string_len" value to 0x0002 i.e. 2^34, wildly too large for 
the iirc 5 byte buffer.

Confirmed in gdb:
  (gdb) p string_len
  $2 = 8589934592

  (gdb) p /x string_len
  $3 = 0x2

Am attaching a patch (against 2.7 maintenance branch) which defines 
PY_SSIZE_T_CLEAN; doing so requires updating another int to be a Py_ssize_t in 
that module, within test_u_code.


http://docs.python.org/c-api/arg.html lists "u# (Unicode) [Py_UNICODE *, int]" 
and has no reference to the effect of PY_SSIZE_T_CLEAN on the "u#" format 
specifier.  My reading of Python/getargs.c is that this macro does affect "u#" 
in a manner analogous to "s#"; does this documentation need clarifying?

--
components: Tests
files: python-test_structmembers.patch
keywords: easy, patch
messages: 117448
nosy: dmalcolm
priority: normal
severity: normal
stage: patch review
status: open
title: test_structmembers fails on s390x (bigendian 64-bit): int/Py_ssize_t 
issue
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file19029/python-test_structmembers.patch

___
Python tracker 

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



[issue9960] test_structmembers fails on s390x (bigendian 64-bit): int/Py_ssize_t issue

2010-09-27 Thread Mark Dickinson

Changes by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue9961] Identity Crisis! variable assignment using strftime fails comparison test.

2010-09-27 Thread Bill Hawkes

New submission from Bill Hawkes :

See below. When variable assignment is used with strftime for the day of the 
week, it fails comparison checks for the days of the week. Even when using the 
str() function it still fails. Manual entry of variable assignment is required 
for a successful comparison. This pretty well defeats the purpose of computer 
programming (automation). There seems to be a real identity crisis here!

$ python3
Python 3.0rc1+ (py3k, Oct 28 2008, 09:23:29) 
[GCC 4.3.2] on linux2
>>> import time
>>> from datetime import date
>>> today = date.today()
>>> print("This line will always print")
This line will always print
>>> myday = today.fromordinal(today.toordinal() - 31)
>>> printthis = myday.strftime("%m-%d-%y. %d %b %Y is a %A on the %d day of 
>>> %B.")
>>> print("%s" % printthis)
08-27-10. 27 Aug 2010 is a Friday on the 27 day of August.
>>> # dow is Day Of Week variable
... dow = myday.strftime("%A")
>>> chkval = dow
>>> dow is chkval
True
>>> print("dow is %s" % dow)
dow is Friday
>>> print("chkval is %s" % chkval)
chkval is Friday
>>> print("%s" % dow)
Friday
>>> print("%s" % chkval)
Friday
>>> dow is chkval
True
>>> if dow is 'Sunday':
...cntbck = 0
... elif dow is 'Monday':
...cntbck = 1
... elif dow is 'Tuesday':
...cntbck = 2
... elif dow is 'Wednesday':
...cntbck = 3
... elif dow is 'Thursday':
...cntbck = 4
... elif dow is 'Friday':
...cntbck = 5
... elif dow is 'Saturday':
...cntbck = 6
... else:
...cntbck = 'undefined'
...print("What day is it? It is %s" % dow)
... 
What day is it? It is Friday
>>> print('finished with script')
finished with script
>>> dow is 'Friday'
False
>>> dow = 'Friday'
>>> dow is 'Friday'
True
>>> chkval
'Friday'
>>> dow
'Friday'
>>> chkval is dow
False
>>>  chkval is 'Friday'
False
>>> chkval
'Friday'
>>> chkval = str(chkval)
>>> chkval
'Friday'
>>> chkval is 'Friday'
False
>>> cntbck
'undefined'
>>>

--
components: Interpreter Core
messages: 117449
nosy: BillHawkes
priority: normal
severity: normal
status: open
title: Identity Crisis! variable assignment using strftime fails comparison 
test.
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



[issue9961] Identity Crisis! variable assignment using strftime fails comparison test.

2010-09-27 Thread Jean-Paul Calderone

Jean-Paul Calderone  added the comment:

You mistakenly used "is" for these comparisons, rather than "==".  The strftime 
involvement is a red herring.  The real problem is the use of an /identity/ 
comparison rather than an /equality/ comparison.

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



[issue1615376] subprocess doesn\'t handle SIGPIPE

2010-09-27 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue1652] subprocess should have an option to restore SIGPIPE to default action

2010-09-27 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue9609] make cProfile multi-stack aware

2010-09-27 Thread Todd Whiteman

Changes by Todd Whiteman :


--
nosy: +twhitema

___
Python tracker 

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



[issue9941] Unify trace and profile interfaces

2010-09-27 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I've ran into a problem adding context manager functionality to Profile/Trace 
objects.  When profile/trace function is set in __enter__ and removed in 
__exit__ it catches two spurious events: a return from __enter__ and a call to 
__exit__.  This is particularly problematic with Profile which is not prepared 
to handle a return event that does not follow a matching call.

--

___
Python tracker 

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



[issue1634774] locale 1251 does not convert to upper case properly

2010-09-27 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

the OP is right: str.upper is supposed to be locale-dependent
http://docs.python.org/library/stdtypes.html#str.upper

But the implementation uses _toupper() which is a macro with Visual Studio, and 
obviously not locale-dependent:

#define _toupper(_Char)( (_Char)-'a'+'A' )

--
nosy: +amaury.forgeotdarc
stage: unit test needed -> needs patch

___
Python tracker 

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



[issue9950] socket.sendall() crash when receiving a signal

2010-09-27 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Patch committed in r85032. I'm gonna watch the buildbots a bit, in case the 
test fails on some platforms.

--
assignee:  -> pitrou
resolution:  -> fixed
stage:  -> committed/rejected

___
Python tracker 

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



[issue8521] Allow some winreg functions to accept named arguments

2010-09-27 Thread Brian Curtin

Brian Curtin  added the comment:

Committed in r85033.

--
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue8158] documentation of 'optparse' module incomplete

2010-09-27 Thread Sandro Tosi

Sandro Tosi  added the comment:

Hello,
since 2.7 optparse is deprecated in favor of argparse: is this bug still worth 
to be fixed? If so, I can work on a patch for the doc.

Regards,
Sandro

--
nosy: +sandro.tosi

___
Python tracker 

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



[issue8158] documentation of 'optparse' module incomplete

2010-09-27 Thread Sandro Tosi

Sandro Tosi  added the comment:

Sorry, I probably overlooked at the situation. After a quick chat with Antoine 
on IRC, it's clear optparse is here to stay for all the lifetime of 2.7 (quite 
a long and prosper, we hope :) so yes, it's worth work on its documentation, 
hence I'll start preparing a patch and I'll submit it asap.

Cheers,
Sandro

--

___
Python tracker 

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



[issue9959] int(math.log(4,2)) == 1 instead of 2

2010-09-27 Thread akira

akira <4kir4...@gmail.com> added the comment:

> No, it's not really a bug: math.log(x, 2) isn't an atomic operation:

It is not a bug, but values of math.log(4) differs between 3.1 and 3.2
i.e., math.log(4.0) in 3.2 returns value that is consistent with
math.log(4) in 3.1 but math.log(4) in 3.2 doesn't.

> I'm not sure what you're using math.log(x, 2) for, but you may be
interested in the int.bit_length method.

The docs for int.bit_length say: 

> if x is nonzero, then x.bit_length() is the unique positive integer
k such that 2**(k-1) <= abs(x) < 2**k. Equivalently, when abs(x) is
small enough to have a correctly rounded logarithm, then k = 1 +
int(log(abs(x), 2)).

It is expected that int(log(n,2)) produces correct result for small n.

> Having said that, it would be possible to improve the algorithm
 that's used to compute log of an integer (see the loghelper function
 in Modules/mathmodule.c): currently, for positive k, log(2**k) ends
 up being computed as log(0.5) + (k+1)*log(2), which doesn't help; it
 would be slightly better if it were computed directly as k*log(2)
 instead.  But you still can't (and shouldn't) rely on log(x, 2)
 giving exact results for powers of 2.

I've changed loghelper() to return improved result for power of 2

--
keywords: +patch
Added file: http://bugs.python.org/file19030/math_log_power_two.diff

___
Python tracker 

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



[issue9441] increase logging handlers test coverage

2010-09-27 Thread Brian Curtin

Brian Curtin  added the comment:

It would be nice to see tests for NTEventLogHandler, as there are currently 
none.

I looked into implementing NTEventLogHandler's Win32 calls in a C extension 
rather than requiring a third-party module, but stopped once I realized there 
weren't any tests. I may get to it myself, but I thought I'd throw this out 
there.

--
nosy: +brian.curtin

___
Python tracker 

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



[issue9959] int(math.log(4,2)) == 1 instead of 2

2010-09-27 Thread akira

Changes by akira <4kir4...@gmail.com>:


Added file: http://bugs.python.org/file19031/test_log_power_two.py

___
Python tracker 

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



[issue1665333] Documentation missing for OptionGroup class in optparse

2010-09-27 Thread Sandro Tosi

Sandro Tosi  added the comment:

I will work on it, it noone objects.

Cheers,
Sandro

--
nosy: +sandro.tosi

___
Python tracker 

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



[issue9950] socket.sendall() crash when receiving a signal

2010-09-27 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The patch passes at least on Linux, OS X and Solaris buildbots. Backported to 
3.1 (r85034) and 2.7 (r85035).

--
status: open -> closed

___
Python tracker 

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



[issue9959] int(math.log(4,2)) == 1 instead of 2

2010-09-27 Thread akira

Changes by akira <4kir4...@gmail.com>:


--
type: behavior -> feature request

___
Python tracker 

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



[issue9929] subprocess.Popen unbuffered not work

2010-09-27 Thread R. David Murray

R. David Murray  added the comment:

But if line buffering doesn't work, disabling buffering on stdout/stderr does 
have a functional consequence: it allows process output to appear as generated 
instead of coming in chunks when the buffer is full.  Of course, I could be 
completely misunderstanding what you are talking about :)

--
nosy: +r.david.murray

___
Python tracker 

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



[issue9929] subprocess.Popen unbuffered not work

2010-09-27 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> But if line buffering doesn't work, disabling buffering on 
> stdout/stderr does have a functional consequence: it allows process 
> output to appear as generated instead of coming in chunks when the
> buffer is full

Yes, sorry, I had it backwards. It's buffering on stdin which doesn't make any 
functional difference (whether it's buffered or not, you always get data as 
soon as it arrives).

--

___
Python tracker 

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



[issue8959] WINFUNCTYPE wrapped ctypes callbacks not functioning correctly in Python 2.7

2010-09-27 Thread Brian Curtin

Brian Curtin  added the comment:

This doesn't seem to be an issue anymore.

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



[issue9934] Python Docs Typo

2010-09-27 Thread Éric Araujo

Éric Araujo  added the comment:

Ported to distutils2 in 2f460982b025, thanks!

--
components: +Distutils2
nosy: +eric.araujo

___
Python tracker 

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



[issue9943] TypeError message became less helpful in Python 2.7

2010-09-27 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo

___
Python tracker 

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



[issue9945] Improper locking in logging

2010-09-27 Thread Éric Araujo

Éric Araujo  added the comment:

Just to be sure: this does not apply to 3.1?

--
nosy: +eric.araujo

___
Python tracker 

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



[issue9946] lock use in logging

2010-09-27 Thread Éric Araujo

Changes by Éric Araujo :


--
superseder:  -> Improper locking in logging

___
Python tracker 

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



[issue3532] bytes.tohex method

2010-09-27 Thread Éric Araujo

Éric Araujo  added the comment:

See #9951 for a patch adding bytes.hex

--

___
Python tracker 

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



[issue9951] introduce bytes.hex method

2010-09-27 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo

___
Python tracker 

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



[issue9957] SpooledTemporayFile.truncate should take size parameter

2010-09-27 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +georg.brandl
stage:  -> patch review
type: behavior -> feature request
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



[issue9956] memoryview type documentation lacks versionadded

2010-09-27 Thread Éric Araujo

Éric Araujo  added the comment:

Python 3.1 is considered a new start, so there is no versionadded:: 3.1.  The 
directive is used for things new in 3.2 and later versions.  Thanks for the 
patch!

--
nosy: +eric.araujo

___
Python tracker 

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



[issue9943] TypeError message became less helpful in Python 2.7

2010-09-27 Thread Geoffrey Bache

Geoffrey Bache  added the comment:

I agree with Nick :) 

Though I'd say fixing a regression should take priority over further enhancing 
the messages.

--

___
Python tracker 

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



[issue9957] SpooledTemporayFile.truncate should take size parameter

2010-09-27 Thread Éric Araujo

Éric Araujo  added the comment:

Thank you for the report and patch.  Not sure if this a bug or a new feature.

Patch looks good, thanks for including a test too!.  Can you also edit the 
documentation?

(There are very minor whitespace nits in the patch, but I leave it to Georg to 
fix them or ignore them.)

--
nosy: +eric.araujo

___
Python tracker 

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



[issue1703592] have a way to ignore nonexisting locales in locale.setlocale

2010-09-27 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +d...@python

___
Python tracker 

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



[issue9959] int(math.log(4,2)) == 1 instead of 2

2010-09-27 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

It is not a reasonable request for math float functions to produce exact 
integer values and there is some harm in making further alterations to the 
existing algorithm (the more you tweak it in one place, the more you create 
oddities somewhere else).

There may be a case for a separate math.log2() function but this has never been 
requested before, so it is a low priority.

If the docs for bit_length() bug you, I can change them.  They are meant to be 
the exact math definition of bit_length, not an executable exact result using 
limited precision floating point.   Those docs are trying to inform users about 
bit_length() and are not making a promise about the behavior of math.log().

If you're wanting exact log results for integer inputs and bases, the math 
module is going to disappoint you no matter what we do.  This is a 
limited-precision-floating-point fact of life.

--
nosy: +rhettinger
priority: normal -> low

___
Python tracker 

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



[issue1776674] glob.glob inconsistent

2010-09-27 Thread Constantin Veretennicov

Changes by Constantin Veretennicov :


--
nosy: +kveretennicov

___
Python tracker 

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



[issue9584] Allow curly braces in fnmatch

2010-09-27 Thread Constantin Veretennicov

Changes by Constantin Veretennicov :


--
nosy: +kveretennicov

___
Python tracker 

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



[issue4573] zsh-style subpattern matching for fnmatch/glob

2010-09-27 Thread Constantin Veretennicov

Changes by Constantin Veretennicov :


--
nosy: +kveretennicov

___
Python tracker 

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



[issue8402] glob returns empty list with "[" character in the folder name

2010-09-27 Thread Constantin Veretennicov

Changes by Constantin Veretennicov :


--
nosy: +kveretennicov

___
Python tracker 

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



[issue3873] Unpickling is really slow

2010-09-27 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

One problem with the seek() approach is that some file-like objects have 
expensive seeks. One example is GzipFile, where seek(n) is O(n) (it first 
rewinds to the start of file, then reads n decompressed bytes). In the end, 
unpickling from a GzipFile becomes O(n**2).

I will try to use peek() instead.

--

___
Python tracker 

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



[issue3873] Unpickling is really slow

2010-09-27 Thread Alexandre Vassalotti

Alexandre Vassalotti  added the comment:

Didn't Victor say that only one seek at the end is necessary per
pickle? If this is the case, I don't think expensive seeks will be an
issue.

--

___
Python tracker 

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



[issue8787] warnings inside PyRun_SimpleString() display argv[1]

2010-09-27 Thread Brett Cannon

Changes by Brett Cannon :


--
assignee: brett.cannon -> 

___
Python tracker 

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



[issue7397] __import__ docs should reference importlib.import_module

2010-09-27 Thread Brett Cannon

Brett Cannon  added the comment:

Fixed in r85043.

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



[issue9082] warnings.filterwarnings doesn't work with -O

2010-09-27 Thread Brett Cannon

Brett Cannon  added the comment:

What specific failures are you talking about, Michael? I just ran regrtest with 
-O and had no (unexpected) failures.

--

___
Python tracker 

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



[issue9082] warnings.filterwarnings doesn't work with -O

2010-09-27 Thread Michael Foord

Michael Foord  added the comment:

When I run with -OO I get 42 test failures. Most of them look like they are due 
to missing docstrings but some are likely to be due to missing asserts.

42 tests failed:
test_bisect test_cmd test_code test_collections test_compileall
test_ctypes test_decimal test_deque test_descrtut test_dictcomps
test_difflib test_dis test_distutils test_doctest test_extcall
test_generators test_genexps test_getopt test_http_cookies
test_import test_itertools test_json test_lib2to3 test_listcomps
test_math test_metaclass test_pdb test_pickle test_pickletools
test_pyclbr test_setcomps test_syntax test_threading_local
test_tokenize test_unpack test_unpack_ex test_urllib2 test_weakref
test_xml_etree test_xml_etree_c test_zipimport
test_zipimport_support

--

___
Python tracker 

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



[issue9962] GzipFile doesn't have peek()

2010-09-27 Thread Antoine Pitrou

New submission from Antoine Pitrou :

GzipFile claims to implement BufferedIOBase but doesn't have peek().

--
components: Library (Lib)
messages: 117476
nosy: nirai, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: GzipFile doesn't have peek()
type: feature request
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



[issue9082] warnings.filterwarnings doesn't work with -O

2010-09-27 Thread Éric Araujo

Changes by Éric Araujo :


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



[issue9957] SpooledTemporayFile.truncate should take size parameter

2010-09-27 Thread Ryan Kelly

Ryan Kelly  added the comment:

I went looking for places to update the documentation but the description of 
SpooledTemporaryFile doesn't go into any detail of its methods, so I haven't 
added anything.  New patch fixes some whitespace issues.

I'd like to argue that this is a bug, since SpooledTemporaryFile is documented 
as "operates exactly as TemporaryFile() does", and TemporaryFile.truncate 
accepts a "size" parameter.

--
Added file: http://bugs.python.org/file19032/spooledtemporaryfile_truncate.patch

___
Python tracker 

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



[issue9957] SpooledTemporayFile.truncate should take size parameter

2010-09-27 Thread Ryan Kelly

Changes by Ryan Kelly :


Removed file: 
http://bugs.python.org/file19027/spooledtemporaryfile_truncate.patch

___
Python tracker 

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



[issue9945] Improper locking in logging

2010-09-27 Thread Vinay Sajip

Vinay Sajip  added the comment:

Good call, Éric - fix backported into release31-maint (r85045).

--

___
Python tracker 

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



[issue9947] Weird locking in logging config system

2010-09-27 Thread Vinay Sajip

Vinay Sajip  added the comment:

Fix checked into release31-maint (r85046).

--

___
Python tracker 

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



[issue3873] Unpickling is really slow

2010-09-27 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Didn't Victor say that only one seek at the end is necessary per
> pickle? If this is the case, I don't think expensive seeks will be an
> issue.

If you are unpickling from a multi-megabyte gzip file and the seek at
the end makes you uncompress all the gzip file again, it can certainly
be a problem.

Another issue with seeking only at the end is that it would make
readline() quite more complicated. And, apparently, readline() is not
only used on protocol 0 but also on binary protocols.

--

___
Python tracker 

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



[issue3873] Unpickling is really slow

2010-09-27 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Here is an update bench_pickle which also makes the file unpeekable.

--
Added file: http://bugs.python.org/file19033/bench_pickle.py

___
Python tracker 

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



[issue3873] Unpickling is really slow

2010-09-27 Thread Antoine Pitrou

Changes by Antoine Pitrou :


Removed file: http://bugs.python.org/file18241/bench_pickle.py

___
Python tracker 

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



[issue3873] Unpickling is really slow

2010-09-27 Thread Antoine Pitrou

Changes by Antoine Pitrou :


Removed file: http://bugs.python.org/file18983/bench_pickle.py

___
Python tracker 

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



[issue9082] warnings.filterwarnings doesn't work with -O

2010-09-27 Thread Michael Foord

Michael Foord  added the comment:

Most of those failures look like they have a similar cause (not all of them 
though) related to running doctests. When issue 6292 was closed all tests 
passed with -OO, so this is a regression. I'm raising a separate issue for 
that. 

Looking at the code actually in warnings.filterwarnings (currently at any rate) 
I wonder what tests possibly could fail due to the asserts not being run? Maybe 
I hallucinated the problem... (Or more likely it was actually another issue.)

--

___
Python tracker 

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



[issue3873] Unpickling is really slow

2010-09-27 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Here is a patch using peek() rather than seek(). There are some inefficiencies 
around (such as using read() to skip the consumed prefetched bytes), but the 
benchmark results are still as good as with seek():

Protocol 0
- dump: 142.5 ms
- load (seekable=False): 598.8 ms
- load (seekable=True): 240.2 ms

Protocol 1
- dump: 28.9 ms
- load (seekable=False): 253.2 ms
- load (seekable=True): 25.7 ms

Protocol 2
- dump: 28.9 ms
- load (seekable=False): 253.3 ms
- load (seekable=True): 25.7 ms

--
Added file: http://bugs.python.org/file19034/unpickleprefetch3.patch

___
Python tracker 

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



[issue9963] test_sysconfig when LDFLAGS defined in the user's environment

2010-09-27 Thread Brett Cannon

New submission from Brett Cannon :

test_sysconfig.test_ldshared_value is failing for me on Mac because my LDFLAGS 
environment variable is being defined twice in what 
sysconfig.get_config_var('LDFLAGS') returns. This fails in a comparison against 
sysconfig.get_config_var('LDSHARED') as the values are only set once::

AssertionError: '-L/Users/brett/.slash/_/lib -L/Users/brett/.local/lib  
-L/Users/brett/.slash/_/lib -L/Users/brett/.local/lib' not found in 'clang  
-L/Users/brett/.slash/_/lib -L/Users/brett/.local/lib -bundle -undefined 
dynamic_lookup'

I suspect what is happening is sysconfig is using PY_LDFLAGS, which uses both 
CONFIGURE_LDFLAGS *and* LDFLAGS when the Makefile is run. This leads to LDFLAGS 
being set twice if it was pulled from the user's environment variable

--
components: Library (Lib)
messages: 117484
nosy: brett.cannon
priority: deferred blocker
severity: normal
stage: needs patch
status: open
title: test_sysconfig when LDFLAGS defined in the user's environment
type: behavior
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



[issue9964] Test failures with -OO

2010-09-27 Thread Michael Foord

New submission from Michael Foord :

When I run the test suite (py3k branch) with -OO I get 42 failures. Most of 
these look like they are caused by the same (or a similar) problem (attempting 
to run doctests from now-non-existent docstrings).

The tests that fail are:

When I run with -OO I get 42 test failures. Most of them look like they are due 
to missing docstrings but some are likely to be due to missing asserts.

42 tests failed:
test_bisect test_cmd test_code test_collections test_compileall
test_ctypes test_decimal test_deque test_descrtut test_dictcomps
test_difflib test_dis test_distutils test_doctest test_extcall
test_generators test_genexps test_getopt test_http_cookies
test_import test_itertools test_json test_lib2to3 test_listcomps
test_math test_metaclass test_pdb test_pickle test_pickletools
test_pyclbr test_setcomps test_syntax test_threading_local
test_tokenize test_unpack test_unpack_ex test_urllib2 test_weakref
test_xml_etree test_xml_etree_c test_zipimport
test_zipimport_support

Typical tracebacks (one explicitly calling doctest code, the other through 
test.support):

Traceback (most recent call last):
  File "Lib/test/test_collections.py", line 3, in 
import unittest, doctest, operator
  File "/compile/py3k/Lib/doctest.py", line 97, in 
import unittest, difflib, pdb, tempfile
  File "/compile/py3k/Lib/pdb.py", line 1348, in 
__doc__ += getattr(Pdb, 'do_' + _command).__doc__.strip() + '\n\n'
AttributeError: 'NoneType' object has no attribute 'strip'

Traceback (most recent call last):
  File "Lib/test/test_code.py", line 169, in 
test_main()
  File "Lib/test/test_code.py", line 164, in test_main
run_doctest(test_code, verbose)
  File "/compile/py3k/Lib/test/support.py", line 1142, in run_doctest
import doctest
  File "/compile/py3k/Lib/doctest.py", line 97, in 
import unittest, difflib, pdb, tempfile
  File "/compile/py3k/Lib/pdb.py", line 1348, in 
__doc__ += getattr(Pdb, 'do_' + _command).__doc__.strip() + '\n\n'
AttributeError: 'NoneType' object has no attribute 'strip'


Issue 6292 was previously closed when all tests ran successfully with -OO, so 
this is a more recent regression.

--
components: Tests
messages: 117485
nosy: michael.foord, r.david.murray
priority: normal
severity: normal
status: open
title: Test failures with -OO
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



[issue9082] warnings.filterwarnings doesn't work with -O

2010-09-27 Thread Brett Cannon

Brett Cannon  added the comment:

I'm going to close this as I don't think any of the failures are because of the 
asserts, else -O would pick them up just as well as -OO.

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



[issue9082] warnings.filterwarnings doesn't work with -O

2010-09-27 Thread Michael Foord

Michael Foord  added the comment:

Cool - although I *do* see failures under -O; test_import for example. That one 
is a __pycache__ test, so barry's fault I think.

I'll detail the failures in issue 9964 as I think *most* of them are caused by 
a problem with pdb.py

In fact, if you run Python with -OO you can't even *import* pdb.

The attached patch fixes that problem (a hasty and untested patch though), and 
that reduces the number of failures to 5:

5 tests failed:
test_compileall test_dis test_import test_lib2to3 test_xml_etree

--
keywords: +patch
Added file: http://bugs.python.org/file19035/pdb.diff

___
Python tracker 

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



[issue9082] warnings.filterwarnings doesn't work with -O

2010-09-27 Thread Michael Foord

Changes by Michael Foord :


Removed file: http://bugs.python.org/file19035/pdb.diff

___
Python tracker 

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



[issue9082] warnings.filterwarnings doesn't work with -O

2010-09-27 Thread Michael Foord

Michael Foord  added the comment:

Oops. The patch should go to issue 9964. Sorry for all this noise.

--

___
Python tracker 

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



[issue9964] Test failures with -OO

2010-09-27 Thread Michael Foord

Michael Foord  added the comment:

Most of the failures are caused by a problem in pdb.

In fact, if you run Python with -OO you can't even *import* pdb.

The attached patch fixes that problem (a hasty and untested patch though), and 
that reduces the number of failures to 5:

5 tests failed:
test_compileall test_dis test_import test_lib2to3 test_xml_etre

--
keywords: +patch
nosy: +georg.brandl
Added file: http://bugs.python.org/file19036/pdb.diff

___
Python tracker 

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



[issue4111] Add Systemtap/DTrace probes

2010-09-27 Thread Dave Malcolm

Dave Malcolm  added the comment:

Updated py3k version of patch.

Changes:
  - renamed the probepoints:
  "function__entry" -> "frame__entry"
  "function__return" -> "frame__exit"
as I believe this better describes what these do
  - added a test suite: Lib/test/test_systemtap.py
  - reformatted to use 4-space indentation
  - slightly reworked the configure.in code

Some error-handling issue remain (see the FIXMEs in the code)

Tested and working on Fedora 13 x86_64, using:
  systemtap-1.3-1.fc13.x86_64
  kernel-2.6.33.3-84.fc13.x86_64
  kernel-devel-2.6.33.3-84.fc13.x86_64
  kernel-headers-2.6.33.3-84.fc13.x86_64
  kernel-debuginfo-2.6.33.3-84.fc13.x86_64
  kernel-debuginfo-common-x86_64-2.6.33.3-84.fc13.x86_64

--
Added file: http://bugs.python.org/file19037/py3k-add-systemtap-2010-09-27.patch

___
Python tracker 

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



[issue9962] GzipFile doesn't have peek()

2010-09-27 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Here is a first patch, tests still need to be written.

--
keywords: +patch
Added file: http://bugs.python.org/file19038/gzippeek.patch

___
Python tracker 

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



[issue9965] Loading malicious pickle may cause excessive memory usage

2010-09-27 Thread Alexandre Vassalotti

New submission from Alexandre Vassalotti :

This was mentioned during the review of issue #9410
(http://codereview.appspot.com/1694050/diff/2001/3001#newcode347), however we 
forgot to fix this.

The new array-based memo for the Unpickler class assumes incorrectly that memo 
indices are always contiguous. This is not the case. And due to this, the 
following pickle will cause Unpickler to use about 3GB of memory to store the 
memo array.

./python -c "import pickle; pickle.loads(b'\x80\x02]r\xff\xff\xff\x06.')"

To fix this, we can add code to fall-back to a dictionary-based memo when the 
memo keys are not contiguous.

--
components: Extension Modules
messages: 117492
nosy: alexandre.vassalotti
priority: critical
severity: normal
stage: needs patch
status: open
title: Loading malicious pickle may cause excessive memory usage
type: security
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



[issue9965] Loading malicious pickle may cause excessive memory usage

2010-09-27 Thread Alexandre Vassalotti

Changes by Alexandre Vassalotti :


--
nosy: +pitrou

___
Python tracker 

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



[issue9965] Loading malicious pickle may cause excessive memory usage

2010-09-27 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I don't think there's any point doing this. Pickle is insecure by construction; 
it shouldn't crash when used legitimately, but trying to make it robust in the 
face of hand-crafted pickle strings sounds like an uphill battle (*).

(*) e.g. http://nadiana.com/python-pickle-insecure

--

___
Python tracker 

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



[issue9965] Loading malicious pickle may cause excessive memory usage

2010-09-27 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

As an example of malicious pickle causing "excessive" memory usage, you can 
simply write:

>>> s = b'\x80\x03cbuiltins\nbytearray\nq\x00J\x00\x00\x00\x7f\x85q\x01Rq\x02.'
>>> _ = pickle.loads(s)

This will allocate an almost 2GB bytearray. You can of course change the size 
as you like. Here is the disassembly:

>>> pickletools.dis(s)
0: \x80 PROTO  3
2: cGLOBAL 'builtins bytearray'
   22: qBINPUT 0
   24: JBININT 2130706432
   29: \x85 TUPLE1
   30: qBINPUT 1
   32: RREDUCE
   33: qBINPUT 2
   35: .STOP
highest protocol among opcodes = 2


Therefore, I would recommend closing this issue.

--

___
Python tracker 

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



[issue9966] platform : a boolean to know easily when a system is posix

2010-09-27 Thread Florent Gallaire

New submission from Florent Gallaire :

Hi,

The platform module could provide a boolean to know easily if a system is posix 
or not.

The expected result, when the system is posix :

>>> import platform
>>> platform.isposix
True

otherwise :

>>> import platform
>>> platform.isposix
False

Here is a patch to do so. It also provides an update for the platform
documentation and a test case.

Best regards

Florent Gallaire

--
components: Library (Lib)
files: platform_isposix_boolean.py
messages: 117495
nosy: fgallaire
priority: normal
severity: normal
status: open
title: platform : a boolean to know easily when a system is posix
type: feature request
versions: Python 3.3
Added file: http://bugs.python.org/file19039/platform_isposix_boolean.py

___
Python tracker 

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



[issue9864] email.utils.{parsedate, parsedate_tz} should have better return types

2010-09-27 Thread Jeffrey Finkelstein

Jeffrey Finkelstein  added the comment:

Here's a patch for the python-email6 branch.

It seemed to make sense to remove parsedate_tz() and mktime_tz() here, since 
the parsedate() function now returns a datetime object, including timezone 
information (if it was parsed from the input string).

Also required updating several tests to work with the new return type, and 
removing a test that checked if the returned value of parsedate() (a time 
tuple) was "acceptable" for use with functions from the time module.

--
Added file: http://bugs.python.org/file19040/issue9864.datetime.patch

___
Python tracker 

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



[issue9966] platform : a boolean to know easily when a system is posix

2010-09-27 Thread Jean-Paul Calderone

Jean-Paul Calderone  added the comment:

It could, but why introduce this redundancy with `os.name`?

--
nosy: +exarkun

___
Python tracker 

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



[issue9965] Loading malicious pickle may cause excessive memory usage

2010-09-27 Thread Alexandre Vassalotti

Alexandre Vassalotti  added the comment:

I was going to say this method 
http://docs.python.org/dev/py3k/library/pickle.html#restricting-globals  could 
be used to prevent this kind of attack on bytearray. But, I came up with this 
fun thing:

pickle.loads(b'\x80\x03cbuiltins\nlist\ncbuiltins\nrange\nJ\xff\xff\xff\x03\x85R\x85R.')

Sigh... you are right about pickle being insecure by design. The only solution 
is to use HMAC to check the integrity and the authenticity of incoming pickles.

--

___
Python tracker 

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



[issue9966] platform : a boolean to know easily when a system is posix

2010-09-27 Thread Brian Curtin

Brian Curtin  added the comment:

I second what Jean-Paul said. os.name is well established and I don't think a 
second way to get the same information is needed.

Thanks for the suggestion and patch, Florent.

--
nosy: +brian.curtin
resolution:  -> rejected
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



[issue9967] encoded_word regular expression in email.header.decode_header()

2010-09-27 Thread Tokio Kikuchi

New submission from Tokio Kikuchi :

Regular expression ecre for RFC2047 encoded_word in email.header module have 
bugs:

1. encoded_word should be separated by SPACEs in both leading and trailing 
ends.  Current expression take care only trailing end.

2. encoded_text in the third part of encoded_word should not include literal ? 
or SPACE.

Also, ecre should not match against multiline.

The patch includes two test cases for test/test_email.py

--
components: Library (Lib)
files: email_header_ecrefix.patch
keywords: patch
messages: 117500
nosy: tkikuchi
priority: normal
severity: normal
status: open
title: encoded_word regular expression in email.header.decode_header()
versions: Python 2.5, Python 2.6, Python 2.7
Added file: http://bugs.python.org/file19041/email_header_ecrefix.patch

___
Python tracker 

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



[issue9929] subprocess.Popen unbuffered not work

2010-09-27 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> > But if line buffering doesn't work, disabling buffering on 
> > stdout/stderr does have a functional consequence: it allows process 
> > output to appear as generated instead of coming in chunks when the
> > buffer is full
> 
> Yes, sorry, I had it backwards. It's buffering on stdin which doesn't
> make any functional difference (whether it's buffered or not, you
> always get data as soon as it arrives).

Actually, I had it right (you confused me :-)). In the context of
subprocess, you write to the child's stdin pipe, and you read from the
child's stdout and stderr pipes. So, whether or not you buffer the reads
from stdout and stderr pipes doesn't make a difference (except in
performance): as soon as the child outputs a single byte, it becomes
available for the parent. But if you buffer the writes to stdin, the
child process will see data arrive only when the buffer is flushed.

Here is the relevant code in subprocess.py:

if p2cwrite != -1:
self.stdin = io.open(p2cwrite, 'wb', bufsize)
if self.universal_newlines:
self.stdin = io.TextIOWrapper(self.stdin)
if c2pread != -1:
self.stdout = io.open(c2pread, 'rb', bufsize)
if universal_newlines:
self.stdout = io.TextIOWrapper(self.stdout)
if errread != -1:
self.stderr = io.open(errread, 'rb', bufsize)
if universal_newlines:
self.stderr = io.TextIOWrapper(self.stderr)

Only stdin is opened in write mode.

--

___
Python tracker 

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



[issue5753] CVE-2008-5983 python: untrusted python modules search path

2010-09-27 Thread Jesús Cea Avión

Changes by Jesús Cea Avión :


--
nosy: +jcea

___
Python tracker 

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



[issue9602] PyObject_AsCharBuffer() should only accept read-only objects

2010-09-27 Thread Lenard Lindstrom

Lenard Lindstrom  added the comment:

PEP 3118

"""
Rationale

...

3) There is no way for a consumer to tell the buffer-API-exporting object it is 
"finished" with its view of the memory and therefore no way for the exporting 
object to be sure that it is safe to reallocate the pointer to the memory that 
it owns (for example, the array object reallocating its memory after sharing it 
with the buffer object which held the original pointer led to the infamous 
buffer-object problem).
"""


Let's consider Pygame, and the SDL surface it wraps as a pygame.Surface. Pygame 
exposes a surface's data through the buffer protocol for manipulation by a 
NumPy array. Now some SDL surfaces need locking before accessing, so Pygame 
will lock the surface for the lifetime of the consumer array. How is the 
surface unlocked when the array is reclaimed? By a buffer proxy that is owned 
by the array. The proxy unlocks the surface when the proxy is garbage 
collected. The new buffer protocol suggests a simpler way, equivalent to 
contexts, but only if the buffer release mechanism works as advertised. This 
promise is broken when a consumer calls PyBuffer_Release before it is done with 
the buffer.

All the questionable buffer api functions use the PyBUF_SIMPLE access flag. So 
I suggest a PyBUF_SIMPLE access request requires a returned buffer to remain 
valid for the lifetime of the exporter, not the Py_buffer view. If an exporter 
cannot honor this request, due to locking requirements for instance, then it 
raises an exception. All other access request flags promise that 
PyBuffer_Release, and therefore bf_releasebuffer, is called only when the 
buffer is released, not before.

--
nosy: +kermode

___
Python tracker 

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



[issue9675] segfault: PyDict_SetItem: Assertion `value' failed.

2010-09-27 Thread Jesús Cea Avión

Jesús Cea Avión  added the comment:

In the spirit of moving this forward:
http://mail.python.org/pipermail/python-dev/2010-September/104201.html

--

___
Python tracker 

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



[issue5753] CVE-2008-5983 python: untrusted python modules search path

2010-09-27 Thread Jesús Cea Avión

Jesús Cea Avión  added the comment:

This issue is equivalent to MS Windows DLL hijacking (the MS situation is 
worse, because the DDL can be in network shares or, even , in remote webdav 
servers):

http://blog.metasploit.com/2010/08/exploiting-dll-hijacking-flaws.html
http://news.cnet.com/8301-27080_3-20014625-245.html

When I learned about this attack, my first thought was "what if 
sys.path.index('')>=0?". Arg!.

--

___
Python tracker 

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



[issue9950] socket.sendall() crash when receiving a signal

2010-09-27 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

thanks Antoine!

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

___
Python tracker 

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