[issue7426] StringIO and with statement

2009-12-03 Thread Jean-Michel Fauth

New submission from Jean-Michel Fauth wxjmfa...@gmail.com:

When toying with the with statement, I fell on this:

Python 2.6.4

 with open('abc.txt', 'r') as f:
for line in f:
print line.rstrip()

abc
def
 
 import StringIO
 fo = StringIO.StringIO('abc\ndef\n')
 fo.seek(0)
 with fo as f2:
for line in f2:
print line.rstrip()

Traceback (most recent call last):
  File psi last command, line 2, in module
AttributeError: StringIO instance has no attribute '__exit__'
 
 

Same result with cStringIO

-

Python 3.1.1

 fo = io.StringIO('abc\ndef\n')
 fo.seek(0)
0
 with fo as f:
for line in f:
print(line.rstrip())


abc
def


--
components: None
messages: 95924
nosy: jmfauth
severity: normal
status: open
title: StringIO and with statement
type: behavior
versions: Python 2.6

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



[issue7426] StringIO and with statement

2009-12-03 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +alexandre.vassalotti

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



[issue7414] Format code C is missing from skipitem() in getargs.c

2009-12-03 Thread Mark Dickinson

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

Thanks!  Fixed in r76646 (py3k) and r76647 (release31-maint).

--
nosy: +mark.dickinson
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
type:  - behavior
versions: +Python 3.2

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



[issue7327] format: minimum width: UTF-8 separators and decimal points

2009-12-03 Thread Mark Dickinson

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

Reassigning to Eric.

--
assignee: mark.dickinson - eric.smith

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



[issue7327] format: minimum width: UTF-8 separators and decimal points

2009-12-03 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

I've raised the issue with unicode and locale on python-dev:
http://mail.python.org/pipermail/python-dev/2009-December/094408.html

Pending the outcome of that decision, I'll move forward on this issue.

--

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



[issue6985] range() fails with long integers

2009-12-03 Thread Mark Dickinson

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

I suspect the ints in builtin_range should have been changed to Py_ssize_t 
when PEP 353 was implemented.  I've fixed them in trunk in r76625;  it 
doesn't seem worth changing this in the 2.6 branch.

So on an LP64 machine with sufficient memory, range(2**31) should now 
work.

--

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



[issue6985] range() fails with long integers

2009-12-03 Thread Mark Dickinson

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

Whoops. That revision number should have been r76648.

--

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



[issue6645] multiprocessing build fails on AIX - /dev/urandom (or equivalent) not found

2009-12-03 Thread David Narayan

David Narayan david.nara...@gmail.com added the comment:

This is a patch that I have used on AIX. The idea for this patch came
from uuid.py. This patch was created against Python 2.6.4.

--
keywords: +patch
nosy: +davidnarayan
Added file: 
http://bugs.python.org/file15445/multiprocessing-urandom-fallback.patch

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



[issue6895] locale._parse_localename fails when localename does not contain encoding information

2009-12-03 Thread Barry A. Warsaw

Changes by Barry A. Warsaw ba...@python.org:


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

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



[issue5985] Implement os.path.samefile and os.path.sameopenfile on Windows

2009-12-03 Thread Erik Carstensen

Erik Carstensen sandb...@virtutech.com added the comment:

 Once I considered this approach, but problems was that
 nFileIndexLow/High can change every time file handle is opened, so it's
 not unique. See remarks in following page.
 http://msdn.microsoft.com/en-us/library/aa363788%28VS.85%29.aspx

Actually, that page only says that file identities may vary over time,
and that it may happen during operations such as defragmentation.
However, I have been in contact with a customer who observed a file
system where the file index actually changed every time a file was
closed and re-opened, given that nobody else kept the file open
inbetween. This was on some kind of network mount, I wasn't told which
kind (and I couldn't reproduce it with samba).

This means that it's actually essential that you don't close the file
between the CreateFile calls (and yes, your patch does this correctly).

--

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



[issue6895] locale._parse_localename fails when localename does not contain encoding information

2009-12-03 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Assigning to MAL, as this is his code.

--
assignee: loewis - lemburg
nosy: +lemburg

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



[issue5985] Implement os.path.samefile and os.path.sameopenfile on Windows

2009-12-03 Thread Terry J. Reedy

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


--
nosy:  -tjreedy

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



[issue2441] Mac build_install.py script fetches unavailable SQLite version

2009-12-03 Thread Ronald Oussoren

Changes by Ronald Oussoren ronaldousso...@mac.com:


--
assignee: glyph - ronaldoussoren
nosy: +ronaldoussoren

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



[issue2441] Mac build_install.py script fetches unavailable SQLite version

2009-12-03 Thread Gerhard Häring

Gerhard Häring g...@ghaering.de added the comment:

This has long been fixed. Even for 2.6maint the SQLite version currently
being fetched is 3.6.11.

--
resolution:  - out of date
status: open - closed

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



[issue7427] BadStatusLine is hell to debug

2009-12-03 Thread djc

New submission from djc dirk...@ochtman.nl:

For whatever reason, BadStatusLine tracebacks often don't show the line
passed into them. Given the errr, heavy architecture of httplib, this
makes it pretty bad to debug. It's not clear to me why this is:

Traceback (most recent call last):
  File /home/djc/src/couchdb-python/couchdb/tests/client.py, line 138,
in test_attachment_crud_with_files
doc = self.db['foo']
  File /home/djc/src/couchdb-python/couchdb/client.py, line 293, in
__getitem__
_, _, data = self.resource.get(id)
  File /home/djc/src/couchdb-python/couchdb/http.py, line 333, in get
return self._request('GET', path, headers=headers, **params)
  File /home/djc/src/couchdb-python/couchdb/http.py, line 350, in _request
credentials=self.credentials)
  File /home/djc/src/couchdb-python/couchdb/http.py, line 179, in request
resp = _try_request()
  File /home/djc/src/couchdb-python/couchdb/http.py, line 167, in
_try_request
return conn.getresponse()
  File /usr/lib/python2.6/httplib.py, line 950, in getresponse
  File /usr/lib/python2.6/httplib.py, line 390, in begin
  File /usr/lib/python2.6/httplib.py, line 354, in _read_status
BadStatusLine

However, some interactive testing shows that this should work:

d...@enrai couchdb-python $ python
Python 2.6.2 (r262:71600, Oct  5 2009, 12:18:48)
[GCC 4.3.2] on linux2
Type help, copyright, credits or license for more information.
 class CrapShoot(Exception):
... def __init__(self, a):
... self.args = a,
...
 raise CrapShoot('a')
Traceback (most recent call last):
  File stdin, line 1, in module
__main__.CrapShoot: a
 class ParentExc(Exception):
... pass
...
 class CrapShoot(ParentExc):
... def __init__(self, a):
... self.args = a,
...
 raise CrapShoot('a')
Traceback (most recent call last):
  File stdin, line 1, in module
__main__.CrapShoot: a


Definition of BadStatusLine:

class BadStatusLine(HTTPException):
def __init__(self, line):
self.args = line,
self.line = line

class HTTPException(Exception):
# Subclasses that define an __init__ must call Exception.__init__
# or define self.args.  Otherwise, str() will fail.
pass

The note here seems like a cautionary but insufficient tale...

--
components: Library (Lib)
messages: 95934
nosy: djc
severity: normal
status: open
title: BadStatusLine is hell to debug
versions: Python 2.6

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



[issue7427] BadStatusLine is hell to debug

2009-12-03 Thread djc

djc dirk...@ochtman.nl added the comment:

Also, it might be useful here if it showed repr(line) instead of just
line, but that'd just be icing on the cake.

--

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



[issue7428] Possible memory issue with optparse

2009-12-03 Thread Bill Spotz

New submission from Bill Spotz wfsp...@sandia.gov:

I develop python extension modules for Trilinos, a large scientific 
computing project:

http://trilinos.sandia.gov

Unit testing my extension modules under Mac OS X, I came across the 
following error messages after upgrading from gcc 4.0 to basically any 
higher version:

  python(65587) malloc: *** error for object 0x1715674: Non-aligned 
pointer being freed

Debugging the problem (which occurs for me in several places in several 
test scripts), the error was always being raised in the built-in C++ 
method

  ostream::operator(int)

which indicated to me that the problem was really probably somewhere 
else, and just being triggered in the ostream operator.

Trying to isolate the problem in a smaller script, I was unable to 
reproduce the error until I added

  import optparse

By the same token, I was able to eliminate the problem in my test 
scripts by getting rid of import optparse.  I have changed these 
scripts now to use getopt, and they are running without error, but I 
thought I would report this strange behavior.

I realize after all of this that the problem might not actually be with 
optparse, but it sure seems like a likely culprit.  I would be happy to 
work with someone to try to reproduce the error, and then hopefully 
such a python expert would be able to find the actual issue.

--
components: Extension Modules
messages: 95936
nosy: wfspotz
severity: normal
status: open
title: Possible memory issue with optparse
type: resource usage
versions: Python 2.6

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



[issue6895] locale._parse_localename fails when localename does not contain encoding information

2009-12-03 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

The reason this call fails is that there's no locale alias defined for
ml_IN in the local_alias dictionary.

While the patch is probably a good idea, it also hides the missing mapping.

I think a better approach would be to check the locale name for
standards compliance (ie. xx_YY format) and only then use it as fallback
solution.

I'll update the locale_alias dictionary to the X.org version 2009-12-08
(unless you know an even more recent version). This includes the missing
'ml_IN' mapping (among a few other additions and updates).

--

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



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

2009-12-03 Thread flox

Changes by flox la...@yahoo.fr:


Removed file: http://bugs.python.org/file15386/issue7381_first.diff

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



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

2009-12-03 Thread flox

flox la...@yahoo.fr added the comment:

Patch against the trunk, and against the Py3k branch.

It fixes:
 * docstring and documentation formatting
 * and examples

--
assignee:  - georg.brandl
components: +Documentation
nosy: +georg.brandl
versions: +Python 2.6, Python 2.7
Added file: http://bugs.python.org/file15446/issue7381.diff

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



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

2009-12-03 Thread flox

Changes by flox la...@yahoo.fr:


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

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



[issue7429] PrettyPrinter cannot print dicts with unsortable keys

2009-12-03 Thread Martin Altmayer

New submission from Martin Altmayer martin.altma...@web.de:

In the following code I use a class for dictionary-keys that has a
__hash__-function but cannot be ordered and try to print that dictionary
with a PrettyPrinter.

import pprint
pp = pprint.PrettyPrinter()

# A class that supports hashing and comparison for equality but cannot
be ordered
class KeyClass:
def __init__(self,id):
self.id = id

def __eq__(self,other):
return self.id == other.id

def __ne__(self,other):
return self.id != other.id

def __hash__(self):
return self.id


dictionary = dict.fromkeys([KeyClass(i) for i in range(10)])
pp.pprint(dictionary)

The script crashes with the following errors:

Traceback (most recent call last):
  File /usr/local/lib/python3.1/pprint.py, line 272, in _safe_repr
items = sorted(items)
TypeError: unorderable types: KeyClass()  KeyClass()

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File bug.py, line 20, in module
pp.pprint(dictionary)
  File /usr/local/lib/python3.1/pprint.py, line 106, in pprint
self._format(object, self._stream, 0, 0, {}, 0)
  File /usr/local/lib/python3.1/pprint.py, line 129, in _format
rep = self._repr(object, context, level - 1)
  File /usr/local/lib/python3.1/pprint.py, line 216, in _repr
self._depth, level)
  File /usr/local/lib/python3.1/pprint.py, line 228, in format
return _safe_repr(object, context, maxlevels, level)
  File /usr/local/lib/python3.1/pprint.py, line 277, in _safe_repr
items = sorted(items, key=sortkey)
TypeError: unorderable types: KeyClass()  KeyClass()

--
components: None
messages: 95939
nosy: maranos
severity: normal
status: open
title: PrettyPrinter cannot print dicts with unsortable keys
versions: Python 3.1

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



[issue1398] Can't pickle partial functions

2009-12-03 Thread flox

flox la...@yahoo.fr added the comment:

It seems fixed on trunk.
It is fixed on Python 3.1 and 3.2, too.


With Python 2.6 I see the error:
 ./python partial_bug.py
TypeError: can't pickle partial objects


Documentation for trunk and py3k is OK?

--
nosy: +flox

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



[issue7428] Possible memory issue with optparse

2009-12-03 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

optparse itself is a pure-python library, so it can't possibly cause
memory errors. 

Thanks for the report, but there isn't any realistic chance that we can
do anything with it. So closing it as won't fix.

If you want to debug it further, I would run a debug version of malloc.
Not sure whether OSX comes with one (apart from Python's own memory
debugging), if not, I'd use a memory debugger on a different platform.

--
nosy: +loewis
resolution:  - wont fix
status: open - closed

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



[issue7429] PrettyPrinter cannot print dicts with unsortable keys

2009-12-03 Thread David W. Lambert

David W. Lambert b49p23t...@stny.rr.com added the comment:

I believe this issue was resolved---expect it in a future release.

--
nosy: +LambertDW

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



[issue7430] cmp still sends messages

2009-12-03 Thread David W. Lambert

New submission from David W. Lambert b49p23t...@stny.rr.com:

'''
RuntimeError: maximum recursion depth exceeded in cmp

Python 3.1.1 (r311:74480, Oct  2 2009, 12:29:57) 
[GCC 4.3.3] on linux2
'''

import itertools,pprint

combos = itertools.combinations

def connect(nodes,a,b):
nodes[a].append(b)
nodes[b].append(a)

def insert(nodes,components):
if components == 0:
pprint.pprint(nodes)
for (i,node,) in enumerate(nodes):
if not node:
break
i += 2
for joints in combos(range(i),2):
connect(nodes,*joints)
nest = [node[:]for node in nodes]
insert(nest,components-1)

def e155(components):
if components  1:
return 0
network = [[]for i in range((components+1)*2)]
insert(network,components)
return network

e155(2)

--
messages: 95943
nosy: LambertDW
severity: normal
status: open
title: cmp still sends messages
versions: Python 3.1

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



[issue4380] Deepcopy of functools.partial gives wierd exception

2009-12-03 Thread flox

flox la...@yahoo.fr added the comment:

Already fixed on Python trunk (2.7).
Fixed on branches 3.1 and 3.2, too.

--

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



[issue7430] cmp still sends messages

2009-12-03 Thread Mark Dickinson

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

How about maximum recursion depth exceeded in comparison instead?

(It's coming from PyObject_RichCompare in Objects/object.c, by the way.)

--
nosy: +mark.dickinson

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



[issue4120] Do not embed manifest files in *.pyd when compiling with MSVC

2009-12-03 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Thanks for the patch. Committed as r76651, r76652, r76653, r76654,
r76655 and r76656.

--

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



[issue4120] Do not embed manifest files in *.pyd when compiling with MSVC

2009-12-03 Thread Martin v . Löwis

Changes by Martin v. Löwis mar...@v.loewis.de:


--
resolution:  - accepted
status: open - closed

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



[issue6834] use different mechanism for pythonw on osx

2009-12-03 Thread Ned Deily

Ned Deily n...@acm.org added the comment:

Another reminder: when implementing, make sure platform.architecture() 
always returns the correct results for bits.  It seems the Apple patches 
in 10.6 don't handle that (it seems to always report 64-bit), probably 
because the code in platform.architecture() doesn't look quite robust 
enough.  (I'll open a bug with Apple.)

--

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



[issue7431] UnboundLocalError during test.test_linecache.LineCacheTests

2009-12-03 Thread ivank

New submission from ivank i...@ludios.org:

Python 2.7, svn r76655.
I ran the tests with
python2.7 Lib/test/testall.py  test-results.txt

test_linecache
test_checkcache (test.test_linecache.LineCacheTests) ... ERROR
test_clearcache (test.test_linecache.LineCacheTests) ... ok
test_getline (test.test_linecache.LineCacheTests) ... ok

==
ERROR: test_checkcache (test.test_linecache.LineCacheTests)
--
Traceback (most recent call last):
  File /opt/Python-latest/lib/python2.7/test/test_linecache.py, line
121, in test_checkcache
source.close()
UnboundLocalError: local variable 'source' referenced before assignment

--
Ran 3 tests in 0.022s

FAILED (errors=1)
test test_linecache failed -- Traceback (most recent call last):
  File /opt/Python-latest/lib/python2.7/test/test_linecache.py, line
121, in test_checkcache
source.close()
UnboundLocalError: local variable 'source' referenced before assignment

--
components: Library (Lib)
messages: 95948
nosy: ivank
severity: normal
status: open
title: UnboundLocalError during test.test_linecache.LineCacheTests
type: behavior
versions: Python 2.7

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



[issue7431] UnboundLocalError during test.test_linecache.LineCacheTests

2009-12-03 Thread ivank

ivank i...@ludios.org added the comment:

This error is just masking a Permission denied error during
source = open(source_name, 'w')

so I guess it's not very important, just annoying.

--

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



[issue7432] Py3k doc: from __future__ import division not necessary

2009-12-03 Thread Jared Grubb

New submission from Jared Grubb pyt...@jaredgrubb.com:

In the Python 3.1 docs for the 'dis' module, the following appears:
( http://docs.python.org/3.1/library/dis.html )

BINARY_TRUE_DIVIDE()¶
Implements TOS = TOS1 / TOS when from __future__ import division is
in effect.

There is always true in 3k, correct? The when clause should be removed.

--
assignee: georg.brandl
components: Documentation
messages: 95950
nosy: georg.brandl, jaredgrubb
severity: normal
status: open
title: Py3k doc: from __future__ import division not necessary
versions: Python 3.1

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



[issue7432] Py3k doc: from __future__ import division not necessary

2009-12-03 Thread Jared Grubb

Jared Grubb pyt...@jaredgrubb.com added the comment:

Ditto on a few dozen lines later:

INPLACE_TRUE_DIVIDE()¶
Implements in-place TOS = TOS1 / TOS when from __future__ import
division is in effect.

--

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



[issue7433] MemoryView memory_getbuf causes segfaults, double call to tp_releasebuffer

2009-12-03 Thread Pauli Virtanen

New submission from Pauli Virtanen p...@iki.fi:

The following code causes a segmentation fault (or glibc error, or other
problems):

 x = someobject()
 y = memoryview(x)
 z = memoryview(y)

The problem is that someobject.bf_releasebuffer will be called two times
with an identical Py_buffer structure. 

This can be seen in memoryobject.c:

static int
memory_getbuf(PyMemoryViewObject *self, Py_buffer *view, int flags)
{
int res = 0;
/* XXX for whatever reason fixing the flags seems necessary */
if (self-view.readonly)
flags = ~PyBUF_WRITABLE;
if (self-view.obj != NULL)
res = PyObject_GetBuffer(self-view.obj, view, flags);
if (view)
dup_buffer(view, self-view);
return res;
}

At the end of the call, view and self-view contain identical data
because of the call to dup_buffer.

static void
memory_releasebuf(PyMemoryViewObject *self, Py_buffer *view)
{
PyBuffer_Release(view);
}

But when the outer memoryview is destroyed, memory_releasebuf calls
PyBuffer_Release for the original object once.

And when the inner memoryview is destroyed, PyBuffer_Release is called
by memory_dealloc the second time. Both calls supply an identical
Py_buffer structure.

Now, if the original object's bf_getbuffer and bf_releasebuffer allocate
some memory dynamically, this will likely cause a double-free of memory,
usually leading to a segmentation fault.

There is no feasible way the bf_releasebuffer can keep track of how many
calls to it have been made. So probably the code in memory_getbuf is
wrong -- at least the dup_buffer function looks wrong.

--
components: Interpreter Core
messages: 95952
nosy: pv
severity: normal
status: open
title: MemoryView memory_getbuf causes segfaults, double call to 
tp_releasebuffer
versions: Python 3.1

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



[issue7433] MemoryView memory_getbuf causes segfaults, double call to tp_releasebuffer

2009-12-03 Thread Pauli Virtanen

Changes by Pauli Virtanen p...@iki.fi:


--
type:  - crash

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



[issue7429] PrettyPrinter cannot print dicts with unsortable keys

2009-12-03 Thread R. David Murray

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

Confirmed, it is fixed on all maintained branches.  So the fix will be
in 3.1.2, which should be in a month or so.

--
components: +Library (Lib) -None
nosy: +r.david.murray
priority:  - normal
resolution:  - out of date
status: open - closed
type:  - behavior

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



[issue7385] MemoryView_FromObject crashes if PyBuffer_GetBuffer fails

2009-12-03 Thread Pauli Virtanen

Changes by Pauli Virtanen p...@iki.fi:


--
type:  - crash

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



[issue7431] UnboundLocalError during test.test_linecache.LineCacheTests

2009-12-03 Thread R. David Murray

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


--
assignee:  - r.david.murray
components: +Tests -Library (Lib)
nosy: +r.david.murray
priority:  - low
versions: +Python 2.6, Python 3.1

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



[issue7431] UnboundLocalError during test.test_linecache.LineCacheTests

2009-12-03 Thread R. David Murray

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

Fixed in r76659, r76660, r76661, and r76662.  I also changed the open to
use 'with' so that errors raised by the open will not be masked.

Flox, given how active you are being, you might enjoy joining us in
#python-dev on freenode.

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

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



[issue7406] int arithmetic relies on C signed overflow behaviour

2009-12-03 Thread Zooko O'Whielacronx

Zooko O'Whielacronx zo...@zooko.com added the comment:

Here is a way to test for overflow which is correct for any C implementation:

static PyObject *
int_add(PyIntObject *v, PyIntObject *w)
{
register long a, b;
CONVERT_TO_LONG(v, a);
CONVERT_TO_LONG(w, b);
if (((a0)(b0)((LONG_MAX-a)b))
||((a0)(b0)((LONG_MIN-a)b))) {
/* would overflow the long type */
return PyLong_Type.tp_as_number-nb_add((PyObject *)v, (PyObject 
*)w);
}

return PyInt_FromLong(a+b);
}

--
nosy: +zooko

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



[issue7406] int arithmetic relies on C signed overflow behaviour

2009-12-03 Thread Zooko O'Whielacronx

Zooko O'Whielacronx zo...@zooko.com added the comment:

Here is a set of macros that I use to test for overflow:

http://allmydata.org/trac/libzutil/browser/libzutil/zutilimp.h

--

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