[issue2986] difflib.SequenceMatcher not matching long sequences

2010-11-11 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
versions:  -Python 3.1

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



[issue9520] Add Patricia Trie high performance container

2010-11-11 Thread Dirkjan Ochtman

Changes by Dirkjan Ochtman dirk...@ochtman.nl:


--
nosy: +djc

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



[issue10385] Mark up subprocess as module in its doc

2010-11-11 Thread Alexander Belopolsky

New submission from Alexander Belopolsky belopol...@users.sourceforge.net:

I was going to commit this patch, but decided to ask for a second opinion.  I 
think module names in section titles should be marked up with :mod:.

--
assignee: belopolsky
components: Documentation
files: subprocess-doc.diff
keywords: patch
messages: 120937
nosy: belopolsky
priority: normal
severity: normal
stage: commit review
status: open
title: Mark up subprocess as module in its doc
versions: Python 3.2
Added file: http://bugs.python.org/file19567/subprocess-doc.diff

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



[issue10383] test_os leaks under Windows

2010-11-11 Thread Antoine Pitrou

New submission from Antoine Pitrou pit...@free.fr:

Y:\py3k\__svn__\PCbuild\python_d.exe -m test.regrtest -R 3:2 test_os
[1/1] test_os
[33558 refs]
beginning 5 repetitions
12345
[33558 refs]
.[33558 refs]
.[33558 refs]
.[33558 refs]
.[33558 refs]
.
test_os leaked [3, 3] references, sum=6
1 test failed:
test_os
[117612 refs]

--
components: Library (Lib), Windows
messages: 120931
nosy: amaury.forgeotdarc, brian.curtin, ocean-city, pitrou, rhettinger, 
tim.golden
priority: normal
severity: normal
status: open
title: test_os leaks under Windows
type: resource usage
versions: Python 3.2

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



[issue2986] difflib.SequenceMatcher not matching long sequences

2010-11-11 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

Tim told me to continue with this as he has no time.
rev86401 - apply 3.1 doc fix

--
assignee: tim_one - terry.reedy

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



[issue10382] Command line error marker misplaced on unicode entry

2010-11-11 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

I am attaching a patch that seems to fix the issue.  Note that I considered 
fixing the problem in parsetok.c where offset is originally computed, but this 
is part of pgen which has to be compiled without unicode support.

The test case suitable to be included in unittests is:

try:
eval(b'\xc2\xa1'.decode('utf-8'))
except SyntaxError as err:
assert(err.offset == 1)

--
assignee:  - belopolsky
keywords: +patch
stage: needs patch - patch review
Added file: http://bugs.python.org/file19565/issue10382.diff

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



[issue10308] Modules/getpath.c bugs

2010-11-11 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

r86399 fixes the code checking PyUnicode_AsWideChar() failure.

The following change is useless, it cannot overflow:

-if (n + k  MAXPATHLEN)
+if (k  MAXPATHLEN - n)
 k = MAXPATHLEN - n;

n and k maximum values are MAXPATHLEN (and the maximum value of MAXPATHLEN is 
4096), whereas n and k type maximum values are at least 2^31.

--

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



[issue2986] difflib.SequenceMatcher not matching long sequences

2010-11-11 Thread Eli Bendersky

Eli Bendersky eli...@gmail.com added the comment:

Attaching a new patch for 2.7 freshly generated vs. current 2.7 maintenance 
branch from SVN.

--
Added file: http://bugs.python.org/file19569/issue2986.fix27.5.patch

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



[issue10205] Can't have two tags with the same QName

2010-11-11 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

3.1 was released before 2.7, so there are some features in 2.7 that aren’t in 
3.1.  Tests are probably candidate for backport.

(BTW, I don’t understand the fix :)  I guess I fail at boolean logic tonight.)

--
nosy: +eric.araujo

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



[issue10358] Doc styles for print should only use dark colors

2010-11-11 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

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



[issue2986] difflib.SequenceMatcher not matching long sequences

2010-11-11 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

Tim told me to continue with this as he has no time.
rev86401 - apply 3.1 doc fix

I cannot apply 2.7 patch. I has different header lines. In particular, 
TortoiseSVN cannot fetch nonexistent revision Mon Aug 30 06:37:52 2010 +0300. 
Please regenerate against current 2.7 with method used for 2.6/3.1.

--

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



[issue10382] Command line error marker misplaced on unicode entry

2010-11-11 Thread Alexander Belopolsky

New submission from Alexander Belopolsky belopol...@users.sourceforge.net:

 ¡™£¢∞§¶•ªº
  File stdin, line 1
¡™£¢∞§¶•ªº
  ^
SyntaxError: invalid character in identifier


It looks like strlen() is used instead of number of characters in the decoded 
string.

--
components: Interpreter Core
messages: 120930
nosy: belopolsky
priority: normal
severity: normal
stage: needs patch
status: open
title: Command line error marker misplaced on unicode entry
type: behavior
versions: Python 3.2

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



[issue10382] Command line error marker misplaced on unicode entry

2010-11-11 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


--
nosy: +loewis

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



[issue7434] general pprint rewrite

2010-11-11 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +eric.araujo

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



[issue10142] Support for SEEK_HOLE/SEEK_DATA

2010-11-11 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


Removed file: http://bugs.python.org/file19356/z

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



[issue10384] SyntaxError should contain exact location of the invalid character in identifier

2010-11-11 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


--
dependencies: +Command line error marker misplaced on unicode entry

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



[issue10372] [REGRESSION] test_gc fails in non-debug mode.

2010-11-11 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 Here is a patch. It moves warnings initialization after 
 io initialization (the latter being arguably more critical 
 than the former). Also adds two tests.

initstdio() and initmain() may emit warnings. Eg. issue #8766 (which now have a 
test in test_warnings).

It's possible to initialize warnings before initstdio() by rewriting more 
warnings functions in C (into _warnings). But I don't think that it would solve 
all issues: emit a warning may write text into stderr, and if stderr is not 
ready yet, it doesn't work anyway. So I'm ok to exchange initstdio() and 
warnings initialization: we may loose some warnings, but at least, the warnings 
machinery will be operational.

But Antoine, could you please add a comment to explain why warnings is 
initialized after initstdio()?

--

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



[issue10382] Command line error marker misplaced on unicode entry

2010-11-11 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


--
nosy: +ezio.melotti, haypo, lemburg

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



[issue10142] Support for SEEK_HOLE/SEEK_DATA

2010-11-11 Thread Jesús Cea Avión

Jesús Cea Avión j...@jcea.es added the comment:

Please, review this. I had changed IO to support the new flags too. To do it, I 
must relax error control in IO, a bit.

So, the new flag are supported both in os.lseek() and in standard file 
objects.

Please, Antoine, could you review?.

I have checked the patch manually, but I can't think a way to automate it. We 
don't have any ZFS machine in buildbot.

I would love to commit this next week. Thanks for your time.

--
assignee: loewis - pitrou
keywords: +patch
Added file: http://bugs.python.org/file19566/z.patch

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



[issue10372] [REGRESSION] test_gc fails in non-debug mode.

2010-11-11 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Committed in r86395 (3.x); I've only backported the tests to 2.7 and 3.1.

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

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



[issue10308] Modules/getpath.c bugs

2010-11-11 Thread Hallvard B Furuseth

Hallvard B Furuseth h.b.furus...@usit.uio.no added the comment:

STINNER Victor writes:
 The following change is useless, it cannot overflow:
 -if (n + k  MAXPATHLEN)
 +if (k  MAXPATHLEN - n)
  k = MAXPATHLEN - n;
 
 n and k maximum values are MAXPATHLEN (and the maximum value of
 MAXPATHLEN is 4096), (...)

OK.  I could only tell that for n, not for k.  But even so it would
certainly be an unlikely overflow.

--

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



[issue1589] New SSL module doesn't seem to verify hostname against commonName in certificate

2010-11-11 Thread anatoly techtonik

anatoly techtonik techto...@gmail.com added the comment:

Should we escalate this issue to CVA for Python 2.x?

--
nosy: +techtonik

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



[issue7061] Improve turtle module documentation

2010-11-11 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

On Sun, Oct 31, 2010 at 8:00 PM, Éric Araujo rep...@bugs.python.org wrote:
..
 “Python” is lower-cased only when referring to the executable (as a 
 file) itself.  When talking about the language, the implementation or
 the VM in an abstract way (not a file), It think it’s always “Python”.

For the record, this is covered in the Python documentation style guide:


Python

The name of our favorite programming language is always capitalized.


http://docs.python.org/dev/documenting/style.html

--

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



[issue10363] Embedded python, handle (memory) leak

2010-11-11 Thread Martin Dunschen

Martin Dunschen mdunsc...@gmail.com added the comment:

I have identified 5 cases where objects of type PyThread_type_lock are 
allocated but never freed again:

import.c:
import_lock

pystate.c:
head_mutex

thread.c:
key_mutex

ceval.c:
interpreter_lock

zliblock.c:
zlib_lock

This leads to a handle leak on windows (PyThread_type_lock) is mapped to 
PNRMUTEX, a structure that contains a HANDLE to an event, created by 
CreateEvent, but never released with CloseHandle. As I can see it, common to 
all thread implementations (in thread.c) is the PyThread_allocate_lock call for 
the above locks, but it is not matched by a PyThread_free_lock. I can imagine 
there are similar memory leaks in other thread implementations for different OS.

Additionally there is one directly created event in
timemodule.c
hInterruptEvent

And finally in
myreadline.c:
_PyOS_ReadmeLock

no matching PyThread_free_lock for the call to PyThread_allocate_lock.


All these memory or handle leaks could easily be fixed by using some C++ smart 
pointer implementations without requiring any changes to the API for 
embedding/extending python. On windows it requires some minor changes to allow 
compiling thread.c and timemodule.c as C++ code.

I am happy to post my version here, for other more knowledgeable python 
programmers to review them. I see my suggestions as a patch, but in an ideal 
world a lot of the code in pythoncore could be reimplemented using proper C++.

Martin

--

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



[issue10386] token module should define __all__

2010-11-11 Thread Alexander Belopolsky

New submission from Alexander Belopolsky belopol...@users.sourceforge.net:

The token module appears to be designed to be used with import *.  In fact it 
is used this way in the tokenize module.  However it does not define __all__ 
and as a result, from token import * leaks symbol main:

 import tokenize
 tokenize.main.__module__
'token'

Attached patch adds token.__all__ and modernizes generation of the tok_name 
dictionary.

I also renamed main to _main because it is hard to imagine that any user code 
would ever want to use it.

--
components: Library (Lib)
files: token-all.diff
keywords: patch
messages: 120938
nosy: belopolsky
priority: normal
severity: normal
stage: patch review
status: open
title: token module should define __all__
versions: Python 3.2
Added file: http://bugs.python.org/file19568/token-all.diff

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



[issue10382] Command line error marker misplaced on unicode entry

2010-11-11 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

See also #2382: I wrote patches two years ago for this issue.

--

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



[issue10381] Add timezone support to datetime C API

2010-11-11 Thread Alexander Belopolsky

New submission from Alexander Belopolsky belopol...@users.sourceforge.net:

With timezone class added to datetime module, C API should be extended to at 
the minimum support efficient creation of timezone instances and access to the 
singleton UTC instance.

I am not sure whether PyDateTime_TimeZone details should be exposed in 
datetime.h because presumably programmers should access it through the abstract 
tzinfo interface.

--
assignee: belopolsky
components: Extension Modules
messages: 120928
nosy: belopolsky
priority: normal
severity: normal
stage: needs patch
status: open
title: Add timezone support to datetime C API
type: feature request
versions: Python 3.2

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



[issue10142] Support for SEEK_HOLE/SEEK_DATA

2010-11-11 Thread Jesús Cea Avión

Jesús Cea Avión j...@jcea.es added the comment:


 import os
 f=open(XX,w+b)
 f.seek(1024*1024)
1048576
 f.write(bhello)
5
 f.seek(1024*1024*2)
2097152
 f.write(bbye)
3
 f.seek(0,os.SEEK_HOLE)
0
 f.seek(0,os.SEEK_DATA)
1048576
 f.seek(1048576,os.SEEK_HOLE)
1179648
 f.seek(1179648,os.SEEK_DATA)
2097152
 f.seek(2097152,os.SEEK_HOLE)
2097155
 fd=f.fileno()
 os.lseek(fd,0,os.SEEK_HOLE)
0
 os.lseek(fd,0,os.SEEK_DATA)
1048576
 os.lseek(fd,1048576,os.SEEK_HOLE)
1179648
 os.lseek(fd,1179648,os.SEEK_DATA)
2097152


--

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



[issue10379] locale.format() input regression

2010-11-11 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Yeah, obviously that language can be improved.  'exactly' was meant to imply 
'nothing but', but clearly it doesn't.

If we want to restore more stringent backward compatibility and allow trailing 
text, it would be possible to make format an alias for format_string.  I'm not 
sure this is a good idea, but it is the most sensible way to restore backward 
compatibility while still fixing the original bug that I can think of.

Or...perhaps there is little need of both 'format' and 'format_string' as 
public APIs, and we could deprecate (without removing) one of them.

On the other hand, I believe the original bug affects the Ubuntu code that 
triggered this report...in other words, absent this fix chances are there would 
eventually have been a bug report against that code that would have 
necessitated that it change to use format_string anyway in order to get the 
correct locale-specific number formatting.

--
nosy: +lemburg

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



[issue9807] deriving configuration information for different builds with the same prefix

2010-11-11 Thread Barry A. Warsaw

Barry A. Warsaw ba...@python.org added the comment:

Attached is the remaining patch against py3k.  This installs the symlinks, 
fixes the distutils 'install_headers' location, and uses abiflags in the 
python3.pc path.

I think this branch is done, pending approval and commit.

--
Added file: http://bugs.python.org/file19564/9807.txt

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



[issue10384] SyntaxError should contain exact location of the invalid character in identifier

2010-11-11 Thread Alexander Belopolsky

New submission from Alexander Belopolsky belopol...@users.sourceforge.net:

Can you see the error in the following?

 inv​alid = 5
  File stdin, line 1
inv​alid = 5
 ^
SyntaxError: invalid character in identifier

The problem is that an invisible space character crept into the identifier:

 repr(inv​alid)
'inv\\u200balid'

With full unicode available in most OSes, the potential for errors like this 
(accidental or as a result of a practical joke) increases.  It would be much 
easier to spot the offending character if ^ marker pointed at the exact 
location rather than at the end of the identifier.


See also issue #10382.

--
components: Interpreter Core
messages: 120936
nosy: belopolsky
priority: normal
severity: normal
stage: needs patch
status: open
title: SyntaxError should contain exact location of the invalid character in 
identifier
type: feature request
versions: Python 3.2

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



[issue10379] locale.format() input regression

2010-11-11 Thread Łukasz Langa

Łukasz Langa luk...@langa.pl added the comment:

Please use the deprecation process when possible. That would mean creating an 
alias for the function you want to remove somewhat like this (taken from 
configparser):

def readfp(self, fp, filename=None):
Deprecated, use read_file instead.
warnings.warn(
This method will be removed in future versions.  
Use 'parser.read_file()' instead.,
PendingDeprecationWarning, stacklevel=2
)
self.read_file(fp, source=filename)

--
nosy: +lukasz.langa

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



[issue7434] general pprint rewrite

2010-11-11 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


--
nosy: +belopolsky

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



Issue Tracker issues, and a bug in Python

2010-11-11 Thread Hosford, Aaron Michael
Hi all,

I found a bug in Python 2.7 involving dictionary comprehensions. I repeatedly 
tried to register on the Issue Tracker (http://bugs.python.org/) but never 
received a confirmation email, so I still can't log in and post it there. Maybe 
someone on this list can post it on my behalf:

 functions =  {x : lambda y: x + y for x in xrange(10)}
 functions[0](0)
9


The expression functions[0](0) should return 0, not 9. It looks like the 
scope for variable x is shared across the entire dictionary comprehension 
rather than having separate scope for each generated item.



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



[issue2986] difflib.SequenceMatcher not matching long sequences

2010-11-11 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
Removed message: http://bugs.python.org/msg120925

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



[issue5412] extend configparser to support mapping access(__*item__)

2010-11-11 Thread Łukasz Langa

Łukasz Langa luk...@langa.pl added the comment:

Committed in r86402.

Documentation changes pending, to be made after Fred's detailed review. Fred, 
you can review using trunk. Reassigned as a reminder.

--
assignee: lukasz.langa - fdrake
keywords: +needs review -patch
stage: unit test needed - commit review

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



[issue10387] ConfigParser's getboolean method is broken

2010-11-11 Thread Felix Laurie von Massenbach

New submission from Felix Laurie von Massenbach fantasi...@gmail.com:

If the config file has a boolean formatted as either True or False, python 
raises an attribute error when doing str.lower() on it. In my code I've worked 
around this in the following way:

class MyConfigParser(ConfigParser.RawConfigParser):
def getboolean(self, section, option):
result = self.get(section, option)
try:
trues = [1, yes, true, on]
falses = [0, no, false, off]
if result in trues:
return True
if result in falses:
return False
except AttributeError as err:
if str(err) == \'bool\' object has no attribute \'lower\':
return result
raise err

Felix

(p.s. first bug report, sorry if it's a bit of a mess...)

--
components: Extension Modules
messages: 120943
nosy: Felix.Laurie.von.Massenbach
priority: normal
severity: normal
status: open
title: ConfigParser's getboolean method is broken
type: crash
versions: Python 2.7

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



[issue10387] ConfigParser's getboolean method is broken

2010-11-11 Thread Felix Laurie von Massenbach

Felix Laurie von Massenbach fantasi...@gmail.com added the comment:

Oops, that was the broken first version. Let's try again:

class MyConfigParser(ConfigParser.RawConfigParser):
def getboolean(self, section, option):
result = self.get(section, option)
try:
trues = [1, yes, true, on]
falses = [0, no, false, off]
if result.lower() in trues:
return True
if result.lower() in falses:
return False
except AttributeError as err:
if str(err) == \'bool\' object has no attribute \'lower\':
return result
raise err

Felix

--

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



[issue1589] New SSL module doesn't seem to verify hostname against commonName in certificate

2010-11-11 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 Should we escalate this issue to CVA for Python 2.x?

It's more of a missing feature than a security issue in itself, although
the missing feature has to do with security.

--

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



[issue10387] ConfigParser's getboolean method is broken

2010-11-11 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
assignee:  - lukasz.langa
nosy: +lukasz.langa

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



[issue1589] New SSL module doesn't seem to verify hostname against commonName in certificate

2010-11-11 Thread david

david db.pub.m...@gmail.com added the comment:

On 11 November 2010 23:31, Antoine Pitrou rep...@bugs.python.org wrote:

 Antoine Pitrou pit...@free.fr added the comment:

 Should we escalate this issue to CVA for Python 2.x?

 It's more of a missing feature than a security issue in itself, although
 the missing feature has to do with security.

Still it would be nice to see in python 2.x at some point don't you think?

--

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



[issue1589] New SSL module doesn't seem to verify hostname against commonName in certificate

2010-11-11 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 
  It's more of a missing feature than a security issue in itself, although
  the missing feature has to do with security.
 
 Still it would be nice to see in python 2.x at some point don't you think?

Well, lots of things would be nice to see in python 2.x, but that's not
how things work :)
That said, someone else is maintaining a backport (thank him):
http://pypi.python.org/pypi/backports.ssl_match_hostname/

--

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



[issue10387] ConfigParser's getboolean method is broken

2010-11-11 Thread Łukasz Langa

Łukasz Langa luk...@langa.pl added the comment:

Felix, thanks for your report! :)

I believe you misunderstood that all ConfigParser objects by design should hold 
*only strings* inside. The same problem would appear if you tried to write() 
configuration from a parser with booleans or numbers to a file. You should 
convert values to strings before putting them on the parser.

This is a design deficiency in RawConfigParser that it allows setting values to 
other types. If you would use SafeConfigParser you'd see that it doesn't let 
assigning anything other than strings as option values.

As much as we would love straightening it out (ensuring that values must be 
strings in RawConfigParsers), we can't do that because of backwards 
compatibility concerns.

As for holding strings internally, this is a design decision that may look 
strange at first but when you look at it from the consistency perspective, it's 
better:  when you load values from an INI file parser can't tell whether some 
specific value should be considered boolean or a string. yes is a valid 
string and a valid boolean value for the parser. Which one to hold internally? 
We don't know. So we store strings and let the user decide when he's using 
get(). The same should happen when you put values into a parser on your own.

I hope that explains it.

--
priority: normal - low

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



[issue10386] token module should define __all__

2010-11-11 Thread Fred L. Drake, Jr.

Fred L. Drake, Jr. fdr...@acm.org added the comment:

Normally, I'd recommend leaving the main name alone, but in the case of 
modules that use it as an tool for module maintenance (symbol, token), I don't 
think it matters either way.

Ok to commit.

--
assignee:  - belopolsky
nosy: +fdrake
resolution:  - accepted

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



[issue10388] spwd returning different value depending on privileges

2010-11-11 Thread Giampaolo Rodola'

New submission from Giampaolo Rodola' g.rod...@gmail.com:

As root:

 import spwd
 spwd.getspall()
[spwd.struct_spwd(sp_nam='root', sp_pwd='!', sp_lstchg=14895, sp_min=0, 
sp_max=9, sp_warn=7, sp_inact=-1, sp_expire=-1, sp_flag=-1)
 ...
]

As limited user:

 import spwd
 spwd.getspall()
[]
 

Wouldn't it be better for consistency to raise OSError EACCES instead?

--
messages: 120950
nosy: giampaolo.rodola
priority: normal
severity: normal
status: open
title: spwd returning different value depending on privileges
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

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



[issue10387] ConfigParser's getboolean method is broken

2010-11-11 Thread Felix Laurie von Massenbach

Felix Laurie von Massenbach fantasi...@gmail.com added the comment:

Perhaps I don't understand fully, but I am reading, for example, option = 
True from a config file. When doing this getboolean raises:

AttributeError: 'bool' object has no attribute 'lower'

Is it intended that you cannot store True and False as values in the config 
file?

Apologies if I'm being dense.

Felix

--

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



[issue10386] token module should define __all__

2010-11-11 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

Committed revision 86410.

--

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



[issue10386] token module should define __all__

2010-11-11 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


--
status: open - closed

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



[issue10387] ConfigParser's getboolean method is broken

2010-11-11 Thread Łukasz Langa

Łukasz Langa luk...@langa.pl added the comment:

No problem Felix. But look:

Python 2.7 (r27:82500, Sep 24 2010, 12:26:28)
[GCC 4.3.4 20090804 (release) 1] on cygwin
Type help, copyright, credits or license for more information.
 config = 
... [section]
... does_it_work = True
... is_it_broken = False
... 
 from ConfigParser import RawConfigParser
 from StringIO import StringIO
 parser = RawConfigParser()
 sio = StringIO(config)
 parser.readfp(sio)
 parser.sections()
['section']
 parser.get('section', 'does_it_work')
'True'
 parser.get('section', 'is_it_broken')
'False'
 parser.getboolean('section', 'does_it_work')
True
 parser.getboolean('section', 'is_it_broken')
False

So, reading configuration options from files definitely works. And as you see 
in the first get() pair, it stores values internally as strings.

--

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



[issue5412] extend configparser to support mapping access(__*item__)

2010-11-11 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

In my experience of cfg files, it’s uncommon to have leading spaces (and also, 
may I add, ugly).  It’s great that configparser supports them now, but I 
wouldn’t have put them in the basic examples.

--

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



[issue10388] spwd returning different value depending on privileges

2010-11-11 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
versions:  -Python 2.6

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



[issue10389] Document rules for use of case in section titles

2010-11-11 Thread Alexander Belopolsky

New submission from Alexander Belopolsky belopol...@users.sourceforge.net:

Following a brief and consensual discussion on d...@python and #python-dev, I 
am proposing attached patch for the Python documentation style guide.

--
assignee: belopolsky
components: Documentation
files: style-guide.diff
keywords: patch
messages: 120955
nosy: belopolsky
priority: normal
severity: normal
stage: patch review
status: open
title: Document rules for use of case in section titles
versions: Python 3.2
Added file: http://bugs.python.org/file19570/style-guide.diff

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



[issue10387] ConfigParser's getboolean method is broken

2010-11-11 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +eric.araujo

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



[issue10387] ConfigParser's getboolean method is broken

2010-11-11 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
components: +Library (Lib) -Extension Modules
stage:  - unit test needed

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



[issue10385] Mark up subprocess as module in its doc

2010-11-11 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Marking up each and every instance of a module name is not mandatory IMO.  
What’s important is that each document title starts with the :mod: construct, 
so that the HTML titles and index (at /library) be consistently useful.  See 
for example ast (which also suffers from non-standard markup in its docstring, 
but that’s another issue).  In addition, there are hierarchy problems in the 
index.

--
nosy: +eric.araujo

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



[issue5412] extend configparser to support mapping access(__*item__)

2010-11-11 Thread Łukasz Langa

Łukasz Langa luk...@langa.pl added the comment:

Yup, most config parsers don't support that so there are not so many INI type 
files in the wild with this kind of formatting. On the other hand, Samba, 
XULRunner, mke2fs and others all use this.

I mean, you're not forced to use that ugly feature but it's good to have it 
exposed so people don't later say they knew not that it was possible.

Of course, I'm open for suggestions on better examples :)

--

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



[issue10377] cProfile incorrectly labels its output

2010-11-11 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
versions:  -Python 2.6

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



[issue10375] 2to3 print(single argument)

2010-11-11 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +benjamin.peterson, eric.araujo

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



[issue10389] Document rules for use of case in section titles

2010-11-11 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

+1 about the patch, if you add an example: “sentence case” may not be obvious 
for everyone.  If it’s “modulename — Module description”, I agree.

Also, s/white space/whitespace/.

--
nosy: +d...@python, eric.araujo

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



[issue8804] http.client should support SSL contexts

2010-11-11 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Fixed as part of #9003.

--
resolution:  - duplicate
status: open - closed
superseder:  - urllib.request and http.client should allow certificate checking

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



[issue10390] json.load should handle bytes input

2010-11-11 Thread Jeffrey Finkelstein

New submission from Jeffrey Finkelstein jeffrey.finkelst...@gmail.com:

The following code produces an error:

# APIKEY defined above
r = urllib.request.urlopen('http://api.billboard.com/apisvc/chart/v1/'
   'list/spec?api_key={}format=JSON'
   .format(APIKEY))
j = json.load(r)

Specifically, the urlopen() function returns a request object that can be read, 
the request object returns a bytes object containing JSON, and the json.load() 
function tries to mix str and bytes objects when using the re module.

json.load() should convert bytes to str. It is reasonable that one should be 
able to open a url and pass the result directly to json.load().

--
components: Library (Lib)
messages: 120960
nosy: jfinkels
priority: normal
severity: normal
status: open
title: json.load should handle bytes input
type: feature request
versions: Python 3.2

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



[issue10390] json.load should handle bytes input

2010-11-11 Thread Jeffrey Finkelstein

Jeffrey Finkelstein jeffrey.finkelst...@gmail.com added the comment:

Nevermind.

--
resolution:  - invalid

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



[issue10383] test_os leaks under Windows

2010-11-11 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

This leaks one reference every time:
os.write(123456, bb)

--

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



[issue10383] test_os leaks under Windows

2010-11-11 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

This looks suspect (in function posix_write)::

if (!PyArg_ParseTuple(args, iy*:write, fd, pbuf))
return NULL;
if (!_PyVerify_fd(fd))
return posix_error();

I'd prefer a PyBuffer_Release(pbuf); before returning...
Many other occurrences of _PyVerify_fd have this issue.

--

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



[issue9520] Add Patricia Trie high performance container

2010-11-11 Thread Raymond Hettinger

Changes by Raymond Hettinger rhettin...@users.sourceforge.net:


--
assignee:  - rhettinger

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



[issue10142] Support for SEEK_HOLE/SEEK_DATA

2010-11-11 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

- The patch modifies the _io module but not _pyio, why?
(try   f=_pyio.open(XX,w+b)   at the beginning of the script above)

- One test was *removed*, but nothing was added to test this new feature.
This is the most likely way to lose it in future versions!
An idea for the test is to do like the MockRawIO class in test_io.py, which 
implements a file but fakes all system calls, and can be wrapped in a 
BufferedReader.

- The feature seems to be not applicable to text files, this should be tested.

--
nosy: +amaury.forgeotdarc

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



[issue10390] json.load should handle bytes input

2010-11-11 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
stage:  - committed/rejected
status: open - closed

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



[issue10389] Document rules for use of case in section titles

2010-11-11 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

The new patch, issue10389.diff, addresses Éric's comments and adds an entry for 
reST.

--
Added file: http://bugs.python.org/file19571/issue10389.diff

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



[issue1466065] base64 module ignores non-alphabet characters

2010-11-11 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Committed in r86414.

--
nosy:  -BreamoreBoy
resolution:  - accepted
stage: patch review - committed/rejected
status: open - closed

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



[issue10391] obj2ast's error handling can lead to python crashing with a C-level assertion failure

2010-11-11 Thread Dave Malcolm

New submission from Dave Malcolm dmalc...@redhat.com:

In various places within the generated Python/Python-ast.c, error handling 
generates a repr() and raises exceptions accordingly.

Currently in py3k the generated code uses PyBytes_AS_STRING() on the repr.  My 
understanding is that repr() should be a PyUnicodeObject, not a PyBytesObject.  
This seems to be unchanged from r63682, which was a mass-change of PyString to 
PyBytes from 2 years ago.

This leads to a python crashing with an assertion failure:
test_compile_ast (__main__.TestSpecifics) ... python: Python/Python-ast.c:5835: 
obj2ast_expr: Assertion `((PyObject*)(tmp))-ob_type))-tp_flags  
((1L27))) != 0)' failed.

when invoking compile() on certain (malformed) trees of ast objects.

--
components: Interpreter Core
messages: 120967
nosy: dmalcolm
priority: normal
severity: normal
status: open
title: obj2ast's error handling can lead to python crashing with a C-level 
assertion failure
type: crash
versions: Python 3.1, Python 3.2, Python 3.3

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



[issue10391] obj2ast's error handling can lead to python crashing with a C-level assertion failure

2010-11-11 Thread Dave Malcolm

Dave Malcolm dmalc...@redhat.com added the comment:

The attached patch:
  - extends the ast error-handling selftest with code that triggers this crash 
(on unpatched code)
  - fixes Parser/asdl_c.py to generate code using _PyUnicode_AS_STRING instead
  - contains the generated changes to Python/Python-ast.c

FWIW, it's not clear to what extent _PyUnicode_AS_STRING is deprecated, 
Include/unicodeobject.h currently has:
   *** This API is for interpreter INTERNAL USE ONLY and will likely
   *** be removed or changed for Python 3.1.
but I hope it won't be, it's far too useful.

--
keywords: +patch
stage:  - patch review
Added file: 
http://bugs.python.org/file19572/py3k-issue-10391-fix-ast-error-handling.patch

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



[issue10391] obj2ast's error handling can lead to python crashing with a C-level assertion failure

2010-11-11 Thread Dave Malcolm

Changes by Dave Malcolm dmalc...@redhat.com:


--
nosy: +benjamin.peterson, brett.cannon, georg.brandl, ncoghlan

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-11-11 Thread Alex Willmer

Alex Willmer a...@moreati.org.uk added the comment:

The re module throws an exception for re.compile(r'[\A\w]'). latest
regex doesn't, but I don't think the pattern is matching correctly.
Shouldn't findall(r'[\A]\w', 'a b c') return ['a'] and
findall(r'[\A\s]\w', 'a b c') return ['a', ' b', ' c'] ?

Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)
[GCC 4.4.5] on linux2
Type help, copyright, credits or license for more information.
 import re
 for s in [r'\A\w', r'[\A]\w', r'[\A\s]\w']: print re.findall(s, 'a b c')
...
['a']
[]
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.6/re.py, line 177, in findall
return _compile(pattern, flags).findall(string)
  File /usr/lib/python2.6/re.py, line 245, in _compile
raise error, v # invalid expression
sre_constants.error: internal: unsupported set operator
 import regex
 for s in [r'\A\w', r'[\A]\w', r'[\A\s]\w']: print regex.findall(s, 'a b c')
...
['a']
[]
[' b', ' c']

--

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



[issue7900] posix.getgroups() failure on Mac OS X

2010-11-11 Thread Stephen Hansen

Stephen Hansen me+pyt...@ixokai.io added the comment:

This test is failing again, and IIUC, largely due to the same sort of issues: 
http://www.python.org/dev/buildbot/all/builders/AMD64%20Leopard%203.1/builds/65

I was able to track down what exactly caused it to fail in this case on my box, 
though. Whatever posix.getgroups() ends up calling, appears to be tied to the 
current users login -- or at least, doesn't get updated when new groups are 
added to the user.

This failure happened because at some point after the buildbot was up and 
running, I added a new user to the machine (totally unconnected to the existing 
buildbot runner): this caused a new group to be added to the buildbot runner's 
user.

id -G starts returning that group immediately, but posix.getgroups() 
returns the same list as it had before. I was able to further reproduce it in 
Terminal, by having a console open, and compiling 3.1 there then adding a user, 
and running the test. It fails. Opening up a new terminal window, running the 
test-- and it succeeds. The original console continues to fail.

--
nosy: +ixokai
versions: +Python 3.1, Python 3.2

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



[issue10391] obj2ast's error handling can lead to python crashing with a C-level assertion failure

2010-11-11 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

IMO a better patch would be to use the %R format specification:
  PyErr_Format(
  PyExc_TypeError, expected some sort of mod, but got %R, obj);
And no need to use PyObject_Repr and the temporary variable!

--
nosy: +amaury.forgeotdarc

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



[issue7900] posix.getgroups() failure on Mac OS X

2010-11-11 Thread Stephen Hansen

Changes by Stephen Hansen me+pyt...@ixokai.io:


--
status: closed - open

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



[issue10389] Document rules for use of case in section titles

2010-11-11 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Looks good.  I wouldn’t say reST is WYSIWYG, since it’s transformed, contrary 
to word processors where you make text bold to get it bold.

(If you’re looking for other things to fix in that file, look at the entry for 
Unicode ;)

--

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



[issue5412] extend configparser to support mapping access(__*item__)

2010-11-11 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Well, I suggest removing the leading spaces in the examples, except maybe in 
one place if you think it’s needed.

--

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



[issue7900] posix.getgroups() failure on Mac OS X

2010-11-11 Thread Ronald Oussoren

Ronald Oussoren ronaldousso...@mac.com added the comment:

This is the expected behavior on OSX. Apple has a pretty odd interpretation of 
the standards wrt getgroups and setgroups behavior. 

This behavior is not a bug in python

Sent from my iPhone

On 11 nov. 2010, at 22:17, Stephen Hansen rep...@bugs.python.org wrote:

 
 Stephen Hansen me+pyt...@ixokai.io added the comment:
 
 This test is failing again, and IIUC, largely due to the same sort of issues: 
 http://www.python.org/dev/buildbot/all/builders/AMD64%20Leopard%203.1/builds/65
 
 I was able to track down what exactly caused it to fail in this case on my 
 box, though. Whatever posix.getgroups() ends up calling, appears to be tied 
 to the current users login -- or at least, doesn't get updated when new 
 groups are added to the user.
 
 This failure happened because at some point after the buildbot was up and 
 running, I added a new user to the machine (totally unconnected to the 
 existing buildbot runner): this caused a new group to be added to the 
 buildbot runner's user.
 
 id -G starts returning that group immediately, but posix.getgroups() 
 returns the same list as it had before. I was able to further reproduce it in 
 Terminal, by having a console open, and compiling 3.1 there then adding a 
 user, and running the test. It fails. Opening up a new terminal window, 
 running the test-- and it succeeds. The original console continues to fail.
 
 --
 nosy: +ixokai
 versions: +Python 3.1, Python 3.2
 
 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue7900
 ___

--

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



[issue7900] posix.getgroups() failure on Mac OS X

2010-11-11 Thread Stephen Hansen

Stephen Hansen me+pyt...@ixokai.io added the comment:

Well, yes: the result of posix.getgroups is not a bug in Python, but is it a 
bug in the test? Should it be skipped on OSX, or some other solution?

Having buildbots fail because of something that's expected behavior is bad, 
isn't it?

--

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-11-11 Thread Vlastimil Brom

Vlastimil Brom vlastimil.b...@gmail.com added the comment:

Maybe I am missing something, but the result in regex seem ok to me:
\A is treated like A in a character set; when the test string is changed to A 
b c or in the case insensitive search the A is matched.

[\A\s]\w doesn't match the starting a, as it is not followed by any word 
character:

 for s in [r'\A\w', r'[\A]\w', r'[\A\s]\w']: print regex.findall(s, 'A b c')
... 
['A']
[]
[' b', ' c']
 for s in [r'\A\w', r'(?i)[\A]\w', r'[\A\s]\w']: print regex.findall(s, 'a b 
 c')
... 
['a']
[]
[' b', ' c']
 

In the original re there seem to be a bug/limitation in this regard (\A and 
also \Z in character sets aren't supported in some combinations...

vbr

--

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



[issue7900] posix.getgroups() failure on Mac OS X

2010-11-11 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Right, regardless of whether or not it is a bug in python, IMO it *is* a bug in 
the python test suite, since we *expect* buildbots to be long running processes 
and therefore they are going to get hit by this failure on OSX periodically 
with a pretty high likelyhood.  Yes it is easily fixable (restart the builder), 
but it seems to me the test should be fixed somehow instead of putting that 
burden on the buildbot owner.

A skip on OSX would certainly be the simplest solution, and we could thereby 
indicate that we consider this behavior to be a bug in OSX.

--

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



[issue7900] posix.getgroups() failure on Mac OS X

2010-11-11 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
priority: high - normal

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



[issue10379] locale.format() input regression

2010-11-11 Thread Barry A. Warsaw

Barry A. Warsaw ba...@python.org added the comment:

The bug has been fixed upstream by replacing .format() with .format_string().  
I'm not sure I understand why there are two different methods - .format() seems 
kind of pointless to me, but then I don't use the locale module enough to say 
what's useful.

For Python 2.7 I think the only thing we can do is to update the docs so that 
the distinction and restrictions are clear.

--

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



[issue10389] Document rules for use of case in section titles

2010-11-11 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

Committed in revision 86417.

--
status: open - closed

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



[issue7950] subprocess.Popen documentation should contain a good warning about the security implications when using shell=True

2010-11-11 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Looks good to me, except the last two lines which I would reword or just remove.

I wonder how many people use shell=True merely for the convenience of passing a 
string instead of a list.  What do you think about adding a mention of 
str.split and shlex.split?

--
nosy: +eric.araujo
type: security - behavior
versions:  -Python 2.6

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



[issue7950] subprocess.Popen documentation should contain a good warning about the security implications when using shell=True

2010-11-11 Thread Chris Rebert

Chris Rebert pyb...@rebertia.com added the comment:

the above Note mentioned in those last two lines demonstrates shlex.split() 
and correct tokenization.

--

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



[issue10382] Command line error marker misplaced on unicode entry

2010-11-11 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

haypo See also #2382: I wrote patches two years ago for this issue.

Yes, this is the same issue.  I don't want to close this as a duplicate because 
#2382 contains a much more ambitious set of patches.  What I am trying to 
achieve here is similar to the adjust_offset.patch there.

I am attaching a patch that takes an alternative approach and computes the 
number of characters in the parser.  I strongly believe that the buffer in the 
tokenizer always contains UTF-8 encoded text.  If it is not so already, I would 
consider making it so by replacing a call to 
_PyUnicode_AsDefaultEncodedString() with a call to PyUnicode_AsUTF8String(). 
(if that matters)

The patch still needs unittests and possibly has some off-by-one issues, but I 
would like to get to an agreement that this is the right level at which the 
problem should be fixed first.

--

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



[issue10382] Command line error marker misplaced on unicode entry

2010-11-11 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


Added file: http://bugs.python.org/file19573/issue10382a.diff

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



[issue9286] email.utils.parseaddr returns garbage for invalid input

2010-11-11 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Having no time to read email RFCs, I’ll defer to you here.  Please reject this 
report or save it for later as you prefer.

--
versions:  -Python 2.6

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-11-11 Thread Matthew Barnett

Matthew Barnett pyt...@mrabarnett.plus.com added the comment:

It looks like a similar problem to msg116252 and msg116276.

--

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



[issue9286] email.utils.parseaddr returns garbage for invalid input

2010-11-11 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

In connection with another bug report I found a rather basic error in 
parseaddr, so I'm going to eventually dig far enough into the RFC to have a 
real opinion on the elided-space issue.

--

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



[issue2636] Regexp 2.7 (modifications to current re 2.2.2)

2010-11-11 Thread Alex Willmer

Alex Willmer a...@moreati.org.uk added the comment:

On Thu, Nov 11, 2010 at 10:20 PM, Vlastimil Brom rep...@bugs.python.org wrote:
 Maybe I am missing something, but the result in regex seem ok to me:
 \A is treated like A in a character set;

I think it's me who missed something. I'd assumed that all backslash
patterns (including \A for beginning of string) maintain their meaning
in a character class. AFAICT that assumption was wrong.

--

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



[issue3931] codecs.charmap_build is untested and undocumented

2010-11-11 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

I see charmap_build used in encodings too, so it may be useful to make it 
officially public for the use of third-party encodings.

--

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



[issue7219] Unhelpful error message when a distutils package install fails due to a permissions error

2010-11-11 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

I wonder if this is IronPython-specific.  Could you temporarily make the 
site-packages directory of a py3k CPython read-only and try to install a 
distribution with that CPython?  I can try the same thing on unix.

--

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



[issue10379] locale.format() input regression

2010-11-11 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Well, the distinction is that, before the bug fix that caused your issue, the 
'format_string' method would use a regex to extract the % specifiers from the 
input string, and call 'format' to replace that % specifier with a properly 
localized result string.  That is, 'format' was designed to handle a single % 
specifier with no extra text, basically as a helper method for format_string.  
The fact that it didn't reject extra text was, according to an internal 
comment, a defect of the implementation.  (Passing any extra text would cause 
the implementation to fail to do the internationalization that was the entire 
reason for calling it.)

When I fixed the bug I extracted the 'replace a single % specifier' code into 
an internal method, and made the format method live up to what I perceived to 
be its documented interface by rejecting extra input characters so that it 
could safely call the new internal substitution routine.

Now, from the perspective of a *user* of the locale module, I fail to see the 
point in having both 'format' and 'format_string' exposed.  If you want to 
format a single % specifier, just pass it to format_string.  Thus my suggestion 
to make them both do the same thing (to cater to other code that may be calling 
format incorrectly) and then deprecate one of them (presumably format).  

To bad I didn't think of that when I fixed the original bug.

--

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



[issue10387] ConfigParser's getboolean method is broken

2010-11-11 Thread Felix Laurie von Massenbach

Felix Laurie von Massenbach fantasi...@gmail.com added the comment:

Ok, so I understand the issue, but why doesn't the set method simply convert to 
a string?

 from ConfigParser import RawConfigParser
 from StringIO import StringIO
 parser = RawConfigParser()
 config = 
[section]
test = True

 parser.readfp(StringIO(config))
 parser.get(section, test)
'True'
 parser.getboolean(section, test)
True
 parser.set(section, test, True)
 parser.get(section, test)
True
 parser.getboolean(section, test)

Traceback (most recent call last):
  File pyshell#33, line 1, in module
parser.getboolean(section, test)
  File C:\Python27\lib\ConfigParser.py, line 361, in getboolean
if v.lower() not in self._boolean_states:
AttributeError: 'bool' object has no attribute 'lower'

--

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



[issue9313] distutils error on MSVC older than 8

2010-11-11 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Re-opening to remind myself about the forward-port.

--
assignee: ocean-city - eric.araujo
components:  -Tests
status: closed - open
versions: +3rd party

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



[issue2986] difflib.SequenceMatcher not matching long sequences

2010-11-11 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

issue2986.fix27.5.patch applied, with version note added to doc, as
rev86418

Only thing left is patch for 3.2, which Eli and I will produce.

--
stage: commit review - needs patch
versions:  -Python 2.7

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



[issue8989] email.utils.make_msgid: specify domain

2010-11-11 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Thanks for the patch, which looks good to me, except for the test: “eq” will 
raise a NameError, since this does not exist.  Other test methods bind eq to 
self.assertEqual to save typing, which is not really needed in your case: Just 
use self.assertEqual :)

To run the tests, ./python -m email.test.test_email

--
stage: unit test needed - patch review

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



  1   2   >