[issue9123] insecure os.urandom on VMS

2010-06-30 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
components: +Library (Lib)
nosy: +loewis
type:  -> security
versions: +Python 2.6, Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

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



[issue4963] mimetypes.guess_extension result changes after mimetypes.init()

2010-06-30 Thread S Arrowsmith

S Arrowsmith  added the comment:

That solution looks sound to me, in particular documenting the semantics of 
repeated init() calls!

As for the underlying problem, it seems to me that an alternative to copying 
the existing structures rather than rebuilding them would be to use 
OrderedDicts. Although I can't think why it might be a preferable alternative, 
other than being a bit clearer that order of insertion can affect behaviour.

--

___
Python tracker 

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



[issue9120] Reduce pickle size for an empty set

2010-06-30 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

A further version of the pickle protocol could have a dedicated opcode for sets 
instead...

--

___
Python tracker 

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



[issue9011] ast_for_factor unary minus optimization changes AST

2010-06-30 Thread Mark Dickinson

Mark Dickinson  added the comment:

It turns out that removing this code from py3k wasn't a no-op.  It changed the 
semantics for complex literals.  In Python 3.1.2:

>>> -7j
-7j
>>> (-7j).real
0.0

But in current release31-maint branch, and in 3.2a0:

Python 3.2a0 (py3k:82347M, Jun 28 2010, 22:25:11) 
[GCC 4.2.1 (Apple Inc. build 5659)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> -7j
(-0-7j)
>>> (-7j).real
-0.0

So IMO r82044 (the release31-maint branch) should be reverted, to avoid nasty 
surprises when people upgrade from 3.1.2 to 3.1.3.

But I'd like to keep this change in py3k:  I consider that the 3.1 behaviour is 
buggy, and that the 3.2 behaviour is more correct (strange though it may seem 
at first sight), so I'd prefer to leave the current py3k behaviour as is, and 
add a Misc/NEWS entry describing the change if necessary.

Assigning this to me because I don't want it to get forgotten.  But if anyone 
else is interested in producing a patch for the cleanup of the CST->AST code, 
please do!

--
assignee:  -> mark.dickinson
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



[issue9011] ast_for_factor unary minus optimization changes AST

2010-06-30 Thread Mark Dickinson

Mark Dickinson  added the comment:

r82044 reverted in r82389.

--

___
Python tracker 

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



[issue9011] ast_for_factor unary minus optimization changes AST

2010-06-30 Thread Mark Dickinson

Mark Dickinson  added the comment:

Added tests for the current Python < 3.2 treatment of imaginary literals in 
r82390 (release31-maint).  These tests should be backported to trunk, but I'll 
wait until after the release of 2.7 for that.

--

___
Python tracker 

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



[issue1643370] recursive urlparse

2010-06-30 Thread R. David Murray

R. David Murray  added the comment:

Since no patch has been proposed since 2007, I think it is time to close this 
feature request for lack of interest.

In any case I think this functionality would be better situated in a Python3 
URI/IRI parsing module with a full object model for the IRI, which is something 
complicated enough that it may need some time on PyPI before getting in to the 
standard library.

--
nosy: +r.david.murray
resolution: out of date -> 
stage: committed/rejected -> unit test needed
status: open -> closed

___
Python tracker 

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



[issue9011] ast_for_factor unary minus optimization changes AST

2010-06-30 Thread Mark Dickinson

Mark Dickinson  added the comment:

Added tests for Python 3.2's corrected treatment of negated imaginary literals 
in r82391, along with a Misc/NEWS entry indicating the changed behaviour.

Restored version numbers for this issue, which I seem to have accidentally 
deleted earlier.  (Including 3.1, since it could also benefit from the same 
cleanup.)

--
versions: +Python 2.6, Python 2.7, Python 3.1

___
Python tracker 

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



[issue6589] smtpd.SMTPServer can cause asyncore.loop to enter infinite event loop

2010-06-30 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Although the use case is pretty uncommon and somewhat twisted (take a look at 
Lib/test/test_ftplib.py for a nicer approach on wrapping asyncore.loop() in a 
thread) it is true that if SMTPServer class raise an exception at instantiation 
time, some garbage remains in asyncore.

To replicate this problem there's no need to involve threads:

>>> import asyncore, smtpd
>>> s = smtpd.SMTPServer(('127.0.0.1', "xxx"),None)
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python2.5/smtpd.py", line 280, in __init__
self.bind(localaddr)
  File "/usr/local/lib/python2.5/asyncore.py", line 303, in bind
return self.socket.bind(addr)
  File "", line 1, in bind
TypeError: an integer is required
>>> asyncore.socket_map
{3: }
>>> 

I think it's ok for SMTPServer.__init__ to cleanup asyncore and finally raise 
the exception, as you suggested in the first place.
I'll provide a patch later today.

--
assignee:  -> giampaolo.rodola
versions: +Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

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



[issue9110] contextlib.ContextDecorator

2010-06-30 Thread Michael Foord

Michael Foord  added the comment:

New patch uploaded with (I think) all suggested changes made. I left some text 
in the .. versionchanged:: tag for contextmanager as I think this is normal.

--
Added file: http://bugs.python.org/file17808/contextdecorator.2.patch

___
Python tracker 

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



[issue9110] contextlib.ContextDecorator

2010-06-30 Thread Nick Coghlan

Nick Coghlan  added the comment:

On Wed, Jun 30, 2010 at 9:51 PM, Michael Foord  wrote:
> I left some text in the .. versionchanged:: tag for contextmanager as I think 
> this is normal.

Yeah, what you did was what I meant (I just didn't say it very well)

The example use in the docs should call function() rather than invoke
the context manager explicitly.

Otherwise looks good, so I'd say go ahead and check it in :)

--

___
Python tracker 

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



[issue9110] contextlib.ContextDecorator

2010-06-30 Thread Michael Foord

Michael Foord  added the comment:

Committed revision 82394.

I left examples of using ContextDecorator with a decorated *and* in a with 
statement in the documentation. Feel free to trim the with statement example if 
you feel it is redundant.

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



[issue9124] Mailbox module demonstrates infeasibly slow performance

2010-06-30 Thread Steve Holden

New submission from Steve Holden :

The attached program completes in less than half a second under Python 2.5. 
Under Python 3 it takes almost three minutes on the same system. The issue 
appears to be heavy use of decoding, at least in a Windows system, during 
creation of the mailbox toc. The disparity may be less remarkable when not 
profiling.

Further attachments will include a test data file (a Thunderbird mailbox taken 
from the same host system) and profiler outputs from the 2.5 and 3.1 runs of 
this program.

--
components: Library (Lib)
files: test_thunderbird_mailbox.py
messages: 108978
nosy: holdenweb
priority: normal
severity: normal
stage: unit test needed
status: open
title: Mailbox module demonstrates infeasibly slow performance
type: performance
versions: Python 3.1
Added file: http://bugs.python.org/file17809/test_thunderbird_mailbox.py

___
Python tracker 

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



[issue9124] Mailbox module demonstrates infeasibly slow performance

2010-06-30 Thread Steve Holden

Changes by Steve Holden :


Added file: http://bugs.python.org/file17810/test.mailbox

___
Python tracker 

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



[issue9124] Mailbox module demonstrates infeasibly slow performance

2010-06-30 Thread Steve Holden

Changes by Steve Holden :


Added file: http://bugs.python.org/file17811/test2.5.out

___
Python tracker 

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



[issue9124] Mailbox module demonstrates infeasibly slow performance

2010-06-30 Thread Steve Holden

Changes by Steve Holden :


Added file: http://bugs.python.org/file17812/test3.1.out

___
Python tracker 

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



[issue9124] Mailbox module demonstrates infeasibly slow performance

2010-06-30 Thread Steve Holden

Steve Holden  added the comment:

Thread at http://aspn.activestate.com/ASPN/Mail/Message/python-dev/3873005 
refers to this issue. Posted files are already attached herewith.

--

___
Python tracker 

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



[issue6589] smtpd.SMTPServer can cause asyncore.loop to enter infinite event loop

2010-06-30 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +josiah.carlson

___
Python tracker 

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



[issue7830] Flatten nested functools.partial

2010-06-30 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I am attaching a patch, issue7830.diff, that takes an ultra-concervative 
approach: partials are only flattened if both outer and inner are of exact 
functools.partial type and the inner partial does not have __dict__.

--
assignee:  -> belopolsky
keywords: +needs review -patch
nosy: +belopolsky -Alexander.Belopolsky
stage:  -> patch review
versions:  -Python 2.7
Added file: http://bugs.python.org/file17813/issue7830.diff

___
Python tracker 

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



[issue9124] Mailbox module demonstrates infeasibly slow performance

2010-06-30 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 

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



[issue8056] Piped parent's multiprocessing.Process children cannot write to stdout

2010-06-30 Thread Vojtech Fried

Vojtech Fried  added the comment:

I have the same problem. Not only for piping but also when using redirection, 
e.g. 'stdout.py > log.txt'.
Interesting thing is that when I run it like 'python.exe stdout.py > log.txt' 
it works. I don't see why this should matter but apparently it does. ".py" 
files are registered to be open with '"C:\Python26\python.exe" "%1" %*'. 
My system: WinXp SP3, Python 2.6.5

--
nosy: +Vojtech.Fried

___
Python tracker 

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



[issue8056] Piped parent's multiprocessing.Process children cannot write to stdout

2010-06-30 Thread Tim Golden

Tim Golden  added the comment:

That's (still...) a known issue with Windows file associations and 
redirects:

   http://support.microsoft.com/kb/321788

In theory it was fixed way back when. In practise...

On 30/06/2010 15:04, Vojtech Fried wrote:
>
> Vojtech Fried  added the comment:
>
> I have the same problem. Not only for piping but also when using redirection, 
> e.g. 'stdout.py>  log.txt'.
> Interesting thing is that when I run it like 'python.exe stdout.py>  log.txt' 
> it works. I don't see why this should matter but apparently it does. ".py" 
> files are registered to be open with '"C:\Python26\python.exe" "%1" %*'.
> My system: WinXp SP3, Python 2.6.5
>
> --
> nosy: +Vojtech.Fried
>
> ___
> Python tracker
> 
> ___
> ___
> Python-bugs-list mailing list
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-bugs-list/mail%40timgolden.me.uk

--
nosy: +tim.golden

___
Python tracker 

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



[issue8056] Piped parent's multiprocessing.Process children cannot write to stdout

2010-06-30 Thread Vojtech Fried

Vojtech Fried  added the comment:

Thanks, the registry change proposed in the article fixed it.

--

___
Python tracker 

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



[issue9125] parser module doesn't like except-as syntax.

2010-06-30 Thread Mark Dickinson

New submission from Mark Dickinson :

There seems to be a parser module bug for the except-as syntax in Python 2.7.  
After applying the attached patch (which adds a test to test_parser), and 
running test_parser, I get:


==
FAIL: test_try_stmt (__main__.RoundtripLegalSyntaxTestCase)
--
Traceback (most recent call last):
  File "Lib/test/test_parser.py", line 237, in test_try_stmt
self.check_suite("try: pass\nexcept A as e: pass\n")
  File "Lib/test/test_parser.py", line 38, in check_suite
self.roundtrip(parser.suite, s)
  File "Lib/test/test_parser.py", line 20, in roundtrip
self.fail("could not roundtrip %r: %s" % (s, why))
AssertionError: could not roundtrip 'try: pass\nexcept A as e: pass\n': 
Expected node type 12, got 1.

--
files: parser_except_as_bug.patch
keywords: patch
messages: 108984
nosy: mark.dickinson
priority: normal
severity: normal
status: open
title: parser module doesn't like except-as syntax.
versions: Python 2.7
Added file: http://bugs.python.org/file17814/parser_except_as_bug.patch

___
Python tracker 

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



[issue9125] parser module doesn't like except-as syntax.

2010-06-30 Thread Mark Dickinson

Changes by Mark Dickinson :


--
components: +Library (Lib)
stage:  -> needs patch
type:  -> behavior

___
Python tracker 

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



[issue9125] parser module doesn't like except-as syntax.

2010-06-30 Thread Mark Dickinson

Mark Dickinson  added the comment:

Here's the correct test patch.

--
Added file: http://bugs.python.org/file17815/parser_except_as_bug.patch

___
Python tracker 

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



[issue9125] parser module doesn't like except-as syntax.

2010-06-30 Thread Mark Dickinson

Changes by Mark Dickinson :


Removed file: http://bugs.python.org/file17814/parser_except_as_bug.patch

___
Python tracker 

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



[issue9125] parser module doesn't like except-as syntax.

2010-06-30 Thread Mark Dickinson

Mark Dickinson  added the comment:

Minimal steps to reproduce:

Python 2.7rc2+ (trunk:82378M, Jun 29 2010, 19:43:46) 
[GCC 4.2.1 (Apple Inc. build 5659)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import parser
>>> parser.sequence2st(parser.suite("try: pass\nexcept A as e: 
>>> pass\n").totuple())
Traceback (most recent call last):
  File "", line 1, in 
parser.ParserError: Expected node type 12, got 1.

--

___
Python tracker 

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



[issue9126] errors='replace' does not work at Windows command line

2010-06-30 Thread John Van Praag

New submission from John Van Praag :

The declaration errors='replace' works from within IDLE but not at the Windows 
command line. I am attaching a program and text file that demonstrate the 
problem. The error shows up at the Windows command line as follows:

C:\Users\John\Documents\Python\bug_reports\001>python -m read_my_file
aaa a aaa a

bbb  bbb 

Traceback (most recent call last):
  File "C:\Python31\lib\runpy.py", line 128, in _run_module_as_main
"__main__", fname, loader, pkg_name)
  File "C:\Python31\lib\runpy.py", line 34, in _run_code
exec(code, run_globals)
  File "C:\Users\John\Documents\Python\bug_reports\001\read_my_file.py", line 
20, in 
readf()
  File "C:\Users\John\Documents\Python\bug_reports\001\read_my_file.py", line 
17, in readf
print(line)
  File "C:\Python31\lib\encodings\cp437.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 10-11: 
character maps to 


NOTE: It appears I can only attach 1 file to this report. So I am copying the 
program here. The text file to read is attached.

'''
read_my_file.py:
Reads lines from faulty file.
Hangs at line 3 when run from Windows command line.
Platforms:
Windows Vista Ultimate 64-bit
Python 3.1.2
'''
#The file to read.
my_file = 'junk.txt'

def readf():
#The declaration "errors='replace'" is suppposed replace characters the 
reader does not recognize with a dummy character such as a question mark.
#This fix works in the interpreter, but not from the Windows command 
line.
fh_read = open(my_file, errors='replace')
for line in fh_read:
print(line)

#Run.
readf()

--
components: Windows
files: junk.txt
messages: 108987
nosy: jvanpraag
priority: normal
severity: normal
status: open
title: errors='replace' does not work at Windows command line
versions: Python 3.1
Added file: http://bugs.python.org/file17816/junk.txt

___
Python tracker 

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



[issue9125] parser module doesn't like except-as syntax.

2010-06-30 Thread Mark Dickinson

Mark Dickinson  added the comment:

Here's a fix.

Benjamin, is this okay for 2.7, or should it wait for 2.7.1?

--
nosy: +benjamin.peterson
Added file: http://bugs.python.org/file17817/issue9125.patch

___
Python tracker 

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



[issue9029] errors='replace' works in IDLE, fails at Windows command line.

2010-06-30 Thread John Van Praag

John Van Praag  added the comment:

I just now resubmitted, with a text file and program demonstrating the
problem: Issue9126.

I am new to submitting Python bug reports and I would like to do it
right. I found I could only attach 1 file to the bug report. However, I
had two files: The text file to read, and the program doing the reading.
Is there some way to attach multiple files to a bug report? If not, what
is the customary way to handle submissions where there is a file to be
processed, and a program doing the processing? And perhaps other files
exhibiting output(s)?

Thanks,

John

On Sat, 19 Jun 2010 12:48 +, "R. David Murray"
 wrote:
> 
> R. David Murray  added the comment:
> 
> What you show is not a complete program, nor do you provide the complete
> traceback or the data causing the problem.  The most helpful thing would
> be a complete small program and data file demonstrating the problem. 
> That said, I'm wondering if your problem is the encoding of the terminal
> window.
> 
> --
> nosy: +r.david.murray
> 
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue9125] parser module doesn't like except-as syntax.

2010-06-30 Thread Mark Dickinson

Changes by Mark Dickinson :


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



[issue9125] parser module doesn't like except-as syntax.

2010-06-30 Thread Mark Dickinson

Changes by Mark Dickinson :


--
assignee:  -> mark.dickinson

___
Python tracker 

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



[issue9125] parser module doesn't like except-as syntax.

2010-06-30 Thread Mark Dickinson

Changes by Mark Dickinson :


--
stage: needs patch -> commit review

___
Python tracker 

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



[issue9127] subprocess.Popen.communicate() and SIGCHLD handlers

2010-06-30 Thread Benjamin Ryzman

New submission from Benjamin Ryzman :

http://pastie.org/1025197

Is it deemed acceptable that setting up one's own SIGCHLD handler breaks 
communicate()?

I did not find it in the documentation.

With the above workaround one can mix communicate() processes with processes 
spawned in the background that one's too lazy to wait for.

--
messages: 108990
nosy: zarkdav
priority: normal
severity: normal
status: open
title: subprocess.Popen.communicate() and SIGCHLD handlers
type: feature request
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



[issue9127] subprocess.Popen.communicate() and SIGCHLD handlers

2010-06-30 Thread Benjamin Ryzman

Changes by Benjamin Ryzman :


--
assignee:  -> d...@python
components: +Documentation, Library (Lib)
nosy: +d...@python

___
Python tracker 

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



[issue9127] subprocess.Popen.communicate() and SIGCHLD handlers

2010-06-30 Thread Jean-Paul Calderone

Jean-Paul Calderone  added the comment:

You should include all relevant issue materials here, in the Python issue 
tracker.  This ticket will be useless as soon as pastie.org decides to forget 
about your paste.

--
nosy: +exarkun

___
Python tracker 

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



[issue9127] subprocess.Popen.communicate() and SIGCHLD handlers

2010-06-30 Thread Benjamin Ryzman

Benjamin Ryzman  added the comment:

Content of the above pastie:

Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import signal
>>> import subprocess
>>> signal.signal(signal.SIGCHLD,signal.SIG_IGN)
0
>>> subprocess.Popen(["echo","blah"], stdout=subprocess.PIPE).communicate()[0]
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.6/subprocess.py", line 698, in communicate
self.wait()
  File "/usr/lib/python2.6/subprocess.py", line 1170, in wait
pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
  File "/usr/lib/python2.6/subprocess.py", line 465, in _eintr_retry_call
return func(*args)
OSError: [Errno 10] No child processes
>>> oldsignal = signal.signal(signal.SIGCHLD,signal.SIG_DFL)
>>> subprocess.Popen(["echo","blah"], stdout=subprocess.PIPE).communicate()[0]
'blah\n'
>>> signal.signal(signal.SIGCHLD,oldsignal)
0

--

___
Python tracker 

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



[issue9125] parser module doesn't like except-as syntax.

2010-06-30 Thread Mark Dickinson

Mark Dickinson  added the comment:

Updated patch, LBYL instead of EAFP flavour.

Oh, and this one actually compiles, too.

--
Added file: http://bugs.python.org/file17818/issue9125_v2.patch

___
Python tracker 

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



[issue9125] parser module doesn't like except-as syntax.

2010-06-30 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Go ahead.

--
stage: commit review -> needs patch

___
Python tracker 

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



[issue9125] parser module doesn't like except-as syntax.

2010-06-30 Thread Mark Dickinson

Mark Dickinson  added the comment:

Thanks, Benjamin.  Applied in r82400 (trunk) and r82401 (release26-maint).

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



[issue9120] Reduce pickle size for an empty set

2010-06-30 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

> A further version of the pickle protocol could 
> have a dedicated opcode for sets instead...

-1 We don't have to introduce a new (and backwards incompatible) opcode for 
every possible container type.  The space savings is miniscule (because you 
still need to list out the items).  All that is saved is the enclosing list or 
tuple setup (five bytes in the case of sets). 

People concerned about pickle size would be much better off investing time into 
a more generic solution (such as adding a code to automatically run 
zip/gzip/bzip/xz etc).

--

___
Python tracker 

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



[issue9029] errors='replace' works in IDLE, fails at Windows command line.

2010-06-30 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
resolution:  -> duplicate
status: open -> closed
superseder:  -> errors='replace' does not work at Windows command line

___
Python tracker 

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



[issue9120] Reduce pickle size for an empty set

2010-06-30 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> A further version of the pickle protocol could 
> > have a dedicated opcode for sets instead...
> 
> -1 We don't have to introduce a new (and backwards incompatible)
> opcode for every possible container type.

What I was implying is that someone interested in more efficient pickles could 
start the work of a new protocol version which would *include* such an 
improvement.

> All that is saved is the enclosing list or tuple setup (five bytes
> in the case of sets).

No, you would save the (string) reference to "builtins.set" and the whole 
constructor invocation boilerplate.

>>> len(pickle.dumps([1,2,3]))
14
>>> len(pickle.dumps({1,2,3}))
36

See? The difference is much more than 5 bytes.

What's more, you would avoid building a temporary list only to convert it to a 
set at the end.

> People concerned about pickle size would be much better off investing > time 
> into a more generic solution (such as adding a code to
> automatically run zip/gzip/bzip/xz etc).

That's at the expense of (un)pickling speed, though, while the above suggestion 
would improve performance in addition to reducing pickle sizes.

--

___
Python tracker 

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



[issue6589] smtpd.SMTPServer can cause asyncore.loop to enter infinite event loop

2010-06-30 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Patch in attachment.

--
keywords: +patch
Added file: http://bugs.python.org/file17819/smtpd.patch

___
Python tracker 

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



[issue9120] Reduce pickle size for an empty set

2010-06-30 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

>> People concerned about pickle size would be much better off investing >> 
>> time into a more generic solution (such as adding a code to
>> automatically run zip/gzip/bzip/xz etc).

> That's at the expense of (un)pickling speed, ...

Wanted to reply here so that the suggestion doesn't get lost.

When talking about pickle speed performance, we need to take into account that 
most use cases for pickle are i/o bound.  IOW, the time to pickle and unpickle 
is dominated by the time needed to read/write the pickle to/from disk or to 
send it across the wire.  In those common use cases, any time spent 
compressing/decompressing is more than made for by savings in transport/storage 
time.   This is a fairly common speed optimization and it would be nice if 
pickles supported it directly (i.e. the sender specifies a compression option 
and the receiver automatically detects the option from an opcode in the pickle.

--

___
Python tracker 

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



[issue6589] smtpd.SMTPServer can cause asyncore.loop to enter infinite event loop

2010-06-30 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Fixed in r82404, r82406, r82407 and r82408.

--
resolution:  -> fixed
stage: unit test needed -> 
status: open -> closed

___
Python tracker 

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



[issue9120] Reduce pickle size for an empty set

2010-06-30 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> When talking about pickle speed performance, we need to take into
> account that most use cases for pickle are i/o bound.  IOW, the time
> to pickle and unpickle is dominated by the time needed to read/write
> the pickle to/from disk or to send it across the wire.  In those
> common use cases, any time spent compressing/decompressing is more
> than made for by savings in transport/storage time.

This is an oversimplification. Transport and storage performance is
mostly orthogonal to CPU performance; depending on the situation, you
might care about the former, or the latter, or both. Adding a
compression layer obviously taxes the CPU more, while optimizing
bytecode decreases CPU consumption as I've pointed out.

(for example, it is quite unlikely, IMO, that ZODB setups are I/O bound
rather than CPU bound, given that it's a database system written in
Python; and even optimized databases such as PostgreSQL can exhibit
CPU-bound behaviour, depending on the hardware configuration, the
database size and the queries issued)

> This is a fairly common speed optimization and it would be nice if
> pickles supported it directly (i.e. the sender specifies a compression
> option and the receiver automatically detects the option from an
> opcode in the pickle.

I'm not sure what would be the point. It is trivially easy for people to
add that compression layer to their own protocols if they want to. Also,
the C code for pickle doesn't have to be complicated by interfacing it
with various third-party compression libraries.

(a doc addition would be more reasonable)

--

___
Python tracker 

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



[issue4384] Add a warnings.showwarning replacement for logging

2010-06-30 Thread Éric Araujo

Changes by Éric Araujo :


--
stage: needs patch -> committed/rejected
versions: +Python 2.7, Python 3.1

___
Python tracker 

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



[issue9128] Parser module fails to validate class decorators correctly.

2010-06-30 Thread Mark Dickinson

New submission from Mark Dickinson :

Python 2.7rc2+ (trunk:82399M, Jun 30 2010, 17:10:13) 
[GCC 4.2.1 (Apple Inc. build 5659)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import parser
[35303 refs]
>>> parser.sequence2st(parser.suite("@deco\nclass A(): pass").totuple())

XXX undetected error
Traceback (most recent call last):
  File "", line 1, in 
parser.ParserError: Expected node type 262, got 330.
[35347 refs]

Patch attached.

--
components: Extension Modules
files: parser_class_decorator.patch
keywords: patch
messages: 109002
nosy: mark.dickinson
priority: normal
severity: normal
status: open
title: Parser module fails to validate class decorators correctly.
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file17820/parser_class_decorator.patch

___
Python tracker 

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



[issue9129] DoS smtpd module vulnerability

2010-06-30 Thread Giampaolo Rodola'

New submission from Giampaolo Rodola' :

Steps to reproduce the issue:

- in one shell run: "python -m smtpd -n"
- in another one run: "for i in {1..1000};do nmap -sT -p 8025 localhost;done"

The server will print out the following output and just quit (DoS):

giampa...@ubuntu:~/svn/python-2.7$ ./python -m smtpd -n 
error: uncaptured python exception, closing channel <__main__.PureProxy 
listening localhost:8025 at 0xb74b0f4c> (:[Errno 107] 
Transport endpoint is not connected 
[/home/giampaolo/svn/python-2.7/Lib/asyncore.py|read|79] 
[/home/giampaolo/svn/python-2.7/Lib/asyncore.py|handle_read_event|430] 
[/home/giampaolo/svn/python-2.7/Lib/smtpd.py|handle_accept|296] 
[/home/giampaolo/svn/python-2.7/Lib/smtpd.py|__init__|124] 
[/home/giampaolo/svn/python-2.7/Lib/socket.py|meth|222])
giampa...@ubuntu:~/svn/python-2.7$ 

This is due to issue 6706.

--
components: Library (Lib)
messages: 109003
nosy: giampaolo.rodola
priority: normal
severity: normal
status: open
title: DoS smtpd module vulnerability
type: security
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

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



[issue9120] Reduce pickle size for an empty set

2010-06-30 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

> We don't have to introduce a new (and backwards incompatible)
> opcode for every possible container type.

I would draw the line at containers that have literal syntax (and necessarily 
have dedicated .pyc opcode).

This begs a question, however: why not use regular python bytecode in pickles?

I understand that originally pickle bytecode was supposed to restrict what 
functionality is available to unpickler, but this is a moot point these days.

The pickle documentation has a big red security warning (and some want to make 
it even bigger and redder, issue9105.)

Indeed, I've just checked that the following works:

>>> from pickle import *
>>> class evil:
...def __reduce__(self):
...return (exec, ("print('pwned!')",)) 
... 
>>> s = dumps(evil())
>>> loads(s)
pwned!


The advantages of using standard bytecode are numerous:

1. Python bytecode is much better understood than pickle bytecode.  Since it is 
exercised by every python program, bugs related to bytecode execution tend to 
be found and fixed quickly while pickle bytecode is considered to be quirky by 
many.

2. Much more effort had been spend on optimizing various aspects of python 
bytecode than pickle bytecode.

3. Using python bytecode will remove numerous arbitrary restrictions that 
current pickle protocol has such as not being able to pickle non module-level 
objects or anonymous functions.

The only downside I can think of is that doing this would place an extra 
constraint on bytecode evolution because pickles written by current version of 
python should remain loadable in all future versions.

--

___
Python tracker 

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



[issue9129] DoS smtpd module vulnerability

2010-06-30 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

It would be ideal to solve this issue in asyncore.py by fixing 
dispatcher.accept() once and for all, but I'm not sure whether this can be done 
in a fully retro-compatible way in terms of asyncore API.

Alternatively SMTPServer.handle_accept() can be fixed in the same way as 
pyftpdlib did:
http://code.google.com/p/pyftpdlib/source/browse/tags/release-0.5.2/pyftpdlib/ftpserver.py#622

   def handle_accept(self)
   try:
sock, addr = self.accept()
except TypeError:
# sometimes accept() might return None
return
except socket.error, err:
# ECONNABORTED might be thrown
if err[0] != errno.ECONNABORTED:
raise
return
else:
# sometimes addr == None instead of (ip, port)
if addr == None:
return

--
nosy: +josiah.carlson

___
Python tracker 

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



[issue9130] Parser module fails on short relative imports

2010-06-30 Thread Mark Dickinson

New submission from Mark Dickinson :

Python 2.7rc2+ (trunk:82399M, Jun 30 2010, 17:10:13) 
[GCC 4.2.1 (Apple Inc. build 5659)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import parser
[35303 refs]
>>> parser.sequence2st(parser.suite("from . import me").totuple())
Traceback (most recent call last):
  File "", line 1, in 
parser.ParserError: VALIDATION FAILURE: report this to the maintainer!
[35341 refs]

Patch attached.

--
assignee: mark.dickinson
components: Extension Modules
files: parser_relative_imports.patch
keywords: patch
messages: 109006
nosy: mark.dickinson
priority: normal
severity: normal
stage: commit review
status: open
title: Parser module fails on short relative imports
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file17821/parser_relative_imports.patch

___
Python tracker 

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



[issue9130] Parser module fails on short relative imports

2010-06-30 Thread Mark Dickinson

Mark Dickinson  added the comment:

With this patch, and the one in issue 9128, the parser module roundtrips 
correctly on all Lib/*.py and all Lib/test/*.py files (except for 
Lib/test/bad*.py).  Tested by doing:

./python.exe Demo/parser/test_parser.py Lib/*.py

and

./python.exe Demo/parser/test_parser.py Lib/test/*.py

(the latter after deleting the Lib/test/bad*.py files)

--

___
Python tracker 

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



[issue9131] test_set_reprs in test_pprint is fragile

2010-06-30 Thread Daniel Stutzbach

New submission from Daniel Stutzbach :

test_set_reprs in test_pprint creates a complex arrangement of frozensets and 
tests the pretty-printed repr against a string hard-coded in the test.  The 
hard-coded repr depends on the sort order of frozensets.  

However, "Since sets only define partial ordering (subset relationships), the 
output of the list.sort() method is undefined for lists of sets." (quoting 
http://docs.python.org/release/3.1/library/stdtypes.html#set-types-set-frozenset)

In a nutshell, the test assumes frozenset({0}) will always sort before 
frozenset({1}), but:

>>> frozenset({0}) < frozenset({1})
False
>>> frozenset({1}) < frozenset({0})
False

Consequently, this test is fragile.  Small changes to Python's sort algorithm 
cause the test to fail when it should pass.

I ran into this while playing with optimizations to the sort function, but I 
imagine other Python implementations will also run into trouble with this test.

--
assignee: stutzbach
components: Tests
messages: 109008
nosy: stutzbach
priority: low
severity: normal
stage: needs patch
status: open
title: test_set_reprs in test_pprint is fragile
versions: Python 3.2, Python 3.3

___
Python tracker 

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



[issue9132] Documentation for comparing dictionaries is out of date

2010-06-30 Thread Daniel Stutzbach

New submission from Daniel Stutzbach :

reference/expressions.html#notin reads:

"Mappings (dictionaries) compare equal if and only if their sorted (key, value) 
lists compare equal. [4] Outcomes other than equality are resolved 
consistently, but are not otherwise defined. [5]"

However, the last sentence is no longer true.  I suggest changing the last 
sentence to:

"Comparisons other than equality testing raise a TypeError."

I think the footnote [5] is sufficiently historical that it could be removed as 
well.  Alternately, it could be updated to read, "In older versions of Python, 
outcomes other than equality were resolved consistently but were not otherwise 
defined."

--
assignee: d...@python
components: Documentation
messages: 109009
nosy: d...@python, stutzbach
priority: normal
severity: normal
stage: needs patch
status: open
title: Documentation for comparing dictionaries is out of date
versions: Python 3.1, Python 3.2

___
Python tracker 

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



[issue9132] Documentation for comparing dictionaries is out of date

2010-06-30 Thread Daniel Stutzbach

Changes by Daniel Stutzbach :


--
keywords: +easy

___
Python tracker 

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



[issue9133] Invalid UTF8 Byte sequence not raising exception/being substituted

2010-06-30 Thread Mike Lewis

New submission from Mike Lewis :

When I do
codecs.encode(codecs.decode('\xed\xbc\xad', 'utf8'), 'utf8')

its not throwing an exception.  '\xed\xbc\xad' is an invalid UTF8 byte sequence.

It maps to the value U+DF2D which is a "surrogate pair" it seems.

http://tools.ietf.org/html/rfc3629#section-4

explains:

  However, pairs of
  UCS-2 values between D800 and DFFF (surrogate pairs in Unicode
  parlance), being actually UCS-4 characters transformed through
  UTF-16, need special treatment: the UTF-16 transformation must be
  undone, yielding a UCS-4 character that is then transformed as
  above.

which would suggest that it is invalid.

However, I think wikipedia's explanation is a bit clearer:

UTF-8 may only legally be used to encode valid Unicode scalar values. According 
to the Unicode standard the high and low surrogate halves used by UTF-16 
(U+D800 through U+DFFF) and values above U+10 are not legal Unicode values, 
and the UTF-8 encoding of them is an invalid byte sequence and should be 
treated as described above.


Thanks,
Mike

--
components: Unicode
messages: 109010
nosy: Mike.Lewis
priority: normal
severity: normal
status: open
title: Invalid UTF8 Byte sequence not raising exception/being substituted
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



[issue9133] Invalid UTF8 Byte sequence not raising exception/being substituted

2010-06-30 Thread Mike Lewis

Mike Lewis  added the comment:

Sorry, meant to add this part to the quote from the rfc:

This leads to different results for character
   numbers above 0x; the CESU-8 encoding of those characters is NOT
   valid UTF-8

--

___
Python tracker 

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



[issue9133] Invalid UTF8 Byte sequence not raising exception/being substituted

2010-06-30 Thread Ezio Melotti

Ezio Melotti  added the comment:

This is already fixed in Python 3.
However I think that for backward compatibility reasons it can't be fixed in 
Python 2, where it is possible to encode and decode every codepoint to/from 
UTF-8.

See also http://bugs.python.org/issue8271#msg102209

I think this can be closed as wontfix.

--
nosy: +ezio.melotti, haypo, lemburg
status: open -> pending
type:  -> behavior
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



[issue5006] Duplicate UTF-16 BOM if a file is open in append mode

2010-06-30 Thread Conrad.Irwin

Conrad.Irwin  added the comment:

Shouldn't this fix be back-ported to the 2.6 branch too?

--
nosy: +Conrad.Irwin

___
Python tracker 

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



[issue8271] str.decode('utf8', 'replace') -- conformance with Unicode 5.2.0

2010-06-30 Thread Ezio Melotti

Ezio Melotti  added the comment:

The issue about invalid surrogates in UTF-8 has been raised in #9133.

--

___
Python tracker 

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



[issue9133] Invalid UTF8 Byte sequence not raising exception/being substituted

2010-06-30 Thread Marc-Andre Lemburg

Changes by Marc-Andre Lemburg :


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

___
Python tracker 

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



[issue9131] test_set_reprs in test_pprint is fragile

2010-06-30 Thread Mark Dickinson

Mark Dickinson  added the comment:

I agree that this looks a bit suspicious.

Adding Raymond to the nosy list, since it looks like this is his code (r60264).

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



[issue9133] Invalid UTF8 Byte sequence not raising exception/being substituted

2010-06-30 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Ezio Melotti wrote:
> 
> I think this can be closed as wontfix.

Agreed. I've already closed the ticket.

--

___
Python tracker 

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



[issue9131] test_set_reprs in test_pprint is fragile

2010-06-30 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Yes, it's a fragile and crummy test.
Feel free to delete it.

--

___
Python tracker 

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



[issue9134] sre bug: lastmark_save/restore

2010-06-30 Thread Armin Rigo

New submission from Armin Rigo :

The re module is buggy is rare cases; see attached example script.

The bug is caused by the macros LASTMARK_SAVE and LASTMARK_RESTORE which are 
sometimes used without the extra code that does if (state->repeat) 
{mark_save()/mark_restore()}.

The bug appears by mis-reporting the position of groups within a repeated match 
(with * or +), notably the position of some groups that matched in older 
repetitions but (after some backtracking) not in newer ones.

--
components: Extension Modules
files: x.py
messages: 109019
nosy: arigo
priority: normal
severity: normal
status: open
title: sre bug: lastmark_save/restore
versions: Python 2.7
Added file: http://bugs.python.org/file17822/x.py

___
Python tracker 

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



[issue9131] test_set_reprs in test_pprint is fragile

2010-06-30 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

After discussion on #python-dev, have decided to mark the test as 
implementation specific and add a comment about why the test is fragile.

--
assignee: stutzbach -> rhettinger

___
Python tracker 

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



[issue9135] XMLRPC documentation binary file example does not execute.

2010-06-30 Thread Delaney Gillilan

New submission from Delaney Gillilan :

Documentation available at 
http://docs.python.org/release/3.0.1/library/xmlrpc.client.html#binary-objects 
produced incorrect results ...

Traceback (most recent call last):
  File "test_server.py", line 28, in 
print(handle.read().format('utf-8'))
  File "C:\python31\lib\io.py", line 1728, in read
decoder.decode(self.buffer.read(), final=True))
  File "C:\python31\lib\io.py", line 1299, in decode
output = self.decoder.decode(input, final=final)
  File "C:\python31\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 252: 
character maps to 

However a quick change (new to Python3 so this may need work) gives desired 
results.

Server:
from xmlrpc.server import SimpleXMLRPCServer
import xmlrpc.client
def python_logo():
 handle = open("python_logo.jpg", "rb") <-- needed "rb"
 return xmlrpc.client.Binary(handle.read())
 handle.close()
server = SimpleXMLRPCServer(("localhost", 8000))
print("Listening on port 8000...")
server.register_function(python_logo, 'python_logo')
server.serve_forever()

Client:
import xmlrpc.client
proxy = xmlrpc.client.ServerProxy("http://localhost:8000/";)
handle = open("fetched_python_logo.jpg", "wb") <-- needed "wb"
handle.write(proxy.python_logo().data)
handle.close()

Please update the documentation.  Thanks!

--
components: Library (Lib)
messages: 109021
nosy: Delaney.Gillilan
priority: normal
severity: normal
status: open
title: XMLRPC documentation binary file example does not execute.
type: crash
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



[issue9135] XMLRPC documentation binary file example does not execute.

2010-06-30 Thread Ezio Melotti

Ezio Melotti  added the comment:

This is already fixed in the latest version of the doc: 
http://docs.python.org/py3k/library/xmlrpc.client.html#binary-objects

--
nosy: +ezio.melotti
resolution:  -> out of date
stage:  -> committed/rejected
status: open -> closed
type: crash -> behavior

___
Python tracker 

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



[issue9134] sre bug: lastmark_save/restore

2010-06-30 Thread Ezio Melotti

Changes by Ezio Melotti :


--
components: +Regular Expressions
nosy: +ezio.melotti
stage:  -> unit test needed
type:  -> behavior

___
Python tracker 

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



[issue9133] Invalid UTF8 Byte sequence not raising exception/being substituted

2010-06-30 Thread Ezio Melotti

Changes by Ezio Melotti :


--
stage:  -> committed/rejected

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-06-30 Thread Yuv Gre

New submission from Yuv Gre :

I'm using Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit 
(Intel)] on win32. Running the following code:


import profile
import math
import decimal


def show_bug():
x = decimal.Decimal.from_float(math.e)**(-2**31)

profile.run('show_bug()')

And I get this stack trace:

Traceback (most recent call last):
  File "C:/Users/Me/Documents/python/temptest", line 15, in 
profile.run('show_bug()')
  File "C:\Python31\lib\profile.py", line 70, in run
prof = prof.run(statement)
  File "C:\Python31\lib\profile.py", line 456, in run
return self.runctx(cmd, dict, dict)
  File "C:\Python31\lib\profile.py", line 462, in runctx
exec(cmd, globals, locals)
  File "", line 1, in 
  File "C:/Users/Me/Documents/python/temptest", line 8, in show_bug
x = Decimal.from_float(math.e)**(-2**31)
  File "C:\Python31\lib\decimal.py", line 2212, in __pow__
context = getcontext()
  File "C:\Python31\lib\decimal.py", line 447, in getcontext
context = Context()
  File "C:\Python31\lib\decimal.py", line 3777, in __init__
for name, val in locals().items():
RuntimeError: dictionary changed size during iteration

--
components: Library (Lib)
messages: 109023
nosy: ubershmekel
priority: normal
severity: normal
status: open
title: RuntimeError when profiling Decimal
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



[issue9136] RuntimeError when profiling Decimal

2010-06-30 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti, mark.dickinson
stage:  -> unit test needed

___
Python tracker 

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



[issue9126] errors='replace' does not work at Windows command line

2010-06-30 Thread Ezio Melotti

Ezio Melotti  added the comment:

The problem is not in the reading part, but in the print().
Since the default encoding of your terminal is cp437 and cp437 is not able to 
encode the "bad character" (U+2019 RIGHT SINGLE QUOTATION MARK), an error is 
raised.

--
nosy: +ezio.melotti
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue9136] RuntimeError when profiling Decimal

2010-06-30 Thread Stefan Krah

Changes by Stefan Krah :


--
nosy: +skrah

___
Python tracker 

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



[issue8611] Python3 doesn't support locale different than utf8 and an non-ASCII path (POSIX)

2010-06-30 Thread STINNER Victor

STINNER Victor  added the comment:

See also #3080.

--

___
Python tracker 

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



[issue3080] Full unicode import system

2010-06-30 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue9104] test_exceptions does not test pickling with pickle.py

2010-06-30 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I would like to commit this as written.  If a better mechanism for associating 
native implementation with a pure python module is found, it can easily be 
added in the future.  Any objections?  The patch only adds more test cases, no 
code is changed.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue9104] test_exceptions does not test pickling with pickle.py

2010-06-30 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
assignee:  -> belopolsky
resolution:  -> accepted
stage: patch review -> commit review

___
Python tracker 

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



[issue7673] audioop: check that length is a multiple of the size

2010-06-30 Thread STINNER Victor

STINNER Victor  added the comment:

@Mark: Here is the updated version of the patch including all of your remarks. 
I fixed 3 bugs in my patch: the checks of adpcm2lin(), alaw2lin() and 
audioop.ulaw2lin() were incomplete (len was not checked).

I added 3.1 to the version field.

--
versions: +Python 3.1
Added file: http://bugs.python.org/file17823/audioop_check_length-2.patch

___
Python tracker 

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



[issue8990] array constructor and array.fromstring should accept bytearray.

2010-06-30 Thread STINNER Victor

STINNER Victor  added the comment:

array2.diff:
 - can you reindent the line "Py_ssize_t old_size = Py_SIZE(self);"?(even if 
it's not part of your patch)
 - you can avoid the "char *str;" variable (use directly buffer.buf)

--

> I changed "s#" to "y*". This means that str arguments are no longer
> accepted by fromstring (...) it is an incompatible change

It's maybe time to create .frombytes() and .tobytes() methods:

 - .tostring() will be a (deprecated?) alias to .tobytes()
 - .frombytes() only accepts bytes, bytearray and buffer compatible objects: 
use "y*" format
 - .fromstring() accepts str, bytes, bytearray and buffer compatible objects 
(encode str to utf-8): use "s*" format

But I still don't understand why array.fromstring() accepts character strings. 
So an easier solution is to apply array2.diff to Python 3.2, and replace "y*" 
by "s*" when the patch is applied to 3.1.

--

___
Python tracker 

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



[issue9132] Documentation for comparing dictionaries is out of date

2010-06-30 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Reference to "sorted (key, value) lists" is a bit misleading as well.  Dicts' 
equality is defined even if key or values are not orderable.

--
nosy: +belopolsky

___
Python tracker 

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



[issue9118] help() on a property descriptor launches interactive help

2010-06-30 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

This is simply because X.foo.fset is None and help(None) is the same as help(). 
 Now, I think help(None) should print help on None object rather than start 
interactive help.  Please consider attached patch.

--
keywords: +patch
nosy: +belopolsky
stage: needs patch -> patch review
Added file: http://bugs.python.org/file17824/issue9118.diff

___
Python tracker 

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



[issue9120] Reduce pickle size for an empty set

2010-06-30 Thread Alexandre Vassalotti

Alexandre Vassalotti  added the comment:

> This begs a question, however: why not use regular python bytecode in pickles?

Unlike pickle protocols, the bytecode is not required to be compatible across 
Python versions. Furthermore, Python bytecode is designed has a general purpose 
object serialization mechanism.

For the record, I am with Raymond about adding new opcodes for sets; pickle is 
complicated enough as it is. I am fine with the posted patch however.

--

___
Python tracker 

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



[issue9104] test_exceptions does not test pickling with pickle.py

2010-06-30 Thread Alexandre Vassalotti

Alexandre Vassalotti  added the comment:

> It works for pickle/_pickle and heapq/_heapq, but won't work for io/_io/_pyio.

You can make the dictionary values as lists for the 'blocked' argument for 
import_fresh_module(). That would work.

And, can you add documentation for import_module_implementations()? A 
description how it finds the optimized implementation of a module would be 
helpful too.

--

___
Python tracker 

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



[issue9096] importlib doesn't handle valid marshalled data with invalid semantics

2010-06-30 Thread Brett Cannon

Brett Cannon  added the comment:

Turns out that an ImportError should be raised when a bytecode object contains 
a non-code object. My next patch which makes SourceLoader the primary loader 
will have the fix.

--
components: +Library (Lib)
resolution:  -> accepted
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