[issue17532] IDLE: Always include "Options" menu on MacOSX

2013-04-23 Thread Guilherme Simões

Guilherme Simões added the comment:

Since extensions are probably going to be included into IDLE soon I'm attaching 
a version of the patch that also changes PyShell.py.

--
Added file: http://bugs.python.org/file3/17532MenuOptions-2.patch

___
Python tracker 

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



[issue9849] Argparse needs better error handling for nargs

2013-04-23 Thread paul j3

paul j3 added the comment:

The attached test_nargswarn.py file tests the argparse.py patch.  It tries out 
various nargs values, both for parsers, groups, and mutually exclusive groups.  
I intend to recast these to work in test_argparse.py

--
Added file: http://bugs.python.org/file2/test_nargswarn.py

___
Python tracker 

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



[issue9849] Argparse needs better error handling for nargs

2013-04-23 Thread paul j3

paul j3 added the comment:

This patch adds a value test for nargs during add_argument.  The core of the 
new test is in ArgumentParser._check_argument.

add_argument() now calls ArgumentParser._check_argument(), which calls 
_format_args().  If it gets a TypeError, it raises a metavar ValueError as 
before.  But if it gets an ValueError, it raises an ArgumentError.

An argument group gets the _check_argument method from its container.  This 
way, check_argument() works for both parsers and groups.

HelpFormater _format_args() now raises a ValueError if the nargs is not an 
integer (or one of the recognized strings). 

What kind of error should we produce when there is a problem with nargs?

An ArgumentError has the advantage that it includes the action name.  But the 
metavar tuple test was coded to raise ValueError.  Plus the test_argparse.py 
TestInvalidArgumentConstructors class tests all check for TypeError or 
ValueError.

I have kept the metavar tuple case as ValueError.  That way, test_argparse.py 
runs without a change.  I still need to add tests for invalid string nargs 
values.  And I think the case could be made for returning ArgumentValue errors.

--
keywords: +patch
Added file: http://bugs.python.org/file29998/nargswarn.patch

___
Python tracker 

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



[issue17532] IDLE: Always include "Options" menu on MacOSX

2013-04-23 Thread Roger Serwy

Roger Serwy added the comment:

The Options menu will become populated as soon as other extensions get included 
into IDLE, such as issue6143.

--

___
Python tracker 

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



[issue17822] Save on Close windows (IDLE)

2013-04-23 Thread Roger Serwy

Roger Serwy added the comment:

I clicked submit too soon. The attached patch inhibits closing of the Editor 
when the dialog box appears. It also sets the parent argument so that Tkinter 
on Windows actually presents a modal dialog box.

What's happening is the the dialog box enters a nested Tk eventloop which 
allows the editor window to be closed by the window manager via clicking "X". 
That re-enters the maybesave dialog. The first one unwinds and closes the 
editor window, setting its internal references to None. The initial maybesave 
resumes execution with the rug pulled out from beneath its feet and raises 
errors.

--
keywords: +patch
type: crash -> behavior
Added file: http://bugs.python.org/file29997/inhibit_close.patch

___
Python tracker 

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



[issue17822] Save on Close windows (IDLE)

2013-04-23 Thread Roger Serwy

Roger Serwy added the comment:

IDLE crashing is due to issue13582. We should maybe focus on that issue in the 
near future as it has become a common theme in many bug reports.

--

___
Python tracker 

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



[issue17804] streaming struct unpacking

2013-04-23 Thread Raymond Hettinger

Raymond Hettinger added the comment:

iter_unpack() is closer to how we name other iter variants, so I think you 
ought to stick with that.  The other names are too creative (and hence less 
guessable).

--
nosy: +rhettinger

___
Python tracker 

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



[issue17824] pty.spawn handles errors improperly

2013-04-23 Thread Gustavo Niemeyer

New submission from Gustavo Niemeyer:

This simple script will spawn N Python interpreters that aren't properly 
collected due to the improper error handling:

import pty
for i in range(N):
try: pty.spawn(["/non-existent"])
except: pass

--
components: Library (Lib)
messages: 187681
nosy: niemeyer
priority: normal
severity: normal
status: open
title: pty.spawn handles errors improperly
type: behavior
versions: Python 3.3

___
Python tracker 

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



[issue14191] argparse doesn't allow optionals within positionals

2013-04-23 Thread Glenn Linderman

Glenn Linderman added the comment:

Yes, a second function would give more flexibility.

Due to the "approval" in msg166175 to use the name parse_intermixed_args for 
the functionality described there, it would probably be best to use that name 
for that functionality.

So then we are left naming your current function something else. 
parse_known_intermixed_args certainly is descriptive, and fits the naming 
conventions of the other methods in the class. Quite long, unfortunately... but 
then I doubt it will get used much. I am using parse_intermixed_args regularly 
(via my wrapper class), and it is quite long enough.

--

___
Python tracker 

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



[issue1195571] simple callback system for Py_FatalError

2013-04-23 Thread Martin Morrison

Changes by Martin Morrison :


--
nosy: +isoschiz, pconnell

___
Python tracker 

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



[issue1195571] simple callback system for Py_FatalError

2013-04-23 Thread James Pye

James Pye added the comment:

Thinking about this again.. perhaps a better approach would be to force the 
embedder to define the symbol in their binary.

That is, libpython.x doesn't define Py_FatalError. The binary that links in 
libpython defines it.

(and a "me too" on Jonathan's comments.. for pg-python, abort() is not 
desirable.)

--
nosy: +James.Pye

___
Python tracker 

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



[issue17822] Save on Close windows (IDLE)

2013-04-23 Thread Guilherme Simões

Guilherme Simões added the comment:

>From what I could see the problem is that in MacOS askyesnocancel stops the 
>user from interacting with all windows and in Windows it stops the interaction 
>only in the root window (even when the parameter 'master' is used, as is the 
>case in IDLE). Since the root window in IDLE is hidden askyesnocancel doesn't 
>do anything.

--

___
Python tracker 

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



[issue15301] os.chown: OverflowError: Python int too large to convert to C long

2013-04-23 Thread Larry Hastings

Larry Hastings added the comment:

Serhiy: Oh, I get it, your critique was about the "Note:" part at the bottom.  
It would have been helpful if you had inserted your feedback there, instead of 
at the top.  Yeah, you're right, the note was incorrect.

I considered adding a note saying that the code was wrong if sizeof(uid_t) > 
sizeof(long) but thought better of it ;-)

New patch attached.

--
Added file: http://bugs.python.org/file29996/larry.chown.unsigned.uid.gid.6.diff

___
Python tracker 

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



[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2013-04-23 Thread Nick Coghlan

Nick Coghlan added the comment:

The codecs module is generic, text encodings are just the most common use
case (hence the associated method API).

--

___
Python tracker 

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



[issue17272] request.full_url: unexpected results on assignment

2013-04-23 Thread Demian Brecht

Changes by Demian Brecht :


Added file: 
http://bugs.python.org/file29995/request_17272.2.full_url_w_fragment.patch

___
Python tracker 

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



[issue17272] request.full_url: unexpected results on assignment

2013-04-23 Thread Demian Brecht

Demian Brecht added the comment:

As suggested by Senthil, I've broken this up into two patches: One that 
implements this reusable Request (this one) and one that implements the new 
(consistent) behaviour, in having full_url return the fragment.

I will also add a bug/patch requesting the deprecation of get_full_url as it 
will simply be a passthrough to full_url.

--
Added file: http://bugs.python.org/file29994/request_17272.1.reusable.patch

___
Python tracker 

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



[issue17822] Save on Close windows (IDLE)

2013-04-23 Thread Terry J. Reedy

Terry J. Reedy added the comment:

A different console message, Shell window not closed

Python 3.4.0a0 (default:bcfb6888fb8d, Apr 18 2013, 19:47:33) 
>>> import idlelib.idle
Exception in Tkinter callback
Traceback (most recent call last):
  File "\cpython\lib\tkinter\__init__.py", line 1475, in __call__
return self.func(*args)
  File "\cpython\lib\idlelib\EditorWindow.py", line 1002, in close
reply = self.maybesave()
  File "\cpython\lib\idlelib\EditorWindow.py", line 999, in maybesa
ve
return self.io.maybesave()
  File "\cpython\lib\idlelib\IOBinding.py", line 324, in maybesave
self.save(None)
  File "\cpython\lib\idlelib\IOBinding.py", line 338, in save
if self.writefile(self.filename):
  File "\cpython\lib\idlelib\IOBinding.py", line 370, in writefile
self.fixlastline()
  File \cpython\lib\idlelib\IOBinding.py", line 426, in fixlastlin
e
c = self.text.get("end-2c")
AttributeError: 'NoneType' object has no attribute 'get'

There is, of course, no 3.4 installation icon for starting Idle without a 
console. However
D:\Python\dev\cpython\PCbuild>pythonw_d -m idlelib

No message, Shell closes.

D:\Python\dev\cpython\PCbuild>python_d -m idlelib
...
AttributeError: 'NoneType' object has no attribute 'focus_set'

Message (different from other method of starting), Shell does not close.

--

___
Python tracker 

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



[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2013-04-23 Thread Gregory P. Smith

Gregory P. Smith added the comment:

okay, but i don't personally find any of these to be good ideas as "codecs" 
given they don't have anything to do with translating between bytes<->unicode.

--
resolution: wont fix -> 
stage: committed/rejected -> 
status: closed -> open

___
Python tracker 

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



[issue17822] Save on Close windows (IDLE)

2013-04-23 Thread Terry J. Reedy

Terry J. Reedy added the comment:

If I open Command Prompt, and start Idle with
C:\Python\Python33>python -m idlelib
I get the same attribute error without the Shell window closing. Perhaps not 
having a console to write the traceback to closes 3.3 but not 2.7. Peculiar.

--

___
Python tracker 

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



[issue9141] Allow objects to decide if they can be collected by GC

2013-04-23 Thread Martin Morrison

Changes by Martin Morrison :


--
nosy: +isoschiz, pconnell

___
Python tracker 

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



[issue16427] Faster hash implementation

2013-04-23 Thread Martin Morrison

Changes by Martin Morrison :


--
nosy: +isoschiz

___
Python tracker 

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



[issue17822] Save on Close windows (IDLE)

2013-04-23 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Because model is normal (as far as I know) I did not understand that 'continue 
to write' meant doing so without hitting [Cancel] ;-). I might consider being 
able to do so a feature *if* the dialog were the only one ever created and if 
subsequent attempts to close merely shifted focus back to the dialog.

However, after shifting focus back to the edit window without hitting [Cancel] 
and hitting [X] again, I get a *duplicate* "Save on Close" dialog. This is a 
bug somewhere. I get this duplication on 2.7.4a1 and 3.4a0 also. Only the last 
dialog created works to close the window.

On 3.3, after closing the edit window with the last dialog [No], I can 
duplicate the unexpected Idle exit by selecting any of the 3 choices in the 
previous dialog. This is a second and more serious bug. I do not see this with 
2.7.

When I run 3.3 Idle from the console interpreter with 'import idlelib.idle', 
the Shell window does not close, mimicking 2.7.
The console displays '''
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python33\lib\tkinter\__init__.py", line 1475, in __call__
return self.func(*args)
  File "C:\Python33\lib\idlelib\EditorWindow.py", line 996, in close
reply = self.maybesave()
  File "C:\Python33\lib\idlelib\EditorWindow.py", line 993, in maybesave
return self.io.maybesave()
  File "C:\Python33\lib\idlelib\IOBinding.py", line 331, in maybesave
self.text.focus_set()
AttributeError: 'NoneType' object has no attribute 'focus_set'
'''
Running 2.7 shows the same message. So this AttributeError seems not to be the 
exception causing Idle 3.3 to quit when run otherwise.

--
versions: +Python 2.7, Python 3.4

___
Python tracker 

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



[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2013-04-23 Thread Nick Coghlan

Nick Coghlan added the comment:

No, transform/untransform as methods are a bad idea, but these *codecs*
should definitely come back.

The minimal change needed for that to be feasible is to give errors raised
during encoding and decoding more context information (at least the codec
name and error mode, and switching to the right kind of error).

MAL also stated on python-dev that codecs.encode and codecs.decode already
exist, so it should just be a matter of documenting them properly.

--

___
Python tracker 

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



[issue13533] Would like Py_Initialize to play friendly with host app

2013-04-23 Thread Martin Morrison

Changes by Martin Morrison :


--
nosy: +isoschiz, pconnell

___
Python tracker 

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



[issue14191] argparse doesn't allow optionals within positionals

2013-04-23 Thread paul j3

paul j3 added the comment:

Yes, http://bugs.python.org/msg166175 does use 'parse_args' in the second call. 
 But I think things would be more flexible if we had a second function:

def parse_???(self, args=None, namespace=None):
args, argv = self.parse_intermixed_args(args, namespace)
if argv:
msg = _('unrecognized arguments: %s')
self.error(msg % ' '.join(argv))
return args

But then what would a be a good pair of names?

parse??? and parse_intermixed_args
versus
parse_intermixed_args and parse_known_intermixed_args
or
something else?

--

___
Python tracker 

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



[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2013-04-23 Thread Gregory P. Smith

Gregory P. Smith added the comment:

consensus here appears to be "bad idea... don't do this."

--
nosy: +gregory.p.smith
priority: high -> normal
resolution:  -> wont fix
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



[issue10951] gcc 4.6 warnings

2013-04-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What about backporting this fixes to 2.7?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue17386] Bring Doc/make.bat as close to Doc/Makefile as possible

2013-04-23 Thread Zachary Ware

Zachary Ware added the comment:

After finally finding a way to check the status of the pushd stack, I found a 
bug in my patch whereby an extra directory is left on the pushd stack at the 
end of each run.  As such, the version 5 patch changes from using 'goto end' to 
using 'exit /B !ERRORLEVEL!', along with some other changes related to that 
change.  Also, because of that change, error handling is made a little easier, 
so I've changed around some of the messages and the conditions for printing 
them.  Everything still seems to work.

For anyone testing this patch, I would suggest using the command "prompt 
$+%PROMPT%" if "$+" is not already part of your prompt.  This will add a '+' 
character to the beginning of your prompt for every dir on the pushd stack.

--
Added file: http://bugs.python.org/file29993/win_doc_make.v5.diff

___
Python tracker 

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



[issue17547] "checking whether gcc supports ParseTuple __format__... " erroneously returns yes with gcc 4.8

2013-04-23 Thread Dave Malcolm

Dave Malcolm added the comment:

BTW, is that GCC format checking code available anywhere?

Am I right in thinking that it was an out-of-tree patch to GCC, from the
pre-plugin days?

[My cpychecker code adds some similar checking, but it doesn't use this
attribute]

--

___
Python tracker 

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



[issue17822] Save on Close windows (IDLE)

2013-04-23 Thread R. David Murray

R. David Murray added the comment:

Interesting that you consider Windows working as expected, Terry.  I thought 
save/close dialogs were generally modal; but, then, I avoid GUIs whenever 
possible so I could easily be wrong :)

--
nosy: +r.david.murray

___
Python tracker 

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



[issue17547] "checking whether gcc supports ParseTuple __format__... " erroneously returns yes with gcc 4.8

2013-04-23 Thread Dave Malcolm

Dave Malcolm added the comment:

On Sat, 2013-04-20 at 21:25 +, Ned Deily wrote:
> Ned Deily added the comment:
> 
> Dave, any reason this shouldn't go into the imminent 2.7.5 and 3.3.2 releases?

I was trying to think of one; the only reason I can think of is if there
are any compilers out there that don't recognize "-Wformat", or have
different behaviors for this test.

That said, if "-Wformat" breaks the compile, then the configure test
should fail, and thus all should be well.

So I can't think of any issue (famous last words...)

--

___
Python tracker 

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



[issue17823] 2to3 fixers for missing codecs

2013-04-23 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
title: 2to3 fixers for -> 2to3 fixers for missing codecs

___
Python tracker 

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



[issue17823] 2to3 fixers for

2013-04-23 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +haypo

___
Python tracker 

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



[issue17823] 2to3 fixers for

2013-04-23 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Quoting Victor Stinner from msg106669:

"""
It's maybe possible for write some 2to3 fixers for the following examples:

"...".encode("base64") => base64.b64encode("...")
"...".encode("rot13") => do nothing (but display a warning?)
"...".encode("zlib") => zlib.compress("...")
"...".encode("hex") => base64.b16encode("...")
"...".encode("bz2") => bz2.compress("...")

"...".decode("base64") => base64.b64decode("...")
"...".decode("rot13") => do nothing (but display a warning?)
"...".decode("zlib") => zlib.decompress("...")
"...".decode("hex") => base64.b16decode("...")
"...".decode("bz2") => bz2.decompress("...")
"""

Unfortunately I don't know where is the syntax for writing fixers.

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 187662
nosy: benjamin.peterson, serhiy.storchaka
priority: normal
severity: normal
status: open
title: 2to3 fixers for
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4

___
Python tracker 

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



[issue11734] Add half-float (16-bit) support to struct module

2013-04-23 Thread Paul Hoffman

Paul Hoffman added the comment:

I *think* what you are saying is that there will be no float16 type, but the 
result of struct.unpack('eorwhatever', packed_stuff)[0] will be the same as 
struct.unpack('f', packed_stuff)[0], yes? If so, that's what I wanted. I don't 
want a new float16; I want the output of unpacking a half-precision to be the 
same as unpacking the other two.

I didn't see a statement like that earlier in the thread, but I could have 
missed it. Or maybe this was covered in msg132976?

--

___
Python tracker 

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



[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2013-04-23 Thread Georg Brandl

Georg Brandl added the comment:

FWIW, I'm not interested in seeing this added anymore.

--

___
Python tracker 

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



[issue17618] base85 encoding

2013-04-23 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> The problem with autodetecting is that it makes it impossible for an
> application to use this library to verify that something is encoded in 
> a specific way. Explicit is better than implicit. 

Agreed. Also, you generally known what format your data is in. Otherwise, how 
do you know that it is base85 rather than, say, base64 or uuencode?

--

___
Python tracker 

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



[issue11734] Add half-float (16-bit) support to struct module

2013-04-23 Thread Mark Dickinson

Mark Dickinson added the comment:

Paul: your example works because struct.unpack('f', packed_stuff)[0] returns a 
regular Python float, backed by C double---i.e., exactly the same type that's 
returned by struct.unpack('d', packed_stuff)[0].  In effect, the 
single-precision C value is computed and then converted to a double-precision C 
value (a lossless conversion) before being wrapped in a Python float as usual.  
There's no dedicated float32 type, and math.isnan and math.isinf don't have to 
be aware of anything other than normal Python floats.  float16 packing and 
unpacking would work the same way: on packing, a Python float would be 
converted to the closest float16 value and then serialised to a pair of bytes; 
on unpacking, that pair of bytes is (at least conceptually) converted to a 
float16 value and then to the corresponding float64 value, wrapped up in a 
Python float.

--

___
Python tracker 

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



[issue17822] Save on Close windows (IDLE)

2013-04-23 Thread Terry J. Reedy

Terry J. Reedy added the comment:

What behavior on which system to you consider to be buggy? On 3.3.1, Win 7, all 
seems fine.  By selecting Windows as a component, you imply that something is 
wrong on Windows.

"on Windows, not only can the user continue to write[(if the user Cancels),] it 
is possible to try to close the window again. Each time the user attempts to 
close the editor the "Save on Close" window appears one more time."

This is what should happen.

"Also, when you have 2 such windows if you say 'no' then,no matter what the 
answer to the second window is, IDLE crashes."

I do not see this.

'with Python 3.3': 3.3 is a version of the language. 3.3.0 and 3.3.1 are two 
different patch releases. Did you use the latter, which has several Idle 
improvements? When discussing bugs, we need to be specific as to releases used.

--

___
Python tracker 

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



[issue11734] Add half-float (16-bit) support to struct module

2013-04-23 Thread Paul Hoffman

Paul Hoffman added the comment:

Mark:

>I don't see how math.isnan or math.isinf would be affected: we're not 
>proposing to make a float16 Python type, so math.isnan would never encounter a 
>float16 value.

I was assuming that this proposal would also make this part of class 'float' 
just like the other floats returned from struct. Otherwise, you will get goofy 
cases where someone has to special-case what they get from struct.

import math, struct
FullInfinityAsInt = 0x7f80
ThisFloat = (struct.unpack("f", struct.pack("I", FullInfinityAsInt)))[0]
print("The type is " + str(type(ThisFloat)))
if math.isinf(ThisFloat):
print("This is an infiniity")
else:
print("This is not an infinity")

This should work similarly for the new half-precision, I would think.

--

___
Python tracker 

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



[issue12825] Missing and incorrect link to a command line option.

2013-04-23 Thread Éric Araujo

Éric Araujo added the comment:

Thanks for the update.  The docs under /release/x.y.z are snapshots from that 
release, so they are not continuously regenerated.  If the current /2 and /2.7 
docs are good, this can be closed.

--
resolution:  -> out of date
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



[issue17272] request.full_url: unexpected results on assignment

2013-04-23 Thread R. David Murray

R. David Murray added the comment:

Senthil, are you saying (in the review) that we should treat the current return 
value of full_url as a bug, and fix it in maintenance releases?  It is 
certainly true that its value does not match the documentation.

Ah.  I see that get_full_url used to have the same bug before you fixed it in 
3.1.  So I guess I agree with you :)

--

___
Python tracker 

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



[issue12535] Chained tracebacks are confusing because the first traceback is minimal

2013-04-23 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2013-04-23 Thread Guido van Rossum

Guido van Rossum added the comment:

str.decode() and bytes.encode() are not coming back.

Any proposal had better take into account the API design rule that the *type* 
of a method's return value should not depend on the *value* of one of the 
arguments.  (The Python 2 design failed this test, and that's why we changed 
it.)

It is however fine to let the return type depend on one of the argument 
*types*.  So e.g. bytes.transform(enc) -> bytes and str.transform(enc) -> str 
are fine.  And so are e.g. transform(bytes, enc) -> bytes and transform(str, 
enc) -> str.  But a transform() taking bytes that can return either str or 
bytes depending on the encoding name would be a problem.

Personally I don't think transformations are so important or ubiquitous so as 
to deserve being made new bytes/str methods.  I'd be happy with a convenience 
function, for example transform(input, codecname), that would have to be 
imported from somewhere (maybe the codecs module).

My guess is that in almost all cases where people are demanding to say e.g.

  x = y.transform('rot13')

the codec name is a fixed literal, and they are really after minimizing the 
number of imports.  Personally, disregarding the extra import line, I think

  x = rot13.transform(y)

looks better though.  Such custom APIs also give the API designer (of the 
transformation) more freedom to take additional optional parameters affecting 
the transformation, offer a set of variants, or a richer API.

--

___
Python tracker 

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



[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2013-04-23 Thread R. David Murray

R. David Murray added the comment:

I agree with you.  transform/untransform are parallel to encode/decode, and I 
wouldn't expect them to exist on any type that didn't support either encode or 
decode.  They are convenience methods, just as encode/decode are.

I am also probably not invested enough in it to write the PEP :)

--

___
Python tracker 

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



[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2013-04-23 Thread Nick Coghlan

Nick Coghlan added the comment:

If transform is a method, how do you plan to accept arbitrary buffer supporting 
types as input?

This is why I mentioned memoryview: it doesn't provide decode(), but there's no 
good reason you should have to copy the data from the view before decoding it. 
Similarly, you shouldn't have to make an unaltered copy before creating a 
compressed (or decompressed) copy.

With codecs.encode and codecs.decode as functions, supporting memoryview as an 
input for bytes->str decoding, binary->bytes encoding (e.g. gzip compression) 
and binary->bytes decoding (e.g. gzip decompression) is trivial. Ditto for 
array.array and anything else that supports the buffer protocol.

With transform/untransform as methods? No such luck.

And once you're using functions rather than methods, it's best to define the 
API as object -> object, and leave any type constraints up to the individual 
codecs (with the error handling improved to provide more context and a more 
meaningful exception type, as I described earlier in the thread)

--

___
Python tracker 

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



[issue17310] Ctypes callbacks shows problem on Windows Python (64bit)

2013-04-23 Thread Matt Clarke

Matt Clarke added the comment:

It seems that any argument greater than 8 bytes is automatically converted
to a references. Thus, changing to using ctypes.POINTER works. For example:

callback_t = ctypes.CFUNCTYPE(None, ctypes.POINTER(myst_args))

Quite a simple solution in the end. Is it worth documenting this on the
ctypes page?

Thanks for your help,

Matt

On 18 March 2013 15:19, Matt Clarke  wrote:

>
> Matt Clarke added the comment:
>
> Hi Amaury.
>
> They are both 12 bytes.
>
> Matt
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2013-04-23 Thread R. David Murray

R. David Murray added the comment:

I was visualizing transform/untransform as being restricted to 
buffertype->bytes and stringtype->string, which at least for binascii-type 
transforms is all the modules support.  After all, you don't get to choose what 
type of object you get back from encode or decode.

A more generalized transformation (encode/decode) utility is also interesting, 
but how many non-string non-bytes transformations do we actually support?

--

___
Python tracker 

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



[issue12825] Missing and incorrect link to a command line option.

2013-04-23 Thread Kyle Simpson

Kyle Simpson added the comment:

I can't reproduce this issue for v2.7.2 anymore, and none of the other versions 
have this problem.

Is it possible to regenerate the online docs for v2.7.2 before closing this 
issue?

--

___
Python tracker 

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



[issue12958] test_socket failures on Mac OS X

2013-04-23 Thread Ronald Oussoren

Ronald Oussoren added the comment:

FWIW I've filed a bug report about the behavior of sendmsg with Apple, the 
RADAR number is 13716133.

--

___
Python tracker 

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



[issue17792] Unhelpful UnboundLocalError due to del'ing of exception target

2013-04-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> I considered that, but is it guaranteed that the output encoding is UTF-8? 

PyErr_WarnExplicit() calls PyUnicode_FromString() which made an inverse 
decoding from UTF-8.

--

___
Python tracker 

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



[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2013-04-23 Thread Nick Coghlan

Nick Coghlan added the comment:

+1 for someone stepping up to write a PEP on this if they would like to see the 
situation improved in 3.4.

transform/untransform has at least one core developer with an explicit -1 on 
the proposal at the moment (me).

We *definitely* need a generic object->object convenience API in the codecs 
module (codecs.decode, codecs.encode). I even accept that those two functions 
could be worthy of elevation to be new builtin functions.

I'm *far* from convinced that awkwardly named methods that only handle 
str->object, bytes->object and bytearray->object are a good idea. Should 
memoryview gain transform/untransform methods as well?

transform/untransform as proposed aren't even inverse operations, since they 
don't swap the valid input and output types (that is, transform is 
str/bytes/bytearray to arbitrary objects, while untransform is *also* 
str/bytes/bytearray to arbitrary objects. Inverses can't have a domain/range 
mismatch like that).

Those names are also ambiguous about which one corresponds to "encoding" and 
which to "decoding". encode() and decode(), whether as functions in the codecs 
module or as builtins, have no such issue.

Personally, the more I think about it, the more I'm in favour of adding encode 
and decode as builtin functions for 3.4. If you want arbitrary object->object 
conversions, use the builtins, if you want strict str->bytes or 
bytes/bytearray->str use the methods. Python 3 has been around long enough now, 
and Python 3.2 and 3.3 are sufficiently well known that I think we can add the 
full power builtins without people getting confused.

--

___
Python tracker 

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



[issue12958] test_socket failures on Mac OS X

2013-04-23 Thread Nick Coghlan

Nick Coghlan added the comment:

It's entirely possible the hack in test_socket (where it catches 
unittest._ExpectedFailure to suppress the issues in the tearDown code after the 
test fails) were invalidated by the subtest changes.

--

___
Python tracker 

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



[issue12958] test_socket failures on Mac OS X

2013-04-23 Thread Ronald Oussoren

Ronald Oussoren added the comment:

Yes, only on 3.4:


==
ERROR: testFDPassSeparate (test.test_socket.RecvmsgSCMRightsStreamTest)
--
Traceback (most recent call last):
  File "/Users/ronald/Projects/python/rw/default/Lib/test/test_socket.py", line 
261, in _tearDown
raise exc
  File "/Users/ronald/Projects/python/rw/default/Lib/test/test_socket.py", line 
273, in clientRun
test_func()
  File "/Users/ronald/Projects/python/rw/default/Lib/test/test_socket.py", line 
2644, in _testFDPassSeparate
array.array("i", [fd1]))]),
  File "/Users/ronald/Projects/python/rw/default/Lib/test/test_socket.py", line 
1790, in sendmsgToServer
*(args + self.sendmsg_to_server_defaults[len(args):]))
OSError: [Errno 22] Invalid argument


(And simular for the other 3 marked socket tests)

--

___
Python tracker 

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



[issue17822] Save on Close windows (IDLE)

2013-04-23 Thread Guilherme Simões

New submission from Guilherme Simões:

After changing the contents of a file in an Editor Window and closing without 
saving the "Save on Close" window pops up. On both MacOS and Linux the user 
can't do anything on the Editor Window anymore, but on Windows, not only can 
the user continue to write it is possible to try to close the window again. 
Each time the user attempts to close the editor the "Save on Close" window 
appears one more time.

Also, when you have 2 such windows if you say 'no' then,no matter what the 
answer to the second window is, IDLE crashes.

I'm not sure but this seems to me to be a Tk problem. Attached is a simple 
script that works completely different on different systems showing that this 
is probably a Tkinter or Tk bug.

I tested this on Mac with Python 2.7, 3.3, 3.4 and Tk 8.5.13. On Linux I tested 
with Python 3.2 and Tk 8.5.11 and on Windows with Python 3.3 and Tk 8.5.11.

--
components: IDLE, Tkinter, Windows
files: askyesnocancel.py
messages: 187641
nosy: Guilherme.Simões, Todd.Rovito, gpolo, roger.serwy, terry.reedy
priority: normal
severity: normal
status: open
title: Save on Close windows (IDLE)
type: crash
versions: Python 3.3
Added file: http://bugs.python.org/file29992/askyesnocancel.py

___
Python tracker 

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



[issue17792] Unhelpful UnboundLocalError due to del'ing of exception target

2013-04-23 Thread Ezio Melotti

Ezio Melotti added the comment:

I considered that, but is it guaranteed that the output encoding is UTF-8?  
What if the warning is printed on a Windows console that uses cp1252?  I also 
considered encoding it and then use PyBytes_AsString, but I was hoping in 
something simpler (also I'm not sure where to get the right encoding).

--

___
Python tracker 

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



[issue17792] Unhelpful UnboundLocalError due to del'ing of exception target

2013-04-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

>   - Using PyUnicode_FromFormat() works, but then I don't know how to convert 
> the result to const char*

PyUnicode_AsUTF8()

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2013-04-23 Thread Ezio Melotti

Ezio Melotti added the comment:

While not strictly necessary, a PEP would be certainly useful and will help 
reaching a consensus.  The PEP should provide a summary of the available 
options (transform/untransforms, reintroducing encode/decode for bytes/str, 
maybe others), their intended behavior (e.g. is type(x.transform()) == type(x) 
always true?), and possible issues (e.g.  Should some transformations be 
limited to str or bytes?  Should rot13 work with both transform and 
untransform?).
Even if we all agreed on a solution, such document would still be useful IMHO.

--

___
Python tracker 

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



[issue12958] test_socket failures on Mac OS X

2013-04-23 Thread R. David Murray

R. David Murray added the comment:

Ronald: in 3.4 only?  If so I wonder if the subtests patch had an unintended 
side effect...I'm pretty sure it touched the expected failure machinery somehow.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2013-04-23 Thread Florent Xicluna

Florent Xicluna added the comment:

I am not a native english speaker, but it seems that the common usage of 
encode/decode is wider than the restricted definition applied for Python 3.3:

Some examples:

* RFC 4648 specifies "Base16, Base32, and Base64 Data Encodings"
  http://tools.ietf.org/html/rfc4648

* About rot13: "the same code can be used for encoding and decoding"
  http://www.catb.org/~esr/jargon/html/R/rot13.html

* The Huffman coding is "an entropy encoding algorithm" (used for DEFLATE)
  http://en.wikipedia.org/wiki/Huffman_coding

* RFC 2616 lists (zlib's) deflate or gzip as "encoding transformations"
  http://tools.ietf.org/html/rfc2616#section-3.5


However, I acknowledge that there are valid reasons to choose a different verb 
too.

--

___
Python tracker 

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



[issue12958] test_socket failures on Mac OS X

2013-04-23 Thread Ronald Oussoren

Ronald Oussoren added the comment:

Not sure what changed, but these tests are reported as failures when I run 
'make test' and not as expected failures.

--
nosy: +ronaldoussoren
versions: +Python 3.4

___
Python tracker 

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



[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2013-04-23 Thread R. David Murray

R. David Murray added the comment:

transform/untransform has approval-in-principle, adding encode/decode to the 
type that doesn't have them has been explicitly (and repeatedly :) rejected.

(I don't know about anybody else, but at this point I have written code that 
assumes that if an object has an 'encode' method, calling it will get me a 
bytes, and vice versa with 'decode'...an assumption I know is not "safe", but 
that I feel is useful duck typing in the contexts in which I used it.)

Nick wants a PEP, other people have said a PEP isn't necessary.  What is 
certainly necessary is for someone to pick up the ball and run with it.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue17269] getaddrinfo segfaults on OS X when provided with invalid arguments combinations

2013-04-23 Thread Ronald Oussoren

Ronald Oussoren added the comment:

I've updated the patch: it now contains a testcase (although the getaddrinfo 
tests are stretching the definition of the word, the new test only checks that 
the function doesn't crash)

--
Added file: http://bugs.python.org/file29991/issue17269-with-tests.txt

___
Python tracker 

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



[issue17496] OS X test for Tk availability in runtktests.py doesn't work

2013-04-23 Thread Ronald Oussoren

Ronald Oussoren added the comment:

The attached patch start wish and stops it by sending the 'exit' command. With 
the patch I can run the tk tests without getting a skip. I cannot easily test 
if the patch also does the right thing on buildbots, but have high hopes.   I 
did check that just starting 'wish' on a machine where I don't have console 
access causes a crash (OSX 10.5, nobody on the console, I logged on through 
SSH).

Open issues with my patch:

* The check uses whatever version wish is on the PATH, which may or may
  not be related to the version of Tk that python is linked to. 

  It might be better to explicitly use /usr/bin/wish, as that one is
  known to be native port of Tk (not X11) and is known to crash. 

* Not tested if the patch causes a Skip when running tests without 
  GUI access.

--
keywords: +easy
stage:  -> needs patch
type:  -> behavior
Added file: http://bugs.python.org/file29990/issue-17496.txt

___
Python tracker 

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



[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2013-04-23 Thread Ezio Melotti

Ezio Melotti added the comment:

-1
I see encoding as the process to go from text to bytes, and decoding the 
process to go from bytes to text, so (ab)using these terms for other kind of 
conversions is not an option IMHO.

Anyway I think someone should write a PEP and list the possible options and 
their pro and cons, and then a decision can be taken on python-dev.

FTR in Python 2 you can use decode for bytes->text, text->text, bytes->bytes, 
and even text->bytes:
u'DEADBEEF'.decode('hex')
'\xde\xad\xbe\xef'

--

___
Python tracker 

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



[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2013-04-23 Thread Florent Xicluna

Florent Xicluna added the comment:

Another rant, because it matters to many of us:
http://lucumr.pocoo.org/2012/8/11/codec-confusion/

IMHO, the solution to restore str.decode and bytes.encode and return TypeError 
for improper use is probably the most obvious for the average user.

--

___
Python tracker 

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



[issue17353] Plistlib outputs empty data tags when deeply nested

2013-04-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a389700fbc74 by Ronald Oussoren in branch '2.7':
Ensure that plistlib doesn't corrupt deeply nested datastructures
http://hg.python.org/cpython/rev/a389700fbc74

New changeset 6a8cb4875ac6 by Ronald Oussoren in branch '3.3':
Ensure that plistlib doesn't corrupt deeply nested datastructures
http://hg.python.org/cpython/rev/6a8cb4875ac6

New changeset e0c0bcd60033 by Ronald Oussoren in branch 'default':
(3.3->default) Ensure that plistlib doesn't corrupt deeply nested datastructures
http://hg.python.org/cpython/rev/e0c0bcd60033

--
nosy: +python-dev

___
Python tracker 

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



[issue17353] Plistlib outputs empty data tags when deeply nested

2013-04-23 Thread Ronald Oussoren

Changes by Ronald Oussoren :


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



[issue17821] Different division results with / and // operators with large numbers

2013-04-23 Thread Richard Oudkerk

Richard Oudkerk added the comment:

Yes.

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



[issue17792] Unhelpful UnboundLocalError due to del'ing of exception target

2013-04-23 Thread Ezio Melotti

Ezio Melotti added the comment:

Attached a new patch that improves the following things:
* added some tests;
* the code in the previous message is now handled correctly;
* the patch now raises a proper SyntaxWarning;

There are still several problems though:
* it doesn't work for the global namespace.  Is there a way to know if we are 
inside a function or not?
* the patch leaks, and I couldn't figure out where the leak is;
* I tried to include the name of the variable in the warning, but:
  - PyErr_WarnExplicit wants a const char* as msg and doesn't support 
formatting;
  - It doesn't seem possible to use other PyErr_Warn* functions here;
  - Using PyUnicode_FromFormat() works, but then I don't know how to convert 
the result to const char* (I used PyObject_REPR(), but that is probably wrong; 
PyUnicode_AS_DATA() might work but is deprecated; the PyUnicode_nBYTE_DATA() 
functions return a Py_UCSn*);
* more testcases are needed


While compiling I got this warning:
./setup.py:330: SyntaxWarning: "name 'why' is already defined but implicitly 
deleted after end of except clause"
  except ImportError as why:

This comes from a code like:
try: foo()
except Exception as why: pass
try: bar()
except Exception as why: pass

and in this case there shouldn't be any warning. A possible way to fix this is 
to keep a "whitelist" of locals that are first defined as an except target, but 
then it will still break if there's a `why = ...` between the two try/except 
and it's starting to get too complicated...

--
Added file: http://bugs.python.org/file29989/issue17792-2.diff

___
Python tracker 

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



[issue17821] Different division results with / and // operators with large numbers

2013-04-23 Thread Philippe Rouquier

Philippe Rouquier added the comment:

Does your comment mean that this is bug should be closed as notabug since 
anyone wanting to avoid such rounding error should use // operator?

--

___
Python tracker 

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



[issue17821] Different division results with / and // operators with large numbers

2013-04-23 Thread Richard Oudkerk

Richard Oudkerk added the comment:

Just to clarify, if you use float division then you get rounding errors.  
309657313492949847071 is a rounding error:

>>> x = 284397269195572115652769428988866694680//17
>>> x - int(float(x))
309657313492949847071L

--

___
Python tracker 

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



[issue17821] Different division results with / and // operators with large numbers

2013-04-23 Thread Richard Oudkerk

Richard Oudkerk added the comment:

In Python 3 "/" gives float division, whereas in Python 2 it is integer 
division, the same as "//".

--
nosy: +sbt

___
Python tracker 

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



[issue17821] Different division results with / and // operators with large numbers

2013-04-23 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue17821] Different division results with / and // operators with large numbers

2013-04-23 Thread Philippe Rouquier

New submission from Philippe Rouquier:

Hi,

the following statement yields different results in python2 and python3:
284397269195572115652769428988866694680//17 - 
int(284397269195572115652769428988866694680/17)

In python3 it yields:
309657313492949847071

In python2 it yields:
OL

Python2's result seems to be correct as 
(284397269195572115652769428988866694680//17) and 
(int(284397269195572115652769428988866694680/17)) should return the same result 
(as far as I understand).

With smaller numbers, this difference in results does not appear with python3.

Note: I noticed this, while working on RSA; 
284397269195572115652769428988866694680 is (p-1)(q-1) and 17 is e. I just 
mention this in case it could help.

I used linux version 3.3.3.0 and 2.7.3 for the tests on a 64 bits processor.

Sorry if I am missing something here.

--
components: Interpreter Core
messages: 187623
nosy: Philippe.Rouquier
priority: normal
severity: normal
status: open
title: Different division results with / and // operators with large numbers
type: behavior
versions: Python 3.3

___
Python tracker 

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



[issue17532] IDLE: Always include "Options" menu on MacOSX

2013-04-23 Thread Guilherme Simões

Guilherme Simões added the comment:

I didn't restore the menu in the shell window because it would be empty then. 
Perhaps a better alternative is to automatically remove any empty menu. That 
way if someone inserted a new option in the menu in the future it would show 
automatically in the MacOS version.

--

___
Python tracker 

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



[issue17818] aifc.Aifc_read/Aifc_write.getparams can return a namedtuple

2013-04-23 Thread Claudiu.Popa

Changes by Claudiu.Popa :


Added file: http://bugs.python.org/file29988/aifc_1.patch

___
Python tracker 

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



[issue15392] Create a unittest framework for IDLE

2013-04-23 Thread Nick Coghlan

Nick Coghlan added the comment:

+1 for Ezio's suggestion regarding tests that need the mock module. To simplify 
backporting you may want to do something like the following in a helper module:

try:
import unittest.mock as mock
except ImportError:
try:
import mock
except ImportError:
mock = None

Then the individual test files would retrieve the mock attribute from the 
helper module and check it with the skip decorators in the tests that needed 
mocks.

--

___
Python tracker 

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



[issue16231] pickle persistent_id return value

2013-04-23 Thread Alexandre Vassalotti

Alexandre Vassalotti added the comment:

I think it should be fixed though it is not a high-priority issue.

--

___
Python tracker 

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



[issue17532] IDLE: Always include "Options" menu on MacOSX

2013-04-23 Thread Ned Deily

Ned Deily added the comment:

Thanks for the patch, Guilherme.  While the patch does restore the Options menu 
for Edit windows, a similar change is needed in idlelib/PyShell.py to also 
restore the menu for the shell window.  I will refresh the patch or include it 
in the changes for Issue17654 which will change how and where the menus are 
customized for OS X.

--
assignee:  -> ned.deily
stage:  -> patch review
versions:  -Python 3.1, Python 3.2

___
Python tracker 

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



[issue14191] argparse doesn't allow optionals within positionals

2013-04-23 Thread Glenn Linderman

Glenn Linderman added the comment:

Very nice, Paul.

I tested that with some of my applications, and some of my test cases. All of 
them initially failed, because you have parse_intermixed_args returning 
parameters like parse_known_args instead of like parse_args. Now I can 
understand that might be a little confusing in msg166175, but note that the 
implementation is "like" a call to parse_known_args followed by a call to 
parse_args... strongly implying that the return should be like parse_args.

After tweaking your implementation in that regard, then I was able to get all 
the same applications and test cases to pass, although I haven't tried all my 
applications and all my test cases, as yet.

Your techniques for disabling particular parameters are pretty clever.

I think the difficult cases should raise an error. 

Firstly, parse_intermixed_args is intended to be for functional compatibility 
with optparse functionality, which doesn't support the difficult cases, 
therefore use of the difficult cases would require additional restrictions on 
the allowed order of options on the command line, beyond what optparse 
supports... this would be an application interface change, and as part of that 
interface change, should such happen, the flexibility of intermixing optionals 
and positionals can be restricted.

Secondly, if an understanding of how to define the use parse_intermixed_args 
with one or more of the difficult cases is reached, replacing an error case 
with a functional case is possible, but replacing one silent functionality with 
a different one is a backwards compatibility problem. Throwing an error avoids 
limiting a future definition of these cases.

The freedom of mixing optionals and positionals that would available in the now 
deprecated optparse does seem to be restored by this patch.

I look forward to seeing a revised patch, this is a very promising solution to 
this bug.

--

___
Python tracker 

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



[issue15809] IDLE console uses incorrect encoding.

2013-04-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Here's a tangentially related issue: #14326

Yes, this issue looks as a prerequisite for it.

> IDLE doesn't handle pasting multi-line code properly (issue3559), IDLE2 will 
> silently ignore code after the first executable statement. IDLE3 may give an 
> error.

Well, then the patch doesn't introduce a significant regression.

> Can't we just make IDLE's shell default to UTF-8?

This is easy. Just set IOBinding.encoding to "utf-8". But I'm not sure we don't 
lost something in this case.

--

___
Python tracker 

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



[issue14326] IDLE - allow shell to support different locales

2013-04-23 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
dependencies: +IDLE console uses incorrect encoding.

___
Python tracker 

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



[issue15392] Create a unittest framework for IDLE

2013-04-23 Thread Ezio Melotti

Ezio Melotti added the comment:

If things are fixed/added/improved on 3.x, there should be tests for them, and 
if they are backported on 2.7, tests should be backported as well.
If mock makes testing easier, I think it would be acceptable to use it and then 
have IDLE devs install a 2.7 mock and use it to run all the tests.  The tests 
on 2.7 could use skip decorators to be skipped if mock is missing, without 
having to keep these tests separate from the rest.  If necessary a script to 
install mock on 2.7 could be provided, and possibly used by the buildbots too.

This means that the initial framework should be backported, otherwise it won't 
be possible to backport any of tests that are going to use it.
FWIW the attached patch should use unittest.main() instead of 
test_main+run_unittest.

--

___
Python tracker 

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



[issue9849] Argparse needs better error handling for nargs

2013-04-23 Thread paul j3

paul j3 added the comment:

This nargs test using the formater applies only when the container has a help 
formatter.  That is true for a ArgumentParser, but not for an argument_group.

group = parser.add_argument_group('g')
group.add_argument('bar', nargs='test')

does not raise an error.

format_help will produce an error: ...
  File "./argparse.py", line 585, in _format_args
formats = ['%s' for _ in range(action.nargs)]
TypeError: 'str' object cannot be interpreted as an integer

while parse_args produces the error: ...
  File "./argparse.py", line 2200, in _get_nargs_pattern
nargs_pattern = '(-*%s-*)' % '-*'.join('A' * nargs)
TypeError: can't multiply sequence by non-int of type 'str'

--

___
Python tracker 

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



[issue11734] Add half-float (16-bit) support to struct module

2013-04-23 Thread Mark Dickinson

Mark Dickinson added the comment:

I don't see how math.isnan or math.isinf would be affected: we're not proposing 
to make a float16 Python type, so math.isnan would never encounter a float16 
value.

--

___
Python tracker 

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



[issue17729] advocacy howto improvements

2013-04-23 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for noticing that and for the patch!

--

___
Python tracker 

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



[issue17729] advocacy howto improvements

2013-04-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 990c1bd26ef1 by Ezio Melotti in branch '2.7':
#17729: remove the Advocacy HOWTO from the index.
http://hg.python.org/cpython/rev/990c1bd26ef1

New changeset a4d294539f2e by Ezio Melotti in branch '3.3':
#17729: remove the Advocacy HOWTO from the index.
http://hg.python.org/cpython/rev/a4d294539f2e

New changeset ceb1ee4bc214 by Ezio Melotti in branch 'default':
#17729: merge with 3.3.
http://hg.python.org/cpython/rev/ceb1ee4bc214

--

___
Python tracker 

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