[issue5099] subprocess.POpen.__del__() AttributeError (os module == None!)

2010-02-21 Thread A.M. Kuchling

A.M. Kuchling  added the comment:

Gabriel: could you please update the patch to take Antoine's comment into 
account?

--
nosy: +akuchling

___
Python tracker 

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



[issue3132] implement PEP 3118 struct changes

2010-02-21 Thread Meador Inge

Meador Inge  added the comment:

> The main thing that I realized from this is that unpacking as a ctypes long 
> double isn't all that useful for someone who wants to be able to do arithmetic
> on the unpacked result.  

I agree.  Especially since ctypes 'long double' maps to a Python float and
'.value' would have to be referenced on the ctype 'long double' instance
for doing arithmetic.

> And if you don't want to do arithmetic on the unpacked result, then you're 
> probably just shuffling the bytes around without caring about their meaning,
> so there's no need to unpack as anything other than a sequence of 12 bytes.

One benefit of having a type code for 'long double' (assuming you are mapping
the value to the platform's 'long double') is that the you don't have to know 
how many bytes are in the underlying representation.  As you know, it isn't 
always just 12 bytes.  It depends on the architecture and ABI being used.  Which
from a quick sample, I am seeing can be anywhere from 8 to 16
bytes:

===
| Compiler  | Arch | Bytes|
===
| VC++ 8.0  | x86  | 8|
| VC++ 9.0  | x86  | 8|
| GCC 4.2.4 | x86  | 12 (default), 16 |
| GCC 4.2.4 | x86-64   | 12, 16 (default) |  
| GCC 4.2.4 | PPC IBM  | 16   |
| GCC 4.2.4 | PPC IEEE | 16   |
===

> On the other hand, I suppose it's enough to be able to unpack as a ctypes 
> c_longdouble and then convert to a Python float (losing precision) for the 
> arithmetic.  Alternatively, we might consider simply unpacking a long double 
> directly into a Python float (and accepting the loss of precision);
 
I guess that would be acceptable.  The only thing that I don't like is that
since the transformation is lossy, you can't round trip:

   # this will not hold
   pack('g', unpack('g', byte_str)[0]) == byte_str

> that seems to be what would be most useful for the use-case above.

Which use case?  From the given IRC trace it seems that 'bdesk' was mainly
concerned with (1) pushing bytes around, but (2) thought it "it would be better"
to be able to do arithmetic and thought it would be more useful if it were
not a "black box of 12 bytes".  For use case (1) the loss of precision would 
probably not be acceptable, due to the round trip issue mentioned above.

So using ctypes 'long double' is easier to implement, but is lossy and clunky 
for arithmetic.  Using Python 'float' is easy to implement and easy for 
arithmetic, but is lossy.  Using Decimal is non-lossy and easy for arithmetic, 
but the implementation would be non-trivial and architecture specific 
(unless we just picked a fixed number of bytes regardless of the architecture).

--

___
Python tracker 

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



[issue1481] test_uuid is warning about unreliable functions

2010-02-21 Thread A.M. Kuchling

A.M. Kuchling  added the comment:

They were disabled in r50949, with the comment:

Disable these tests until they are reliable across platforms.  
These problems may mask more important, real problems.

One or both methods are known to fail on: Solaris, OpenBSD, Debian, Ubuntu.
They pass on Windows and some Linux boxes.


Some of them seem to only work on one platform, so maybe someone could write 
some platform-checking code to skip tests as necessary.

--
nosy: +akuchling

___
Python tracker 

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



[issue7232] Support of 'with' statement fo TarFile class

2010-02-21 Thread R. David Murray

R. David Murray  added the comment:

Woops, I accidentally deleted one of the patch files.  Adding back.

--
nosy: +r.david.murray
Added file: http://bugs.python.org/file16291/tarfileWithSupportv2.patch

___
Python tracker 

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



[issue7245] better Ctrl-C support in pdb (program can be resumed)

2010-02-21 Thread Ilya Sandler

Ilya Sandler  added the comment:

Here is a list of Ctrl-C scenarios: ("current" below means the prepatch version 
of pdb).

1. program is running (last command was "c", "n", etc). Currently, Ctrl-C 
throws debugger into postmortem. Desired behavior: interrupt the program. This 
is the only scenario supported by the patch.

2. Program is stopped (debugger is interacting with the user). Currently, 
Ctrl-C will throw debugger into postmortem. Desired behaviour: either ignore 
Ctrl-C or abandon the current command (that's what gdb does).

3. Program is stopped and pdb runs one of the commands which catch exceptions 
(e.g "p"). Currently, Ctrl-C will abort the command and return pdb to the 
prompt. I think this behavior should be kept.

4. Program finished (debugger is in postmortem). Currently, Ctrl-C will quit 
the debugger. Desired behavior: either ignore Ctrl-C or abandon the current 
command.

Essentially, I think the best behavior is to have Ctrl-C to interrupt whatever 
pdb is doing and return to the fresh prompt.

I am assuming that behavior on Windows and Linux should be identical/nearly 
identical.

Does the above list make sense?

I would greatly appreciate any feedback/comments/guidance/etc.

--

___
Python tracker 

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



[issue4199] add shorthand global and nonlocal statements

2010-02-21 Thread A.M. Kuchling

A.M. Kuchling  added the comment:

Bumping priority so this doesn't get forgotten before 3.2; it seems important 
because it fixes noncompliance with a PEP.

--
nosy: +akuchling
priority: normal -> high

___
Python tracker 

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



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2010-02-21 Thread Brian Curtin

Brian Curtin  added the comment:

Here's a patch for test_tempfile on trunk. The rest will just be silently added 
since this is already annoying.

--
Added file: http://bugs.python.org/file16289/issue7944_tempfile.diff

___
Python tracker 

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



[issue7245] better Ctrl-C support in pdb (program can be resumed)

2010-02-21 Thread Ilya Sandler

Ilya Sandler  added the comment:

I fixed some of the style issues mentioned on appspot. (I was not sure about 
some of them and responded to them in appspot comments).

Also sigHandler became sighandler for consistency with the rest of pdb.py.  

The new version of the patch is attached.

However, it appears that I've been a bit over-optimistic about the lack of 
side-effects. In particular, the patch results in an very ugly error message 
when Ctrl-C is pressed while at pdb prompt..


*** AttributeError: AttributeError("'NoneType' object has no attribute 
'f_globals'",)

Everything still seems to be working, but it's definitely ugly (and behaves 
differently on Windows and Linux).

I will try to summarize possible Ctrl-C scenarios in a separate post

--
Added file: http://bugs.python.org/file16288/sig.patch.v1

___
Python tracker 

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



[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-21 Thread R. David Murray

R. David Murray  added the comment:

OK, then I think I understand Jeremy's point now: the paramiko socket is 
apparently not implementing makefile in a way that matches the documented API.

--

___
Python tracker 

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



[issue7944] Use the 'with' statement in conjunction with 'open' throughout test modules

2010-02-21 Thread Brian Curtin

Brian Curtin  added the comment:

I'm going to go ahead with the patch-per-module approach, but anyone feel free 
to stop me from doing that.

Here's a patch for test_gzip on trunk.

--
Added file: http://bugs.python.org/file16286/issue7944_gzip.diff

___
Python tracker 

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



[issue7232] Support of 'with' statement fo TarFile class

2010-02-21 Thread Brian Curtin

Brian Curtin  added the comment:

Here is a patch which expands on Jaime's patch. I was converting tests for 
#7944 and looked at test_tarfile, and implemented the same feature that he did.

All places where context managers should be used in the test, they are used. 
Includes a doc update with a small example.

--
keywords: +needs review
nosy: +brian.curtin
Added file: http://bugs.python.org/file16285/issue7944_tarfile.diff

___
Python tracker 

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



[issue5211] Fix complex type to avoid coercion in 2.7.

2010-02-21 Thread Meador Inge

Meador Inge  added the comment:

> I added a ".. versionchanged" note to the documentation, and fixed a 
> couple of whitespace issues;

Thanks.  I checked out the changes you made so that I will know what to do next 
time :).

> Fixed now, with apologies to Meador.

No worries.  Thanks for applying the patch!

--

___
Python tracker 

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



[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-21 Thread Jeremy Hylton

Jeremy Hylton  added the comment:

On Sun, Feb 21, 2010 at 5:38 PM, Robert Buchholz  wrote:
>
> Robert Buchholz  added the comment:
>
> almost... HTTPConnection is calling close() on the socket object, but 
> HTTPResponse still has an open file-like object from a previous makefile() 
> call. That object still has an internal reference to the socket.

That's right.  The makefile() method on sockets works that way, and
the HTTP library depends on that behavior (and pretty much always
has).

Jeremy

>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-21 Thread Robert Buchholz

Robert Buchholz  added the comment:

almost... HTTPConnection is calling close() on the socket object, but 
HTTPResponse still has an open file-like object from a previous makefile() 
call. That object still has an internal reference to the socket.

--

___
Python tracker 

___
___
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-02-21 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

On Sun, Feb 21, 2010 at 1:58 PM, Martin v. Löwis  wrote:
..
> I would propose a different strategy: if _SC_NGROUPS_MAX is defined, use
> that to find out how much memory to allocate, otherwise, fall back to
> the current max array size. Can you find out whether doing so would also
> fix the issue at hand?

I am afraid that the following is the evidence that it won't:

Python 2.7a3+ (trunk:78265M, Feb 20 2010, 15:20:36)
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.sysconf('SC_NGROUPS_MAX')
16
>>> len(os.getgroups())  # with the patch
22

--

___
Python tracker 

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



[issue7975] dbshelve.py throws exception: AttributeError: 'DB' object has no attribute '__iter__'

2010-02-21 Thread R. David Murray

R. David Murray  added the comment:

Here's a patch.  test_bsddb3 still passes with this patch applied on trunk.

--
assignee:  -> r.david.murray
keywords: +patch
stage: test needed -> patch review
Added file: http://bugs.python.org/file16284/dbshelve_dictmixin.patch

___
Python tracker 

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



[issue7964] "-m pdb" SyntaxError for "\r\n" formatted py files

2010-02-21 Thread Jason R. Coombs

Jason R. Coombs  added the comment:

Attached is a patch against the py3k branch that fixes the issue by changing 
the mode used to open the target script. It includes a unittest that elicits 
the issue and validates the fix.

The patch should also probably be applied to the 31maint branch.

--
keywords: +patch
Added file: http://bugs.python.org/file16283/issue 7964 fix with test.patch

___
Python tracker 

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



[issue7929] Update copyright notice on python websites to 2010

2010-02-21 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Closing as fixed, as the replybot issue is listed on the wiki.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue7964] "-m pdb" SyntaxError for "\r\n" formatted py files

2010-02-21 Thread Jason R. Coombs

Jason R. Coombs  added the comment:

I'm interested in finding a workaround for this issue in the next 24 hours. I 
can also help contribute a test case. I'll investigate further.

--
nosy: +jaraco

___
Python tracker 

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



[issue1722344] Thread shutdown exception in Thread.notify()

2010-02-21 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

I have seen somewhere (ask google), that python 2.6.5 would be released 
mid-march.
But except for a few platforms, python.org does not provide compiled binaries.

--

___
Python tracker 

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



[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-21 Thread R. David Murray

R. David Murray  added the comment:

So HTTConnection is closing the thing returned by makefile and that is closing 
the socket, except that the socket library makes sure it doesn't actually close 
the socket until the dupped file handle is also closed?  I guess I need to look 
at this more closely when I have time in order to fully understand it.

--

___
Python tracker 

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



[issue7929] Update copyright notice on python websites to 2010

2010-02-21 Thread Michael Newman

Michael Newman  added the comment:

I posted the copyright note, and the reply bot bug on the wiki at:
http://wiki.python.org/moin/SiteImprovements

--

___
Python tracker 

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



[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-21 Thread R. David Murray

R. David Murray  added the comment:

So do I.  I'm saying that paramiko appears to be following the socket API as 
documented in the python docs (ie: that closing the socket means it is no 
longer usable).

--

___
Python tracker 

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



[issue7929] Update copyright notice on python websites to 2010

2010-02-21 Thread Michael Newman

Michael Newman  added the comment:

Perhaps this is now really a "bug":

# Response to e-mail to "webmas...@python.org":
#

This is the mail system at host mail.python.org.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

  The mail system

 (expanded from ):
   Command died with status 1: "/usr/bin/replybot -C /etc/replybot.cfg -s
   WEBMASTER". Command output: Traceback (most recent call last):   File
   "/usr/bin/replybot", line 5, in  from pkg_resources import
   load_entry_point ImportError: No module named pkg_resources

Final-Recipient: rfc822; webmaster-reply...@mail.python.org
Original-Recipient: rfc822;webmas...@python.org
Action: failed
Status: 5.3.0
Diagnostic-Code: x-unix; Traceback (most recent call last):   File
   "/usr/bin/replybot", line 5, in  from pkg_resources import
   load_entry_point ImportError: No module named pkg_resources


-- Forwarded message --
From: Michael Newman 
To: webmas...@python.org
Date: Sun, 21 Feb 2010 15:31:31 -0500
Subject: please update copyright to show 2010
Please consider fixing this bug:

"Update copyright notice on python websites to 2010"
http://bugs.python.org/issue7929

Thanks for maintaining a great website.

-Mike

--

___
Python tracker 

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



[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-21 Thread Jeremy Hylton

Jeremy Hylton  added the comment:

In particular, I mean this part of the socket API:

socket.makefile([mode[, bufsize]])
Return a file object associated with the socket. (File objects are
described in File Objects.) The file object references a dup()ped
version of the socket file descriptor, so the file object and socket
object may be closed or garbage-collected independently. The socket
must be in blocking mode (it can not have a timeout). The optional
mode and bufsize arguments are interpreted the same way as by the
built-in file() function.

The language may be a little vague, but it means that closing the file
generated by makefile() should not close the underlying socket.

Jeremy

On Sun, Feb 21, 2010 at 3:23 PM, Jeremy Hylton  wrote:
>
> Jeremy Hylton  added the comment:
>
> On Sat, Feb 20, 2010 at 12:06 AM, R. David Murray
>  wrote:
>>
>> R. David Murray  added the comment:
>>
>> But the docs (which presumably describe the API) say that the socket is 
>> unusable after the call to close, which argues that the paramiko sockets are 
>> following the documented API.  Do the docs need to be corrected?
>
> I mean the documented socket API.
>
> Jeremy
>
>> --
>>
>> ___
>> Python tracker 
>> 
>> ___
>>
>
> --
>
> ___
> Python tracker 
> 
> ___
> ___
> Python-bugs-list mailing list
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-bugs-list/jeremy%40alum.mit.edu
>
>

--

___
Python tracker 

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



[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-21 Thread Jeremy Hylton

Jeremy Hylton  added the comment:

On Sat, Feb 20, 2010 at 12:06 AM, R. David Murray
 wrote:
>
> R. David Murray  added the comment:
>
> But the docs (which presumably describe the API) say that the socket is 
> unusable after the call to close, which argues that the paramiko sockets are 
> following the documented API.  Do the docs need to be corrected?

I mean the documented socket API.

Jeremy

> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue6436] trace module doesn't seem to produce .cover files for Py3 (but does for Py2)

2010-02-21 Thread Michael Newman

Michael Newman  added the comment:

I noticed the same behavior today.

Let's consider a test case using my python script "version_check.py" (attached).

Normally the script does the following on my Ubuntu 9.10 box:

# Python 2.6 example:
m...@ebx2009:~/test$ which python
/usr/bin/python
m...@ebx2009:~/test$ python version_check.py
2.6.4 (r264:75706, Dec  7 2009, 18:45:15) 
[GCC 4.4.1]

# Python 3.1 example:
m...@ebx2009:~/test$ which python3
/usr/local/bin/python3
m...@ebx2009:~/test$ python3 version_check.py
3.1.1 (r311:74480, Feb  7 2010, 16:32:28) 
[GCC 4.4.1]

# Starting with a directory with only the script in it:
m...@ebx2009:~/test$ ls
version_check.py
# I use the "-C ." to force the ".cover" files to be dumped in my current 
directory:
m...@ebx2009:~/test$ python -m trace --count -C . version_check.py 
2.6.4 (r264:75706, Dec  7 2009, 18:45:15) 
[GCC 4.4.1]
m...@ebx2009:~/test$ ls
threading.cover  version_check.cover  version_check.py
# So this worked fine.

# Let's remove the cover files and try with Python 3.1:
m...@ebx2009:~/test$ rm *.cover
m...@ebx2009:~/test$ ls
version_check.py
m...@ebx2009:~/test$ python3 -m trace --count -C . version_check.py 
3.1.1 (r311:74480, Feb  7 2010, 16:32:28) 
[GCC 4.4.1]
m...@ebx2009:~/test$ ls
threading.cover  version_check.py
# Its annoying that the threading.cover is still being made, but 
"version_check.cover" did not get generated in any case...

I tracked the problem down inside of lib/trace.py (same code in both python 
versions):

def localtrace_count(self, frame, why, arg):
if why == "line":
filename = frame.f_code.co_filename
print(frame.f_code.co_filename)  # my new debug line
lineno = frame.f_lineno
key = filename, lineno
self.counts[key] = self.counts.get(key, 0) + 1
return self.localtrace

If you put my print debug line in, we get some more interesting behavior from 
my example runs:

m...@ebx2009:~/test$ python -m trace --count -C . version_check.py 
/usr/lib/python2.6/threading.py

version_check.py
version_check.py
version_check.py
version_check.py
version_check.py
version_check.py
2.6.4 (r264:75706, Dec  7 2009, 18:45:15) 
[GCC 4.4.1]

m...@ebx2009:~/test$ python3 -m trace --count -C . version_check.py 
/usr/local/lib/python3.1/threading.py







3.1.1 (r311:74480, Feb  7 2010, 16:32:28) 
[GCC 4.4.1]

So python3 is not retaining the module name correctly. Instead its just giving 
"". So the bottom line is "frame.f_code.co_filename" is now behaving 
differently. I'm not sure how to fix that.

--
nosy: +mnewman
versions: +Python 3.2
Added file: http://bugs.python.org/file16282/version_check.py

___
Python tracker 

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



[issue7975] dbshelve.py throws exception: AttributeError: 'DB' object has no attribute '__iter__'

2010-02-21 Thread R. David Murray

R. David Murray  added the comment:

The bug seems to have been introduced by an incomplete or incorrect translation 
to the newer idiom (DictMixin to MutableMapping).  Since bsddb is gone in py3, 
I'm inclined to fix it by just going back to using DictMixin.  There are no 
tests for the DictMixin functionality added in Python 2.3.

--
components: +Library (Lib)
keywords: +easy
nosy: +jcea

___
Python tracker 

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



[issue3132] implement PEP 3118 struct changes

2010-02-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

About long doubles again:  I just encountered someone on the #python IRC 
channel who wanted to know whether struct.pack and struct.unpack supported 
reading and writing of x87 80-bit long doubles (padded to 12 bytes each in the 
input).  A few quotes from him/her, with permission (responses from others, 
including me, edited out;  I can supply a fuller transcript if necessary, but I 
hope what's below isn't misleading).

[18:39] bdesk: Hi, is struct.pack able to handle 80-bit x86 extended floats?
[18:40] bdesk: How can I read and write these 80-bit floats, in binary, using 
python?
[18:44] bdesk: dickinsm: I have a C program that uses binary files as input and 
output, and I want to deal with these files using python if possible.
[18:49] bdesk: I don't need to do arithmetic with the full 80 bits of precision 
within the python program, although It would be better if I could.
[18:50] bdesk: I would need to use the float in a more semantically useful 
manner than treating it as a black box of 12 bytes.
[18:55] bdesk: Until python gets higher precision floats, my preferred 
interface would be to lose some precision when unpacking the floats.

The main thing that I realized from this is that unpacking as a ctypes long 
double isn't all that useful for someone who wants to be able to do arithmetic 
on the unpacked result.  And if you don't want to do arithmetic on the unpacked 
result, then you're probably just shuffling the bytes around without caring 
about their meaning, so there's no need to unpack as anything other than a 
sequence of 12 bytes.

On the other hand, I suppose it's enough to be able to unpack as a ctypes 
c_longdouble and then convert to a Python float (losing precision) for the 
arithmetic.  Alternatively, we might consider simply unpacking a long double 
directly into a Python float (and accepting the loss of precision);  that seems 
to be what would be most useful for the use-case above.

--

___
Python tracker 

___
___
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-02-21 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

> I would suggest using my _DARWIN_C_SOURCE implementation
> unconditionally and make similar changes to posix_setgroups, but this
> is probably a subject for a separate issue.

I would propose a different strategy: if _SC_NGROUPS_MAX is defined, use
that to find out how much memory to allocate, otherwise, fall back to
the current max array size. Can you find out whether doing so would also
fix the issue at hand?

--

___
Python tracker 

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



[issue7977] I found Python 3.1 xmlrpc lib use "" not properly. and i have fixed it.

2010-02-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

Please could you generate and upload a patch against the Python source?  (For 
Windows, you can do this using the WinMerge tool, amongst others.)  I'm unable 
to open the file you attached on my machine:

"""No application knows how to open ... xmlrpc.client.modify.rar."""

If you could explain how "" is being used improperly, that might also 
help.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue7975] dbshelve.py throws exception: AttributeError: 'DB' object has no attribute '__iter__'

2010-02-21 Thread Adam Collard

Adam Collard  added the comment:

Attached a simple example.

--
Added file: http://bugs.python.org/file16280/dbshelve_example.py

___
Python tracker 

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



[issue1722344] Thread shutdown exception in Thread.notify()

2010-02-21 Thread sorin

sorin  added the comment:

Any idea if there is a nightly build for Python 2.6? The latest release was 
2.6.4 and was 2 days before submitting the patch. 

Or the only alternative is to build it myself? Any ideas on when we could see 
2.6.5? - I tried to look for a release timeline but I wasn't able to locate one.

--
nosy: +sorin

___
Python tracker 

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



[issue7975] dbshelve.py throws exception: AttributeError: 'DB' object has no attribute '__iter__'

2010-02-21 Thread R. David Murray

R. David Murray  added the comment:

Could you please provide a complete example that demonstrates the problem?  A 
naive example using shelve with a dbhash database seems to work fine.

--
nosy: +r.david.murray
priority:  -> normal
stage:  -> test needed
type:  -> behavior
versions: +Python 2.6, Python 2.7

___
Python tracker 

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



[issue7975] dbshelve.py throws exception: AttributeError: 'DB' object has no attribute '__iter__'

2010-02-21 Thread Adam Collard

New submission from Adam Collard :

Originally reported at:
  https://bugs.edge.launchpad.net/bugs/384602

In Python 2.6, the dbshelve.py module throws an AttributeError exception 
whenever a call is made to a method that depends upon an __iter__ method.  The 
exception is:

  File "/usr/lib/python2.6/bsddb/dbshelve.py", line 167, in __iter__
return self.db.__iter__()
AttributeError: 'DB' object has no attribute '__iter__'

This means that, if mydb is an istance of a DB object, the following examples 
will fail:

for key in mydb: print key
 
print (k for k in mydb.iterkeys())

for k, d in mydb.itervalues(): print k, d

and many other statements depending on iterable(mydb) being true

Note that, in Python 2.5, these examples work and no exception is thrown.  In 
fact, if you have both 2.5 and 2.6 installed on the same system, you can run 
the same program containing code as above with Python2.5 without issue while 
running it under Python 2.6 raises the exception seen above.

--
messages: 99667
nosy: adam-collard
severity: normal
status: open
title: dbshelve.py throws exception: AttributeError: 'DB' object has no 
attribute '__iter__'

___
Python tracker 

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



[issue7974] Valgrind error when running Python command within Vim

2010-02-21 Thread Mark Dickinson

Changes by Mark Dickinson :


--
resolution:  -> invalid

___
Python tracker 

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



[issue7974] Valgrind error when running Python command within Vim

2010-02-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

Thanks for the update!

--

___
Python tracker 

___
___
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-02-21 Thread Alex Willmer

Alex Willmer  added the comment:

On 17 February 2010 19:35, Matthew Barnett  wrote:
> The main text at http://pypi.python.org/pypi/regex appears to have lost its 
> backslashes, for example:
>
>    The Unicode escapes u and U are supported.
>
> instead of:
>
>    The Unicode escapes \u and \U are supported.

Matthew, As you no doubt realised that text is read straight from the
Features.txt file. PyPI interprets it as RestructuredText, which uses
\ as an escape character in various cases. Do you intentionally write
Features.txt as RestructuredText? If so here is a patch that escapes
the \ characters as appropriate, otherwise I'll work out how to make
PyPI read it as plain text.

Regards, Alex
-- 
Alex Willmer 
http://moreati.org.uk/blog

--
Added file: http://bugs.python.org/file16278/Features-backslashes.patch

___
Python tracker 

___=== modified file 'Features.txt'
--- Features.txt2010-02-17 12:22:14 +
+++ Features.txt2010-02-21 14:44:13 +
@@ -61,7 +61,7 @@
 regex.findall and regex.finditer support an 'overlapped' flag which 
permits overlapped matches
 
 Unicode escapes (#3665)
-The Unicode escapes \u and \U are supported.
+The Unicode escapes \\u and \\U are supported.
 
 Large patterns (#1160)
 Patterns can be much larger.
@@ -94,23 +94,23 @@
 Named groups can be named with (?...) as well as the current 
(?P...).
 
 Group references
-Groups can be referenced within a pattern with \g. This also allows 
there to be more than 99 groups.
+Groups can be referenced within a pattern with \\g. This also allows 
there to be more than 99 groups.
 
 Named characters
-\N{name}
+\\N{name}
 Named characters are supported.
 
 Unicode properties
-\p{name}
-\P{name}
-Unicode properties are supported. \p{name} matches a character which has 
property 'name' and \P{name} matches a character which doesn't have property 
'name'.
+\\p{name}
+\\P{name}
+Unicode properties are supported. \\p{name} matches a character which has 
property 'name' and \\P{name} matches a character which doesn't have property 
'name'.
 
 Posix character classes
 [[:alpha:]]
 Posix character classes are supported.
 
 Search anchor
-\G
+\\G
 A search anchor has been added. It matches at the position where each 
search started/continued and can be used for contiguous matches or in negative 
variable-length lookbehinds to limit how far back the lookbehind goes:
 
 >>> regex.findall(r"\w{2}", "abcd ef")

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



[issue7974] Valgrind error when running Python command within Vim

2010-02-21 Thread Dominique Pellé

Dominique Pellé  added the comment:

Closed: this was not a bug, I had to build Python lib with "configure 
--without-pymalloc" to avoid valgrind errors.

--
status: open -> closed

___
Python tracker 

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



[issue7974] Valgrind error when running Python command within Vim

2010-02-21 Thread Dominique Pellé

Dominique Pellé  added the comment:

> Have you read Misc/README.valgrind in the Python source?

No, I had not see this file.
Thanks for pointing it to me.

I've just read it, reconfigured & recompiled Python-2.6.4 with:

./configure --without-pymalloc

It now runs without Valgrind error.

Sorry for the noise. 
This issue can thus be closed

--

___
Python tracker 

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



[issue7974] Valgrind error when running Python command within Vim

2010-02-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

The code you identify looks okay to me:  in PyMarshal_ReadObjectFromString, 
isn't it only the temporary variable rf that has a pointer to the string?

Have you read Misc/README.valgrind in the Python source?

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue7974] Valgrind error when running Python command within Vim

2010-02-21 Thread Dominique Pellé

New submission from Dominique Pellé :

I built Vim-7.2.368 editor with python interpreter using
Python-2.6.4 library on Linux x86.

When I run a python command (any command, it does not matter)
in the Vim editor with Valgrind memory checker, I see valgrind
errors within the Python library.  It looks to me like they
are errors within the Python library and not errors in Vim.

I attach the valgrind error log file.

Steps to reproduce the bug:

1/ Download & compile Vim with python interpreter

  $ hg clone https://vim.googlecode.com/hg/ vim
  $ cd vim
  $ ./configure --enable-pythoninterp 
--with-python-config-dir=/usr/local/lib/python2.6/config
  $ make

(you may also want to tweak vim/src/Makefile to compile with -O0 -g
to have more interesting stacks in valgrind logs)

2/ Run a Python command within Vim with Valgrind memory checker: 

  $ cd vim/src
  $ valgrind --log-file=valgrind.log ./vim -c ':python "foo=0"'

3/ Observe in valgrind.log the errors in Python lib  

The stack is quite deep in the errors and Valgrind memory checker has a limit 
to dump at most 50 functions in stack frame. I increased that limit to 100 to 
be able to see the full stack trace as in attached log file "valgrind.log".

In the fist error in attached valgrind.log, memory is used in a
buffer that has already been freed. Looking at the Python
code, this function does not make much sense to me:

1040 PyObject *
1041 PyMarshal_ReadLastObjectFromFile(FILE *fp)
1042 {
1043 /* 75% of 2.1's .pyc files can exploit SMALL_FILE_LIMIT.
1044  * REASONABLE_FILE_LIMIT is by defn something big enough for Tkinter.pyc.
1045  */
1046 #define SMALL_FILE_LIMIT (1L << 14)
1047 #define REASONABLE_FILE_LIMIT (1L << 18)
1048 #ifdef HAVE_FSTAT
1049 off_t filesize;
1050 #endif
1051 #ifdef HAVE_FSTAT
1052 filesize = getfilesize(fp);
1053 if (filesize > 0) {
1054 char buf[SMALL_FILE_LIMIT];
1055 char* pBuf = NULL;
1056 if (filesize <= SMALL_FILE_LIMIT)
1057 pBuf = buf;
1058 else if (filesize <= REASONABLE_FILE_LIMIT)
1059 pBuf = (char *)PyMem_MALLOC(filesize);
1060 if (pBuf != NULL) {
1061 PyObject* v;
1062 size_t n;
1063 /* filesize must fit into an int, because it
1064is smaller than REASONABLE_FILE_LIMIT */
1065 n = fread(pBuf, 1, (int)filesize, fp);
1066 v = PyMarshal_ReadObjectFromString(pBuf, n);
1067 if (pBuf != buf)
1068 PyMem_FREE(pBuf);
1069 return v;
1070 }
1071 
1072 }
1073 #endif
1074 /* We don't have fstat, or we do but the file is larger than
1075  * REASONABLE_FILE_LIMIT or malloc failed -- read a byte at a time.
1076  */
1077 return PyMarshal_ReadObjectFromFile(fp);
1078 
1079 #undef SMALL_FILE_LIMIT
1080 #undef REASONABLE_FILE_LIMIT
1081 }

Memory is allocated for pBuf at line marshal.c:1059.
Then at line marshall.c:1066 v= PyMarshal_ReadObjectFromString(pBuf, n);
is called. 

The v structure contains pointer to the pBuf buffer (see line marshall.c:1103). 
Then pBuf is freed at marshall.c:1068 and v is returned.

So v which is returned contains a pointer "v.ptr" to buffer
that has just been freed. That looks wrong to me. What's the
point of v containing an address to something freed?

Looking at the latest version of Python/marshal.c in SVN,
this function has not been changed since 2.6.4:

http://svn.python.org/projects/python/trunk/Python/marshal.c

--
components: Library (Lib)
files: valgrind.log.gz
messages: 99660
nosy: dominiko
severity: normal
status: open
title: Valgrind error when running Python command within Vim
versions: Python 2.6
Added file: http://bugs.python.org/file16277/valgrind.log.gz

___
Python tracker 

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



[issue7384] curses crash on FreeBSD

2010-02-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

> It does appear that curses itself is broken on FreeBSD

Rereading this, it doesn't say what I meant it to say:  I meant that the Python 
curses module seems to be broken, not that the system-level curses library is 
broken (though that seems possible too).

--

___
Python tracker 

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



[issue3132] implement PEP 3118 struct changes

2010-02-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

[Meador Inge]
> So the next step is to kick off a thread on python-dev summarizing the
> questions\problems we have come up with?  I can get that started.

Sounds good.  I'd really like to see some examples of how these struct-module 
additions would be used in real life.

--

___
Python tracker 

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



[issue2395] [Py3k] struct module changes of PEP 3118

2010-02-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

I think this can be closed as a duplicate of issue 3132.  (Yes, this issue came 
first, but all the interesting(?) discussion is over in issue 3132.)

--
dependencies:  -implement PEP 3118 struct changes
nosy: +mark.dickinson
resolution:  -> duplicate
status: open -> closed
superseder:  -> implement PEP 3118 struct changes

___
Python tracker 

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



[issue5211] Fix complex type to avoid coercion in 2.7.

2010-02-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

Apologies for the delay;  tomorrow was a long time coming...

The patch looks great---thank you!  I added a ".. versionchanged" note to the 
documentation, and fixed a couple of whitespace issues; apart from that I 
didn't change anything.  Applied in r78280.

--
resolution:  -> accepted
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue4999] multiprocessing.Queue does not order objects

2010-02-21 Thread Stefan Krah

Stefan Krah  added the comment:

I think it would be nice to update the documentation if this isn't
resolved yet. The patch adds a warning that FIFO behavior is not
guaranteed.

--
keywords: +patch
nosy: +skrah
Added file: http://bugs.python.org/file16276/warn_fifo.patch

___
Python tracker 

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



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-02-21 Thread Ezio Melotti

Ezio Melotti  added the comment:

Fixed in r78247 (trunk) and r78248 (release26-maint) (plus a fix in r78272 and 
r78279 to avoid test failures when the filesystem encoding is ascii).
I didn't use the any_cwd decorator -- I might consider it in future if it turns 
out that there are more tests like these.

--
dependencies:  -Add a context manager to change cwd in test.test_support and 
run the test suite in a temp dir.
resolution:  -> fixed

___
Python tracker 

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



[issue7751] urllib.urlopen("///C|/foo/bar/spam.foo") IOError: [Errno 22]

2010-02-21 Thread Éric Araujo

Éric Araujo  added the comment:

Ok, thanks for clarifying :)

Regards

--

___
Python tracker 

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