[issue13610] On Python parsing numbers.

2011-12-15 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue13610] On Python parsing numbers.

2011-12-15 Thread Jean-Michel Fauth

New submission from Jean-Michel Fauth :

Can this be fixed? As far as I can remember (ver. 1.5.6),
it has always existed. Python does not crash, I find it
inelegant. Should it not be a SyntaxError?

Side effect. Searching for keywords, (eg. with re, "\b") may
practically always implies to handle this case separately.

Python all versions.

>>> 1and 0
0
>>> 1or 0
1
>>> 9if True else 22
9
>>> 0.1234if True else 22
0.1234
>>> [999for i in range(3)]
[999, 999, 999]

--
components: Interpreter Core
messages: 149596
nosy: Jean-Michel.Fauth
priority: normal
severity: normal
status: open
title: On Python parsing numbers.
versions: Python 2.7

___
Python tracker 

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



[issue13609] Add "os.get_terminal_size()" function

2011-12-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Well, do you want to propose a patch yourself?
See http://docs.python.org/devguide/ for how to contribute a patch.

--
nosy: +pitrou
stage:  -> needs patch
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



[issue13607] Move generator specific sections out of ceval.

2011-12-15 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +benjamin.peterson, ncoghlan
stage:  -> patch review

___
Python tracker 

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



[issue13604] update PEP 393 (match implementation)

2011-12-15 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

> Why is the utf-8 representation not cached when it is generated for
> ParseTuple et alia?

It is.

> When a string is created from a wchar_t array, who is responsible for
> releasing the original wchar_t array?

The caller.

> As I read it now, Python
> doesn't release the buffer, and the caller can't because maybe Python
> just pointed to it as memory shared with the canonical
> representation.

But Python won't; it will always make a copy for itself.

--

___
Python tracker 

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



[issue12082] Python/import.c still references fstat even with DONT_HAVE_FSTAT/!HAVE_FSTAT

2011-12-15 Thread Eric Snow

Changes by Eric Snow :


--
nosy: +eric.snow

___
Python tracker 

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



[issue1559549] ImportError needs attributes for module and file name

2011-12-15 Thread Brian Curtin

Brian Curtin  added the comment:

If I add back in the import.c change, would this then be alright?

Eric - fullname seems fine, I'll update that.

--

___
Python tracker 

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




[issue1559549] ImportError needs attributes for module and file name

2011-12-15 Thread Eric Snow

Eric Snow  added the comment:

I'm guessing that more than just Python/import.c should be updated, and more 
than one spot in import.c.

--

___
Python tracker 

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




[issue13607] Move generator specific sections out of ceval.

2011-12-15 Thread Ron Adam

Ron Adam  added the comment:

A simple test to show the difference.

BEFORE:

$ python3 -mtimeit "def y(n):" "  for x in range(n):" "yield  x" 
"sum(y(10))"
10 loops, best of 3: 3.87 usec per loop
$ python3 -mtimeit "def y(n):" "  for x in range(n):" "yield  x" 
"sum(y(100))"
10 loops, best of 3: 186 msec per loop

AFTER:
$ ./python -mtimeit "def y(n):" "  for x in range(n):" "yield  x" 
"sum(y(10))"
10 loops, best of 3: 3.81 usec per loop
$ ./python -mtimeit "def y(n):" "  for x in range(n):" "yield  x" 
"sum(y(100))"
10 loops, best of 3: 168 msec per loop

   before   after
y(10) usec's   3.873.81 - 1.55%   
y(100)msec's   186 168  - 9.67%

--

___
Python tracker 

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



[issue12776] argparse: type conversion function should be called only once

2011-12-15 Thread Arnaud Fontaine

Changes by Arnaud Fontaine :


Added file: 
http://bugs.python.org/file23973/py3k-argparse-call-type-function-once-v4.patch

___
Python tracker 

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



[issue12776] argparse: type conversion function should be called only once

2011-12-15 Thread Arnaud Fontaine

Changes by Arnaud Fontaine :


Added file: 
http://bugs.python.org/file23972/py2.7-argparse-call-type-function-once-v4.patch

___
Python tracker 

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



[issue12776] argparse: type conversion function should be called only once

2011-12-15 Thread Arnaud Fontaine

Arnaud Fontaine  added the comment:

> Could you add  a test to verify that custom  actions are still getting
> the converted values passed to their  __call__? I suspect this may not
> be happening  under the current  patch - if  that's the case,  you may
> also need to add conversions in _get_values, where the lines look like
> "value = action.default".

There seems to be already a test for that, namely TestActionUserDefined,
which use type=float  and type=int.  The value is  properly converted to
{int,float} when passed to __call__().  Just in case, I also tested with
a  'type' function  I defined  myself (which  only returns  float()) for
OptionalAction and it's working fine.

> Also,  "action.default  ==   getattr(namespace,  action.dest)"  should
> probably use "is" instead of "==".

Good point, it would be much better.  Thanks for the advice. I have just
modified the patch with that.

--

___
Python tracker 

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



[issue12014] str.format parses replacement field incorrectly

2011-12-15 Thread Eric V. Smith

Changes by Eric V. Smith :


--
assignee:  -> eric.smith

___
Python tracker 

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



[issue13584] argparse doesn't respect double quotes

2011-12-15 Thread Phillip M. Feldman

Phillip M. Feldman  added the comment:

Hello Steven,

I'm embarrassed to report that I can't reproduce the problem.  The
input line is parsed correctly if I enclose the string 'Demo IO' in
double quotes.  It is parsed incorrectly if I enclose it in single
quotes, but it looks as though this is the fault of the Windows shell,
and not Python.

My apologies.

Phillip

On Thu, Dec 15, 2011 at 2:22 AM, Steven Bethard  wrote:
>
> Steven Bethard  added the comment:
>
> Can you submit some example code that shows this? I can't reproduce this with:
>
> -- temp.py --
> import argparse
>
> parser = argparse.ArgumentParser()
> parser.add_argument("--ng", action="store_true")
> parser.add_argument("--INP")
> print(parser.parse_args())
> --
>
> $ python temp.py --ng --INP="Demo IO"
> Namespace(INP='Demo IO', ng=True)
>
> --
>
> ___
> Python tracker 
> 
> ___

--
nosy: +phillip.m.feld...@gmail.com

___
Python tracker 

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



[issue2292] Missing *-unpacking generalizations

2011-12-15 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

In the python-ideas thread "list / array comprehensions extension"
Guido replied in reference to an earlier quote from him:
"I think that -0 was contextual (too many moving parts for the original Py3k 
release). Today I am +1."

There are others in favor, pending a PEP that specifies all the details.

--

___
Python tracker 

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



[issue13041] argparse: terminal width is not detected properly

2011-12-15 Thread Denilson Figueiredo de Sá

Denilson Figueiredo de Sá  added the comment:

Issue #13609 created, but I don't have permission to edit the dependencies.

--

___
Python tracker 

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



[issue13609] Add "os.get_terminal_size()" function

2011-12-15 Thread Denilson Figueiredo de Sá

New submission from Denilson Figueiredo de Sá :

Please add a function called "os.get_terminal_size()" that should return a 
tuple "(width, height)".

The built-in "argparse" module would directly benefit from this function, as it 
would wrap the help text correctly. I'm pretty sure many users would also 
benefit from it.

Once this function gets implemented, issue #13041 can be trivially fixed. There 
are some suggestions about how to implement this feature in issue #8408.

[extra feature:] After this function gets implemented, it might be a good idea 
to implement some kind of API to detect size changes without requiring probing. 
(or, at least, the documentation should give some directions about how to 
achieve it)

--
components: Library (Lib)
messages: 149586
nosy: denilsonsa
priority: normal
severity: normal
status: open
title: Add "os.get_terminal_size()" function
type: enhancement

___
Python tracker 

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



[issue13608] remove born-deprecated PyUnicode_AsUnicodeAndSize

2011-12-15 Thread Jim Jewett

New submission from Jim Jewett :

In reviewing issue 13604 (aligning PEP 393 with the implementation) Victor 
Stinner noticed that PyUnicode_AsUnicodeAndSize is new in 3.3, but that it is 
already deprecated (because it relies on the old PyUnicode type).  

This born-deprecated function is just a shortcut for PyUnicode_AsUnicode plus 
PyUnicode_GET_SIZE, and should be removed.

--
components: Unicode
messages: 149585
nosy: Jim.Jewett, ezio.melotti
priority: normal
severity: normal
status: open
title: remove born-deprecated PyUnicode_AsUnicodeAndSize
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



[issue2292] Missing *-unpacking generalizations

2011-12-15 Thread Eric Snow

Changes by Eric Snow :


--
nosy: +eric.snow

___
Python tracker 

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



[issue13604] update PEP 393 (match implementation)

2011-12-15 Thread Jim Jewett

Changes by Jim Jewett :


Added file: http://bugs.python.org/file23971/pep-0393v20111215.patch

___
Python tracker 

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



[issue9399] Provide a 'print' action for argparse

2011-12-15 Thread Denilson Figueiredo de Sá

Changes by Denilson Figueiredo de Sá :


--
nosy: +denilsonsa

___
Python tracker 

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



[issue13604] update PEP 393 (match implementation)

2011-12-15 Thread Jim Jewett

Jim Jewett  added the comment:

>> So even if a third party module uses the legagy Unicode API, the PEP
>> 393 will still optimize the memory usage thanks to implicit calls to
>> PyUnicode_READY() (done everywhere in Python source code).

> ... unless they inspect a given Unicode string, in which case it
> will use twice the memory (or 1.5x).

Why is the utf-8 representation not cached when it is generated for ParseTuple 
et alia?

It seems like these parameters are likely to either be re-used as parameters 
(in which case caching makes sense) or not re-used at all (in which case, the 
whole string can go away).

> Well, I meant the resizing of strings that doesn't move the object
> in memory (i.e. unicode_resize).

This may easily fail because the new size can't be found at that location; 
wouldn't it be better to just encourage proper sizing in the first place?

>> (1)  Upon string creation, do we want to *promise* to discard
>> the UTF-8 and wstr, so that the caller can memory manage?

> I don't understand the question. Assuming "discards" means
> "releases" here, then there is no API which releases memory
> during creation of the string object - let alone that there is
> any promise to do so. I'm also not aware of any candidate buffer
> that you might want to release.

When a string is created from a wchar_t array, who is responsible for releasing 
the original wchar_t array?  As I read it now, Python doesn't release the 
buffer, and the caller can't because maybe Python just pointed to it as memory 
shared with the canonical representation.  

>> (2)  PyUnicode_AS_DATA(), Py_UNICODE_strncpy, Py_UNICODE_strncmp 
>> seemed to be there in the code I was looking at.

> That's very well possible. What's the question?

Victor listed them as missing.  I now suspect he meant "missing from the PEP 
list of deprecated functions and macros", and I just misunderstood.

--
Added file: http://bugs.python.org/file23970/pep-0393.txt

___
Python tracker 

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



[issue13607] Move generator specific sections out of ceval.

2011-12-15 Thread Ron Adam

New submission from Ron Adam :

The following changes cleanup the eval loop and result in a pretty solid 2 to 
3% improvement in pybench for me.

And it is about 5% faster for long generators.

* Change why enum type to int and #defines.  And moved the why defines to 
opcode.h so that they can be seen by the genrator objects after a yield, 
return, or exception.

* Added an "int f_why" to frames so the generator can see why it returned from 
a send.

* Refactored generator obj so it can use the "f->f_why" to determine what to do 
without having to do several checks first.

* Moved the generator specific execption save/swap/and clear out of the cevel 
main loop.  No need to check for those on every function call.


The only test that fails is the frame size is test_sys.  I left that in for now 
so someone could check that, and tell me if it's ok to fix it, or if I need to 
do something else.

I also considered putting the why on the tstate object.  It might save some 
memory as there wouldn't be as many of those.

--
components: Interpreter Core
files: f_why.diff
keywords: patch
messages: 149583
nosy: ron_adam
priority: normal
severity: normal
status: open
title: Move generator specific sections out of ceval.
type: performance
versions: Python 3.3
Added file: http://bugs.python.org/file23969/f_why.diff

___
Python tracker 

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



[issue13575] old style classes still alive

2011-12-15 Thread Philip Jenvey

Philip Jenvey  added the comment:

Is mro_internal's second call to type_mro_modified still needed? Its comment 
makes me suspect that it's not:

type_mro_modified(type, type->tp_mro);
/* corner case: the old-style super class might have been hidden
   from the custom MRO */
type_mro_modified(type, type->tp_bases);

--
nosy: +pjenvey

___
Python tracker 

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



[issue2292] Missing *-unpacking generalizations

2011-12-15 Thread Paul Moore

Changes by Paul Moore :


--
nosy: +pmoore

___
Python tracker 

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



[issue13603] Add prime-related and number theory functions to Python

2011-12-15 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

maniram: the proper course is to publish such a module on PyPI. Then, if there 
is enough interest in it (after a few years), propose addition to the standard 
library.

--
nosy: +loewis

___
Python tracker 

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



[issue13604] update PEP 393 (match implementation)

2011-12-15 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

> (1)  Upon string creation, do we want to *promise* to discard the UTF-8 and 
> wstr, so that the caller can memory manage?

I don't understand the question. Assuming "discards" means "releases"
here, then there is no API which releases memory during creation of
the string object - let alone that there is any promise to do so. I'm
also not aware of any candidate buffer that you might want to release.

> (2)  PyUnicode_AS_DATA(), Py_UNICODE_strncpy, Py_UNICODE_strncmp seemed to be 
> there in the code I was looking at.

That's very well possible. What's the question?

> (3)  I can't justify the born-deprecated function 
> "PyUnicode_AsUnicodeAndSize".  Perhaps rename it with a leading underscore?  
> Though I'm not sure it is really needed at all.

Nobody noticed that it is born-deprecated. If it really is, it should be
removed before the release.

--

___
Python tracker 

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



[issue13604] update PEP 393 (match implementation)

2011-12-15 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

> PyUnicode_AsUnicode(), PyUnicode_AS_UNICODE(), PyUnicode_GET_SIZE(),
> ... do reallocate a Py_UNICODE* string for a ready string, but I
> don't think that it is a usual use case.

Define "usual". There were certainly plenty of occurrences of that
in the Python code base, and I believe that extension modules also
use it, provided they care about the content of string objects at all.

> PyUnicode_AS_UNICODE() &
> friends are usually only used to build strings.

No. They are also used to inspect them.

> So even if a third party module uses the legagy Unicode API, the PEP
> 393 will still optimize the memory usage thanks to implicit calls to
> PyUnicode_READY() (done everywhere in Python source code).

... unless they inspect a given Unicode string, in which case it
will use twice the memory (or 1.5x).

> "Resizing a Unicode string remains possible until it is finalized,
> generally by calling PyUnicode_READY."
> 
> I changed PyUnicode_Resize(): it is now *always* possible to resize a
> string. The change was required because some decoders overallocate
> the string, and then resize after decoding the input.
> 
> The sentence can be simply removed.

Well, I meant the resizing of strings that doesn't move the object
in memory (i.e. unicode_resize). You (apparently) changed its signature
to take PyUnicode_Object** (instead of PyUnicode_Object*). It's probably
irrelevant since that's a unicodeobject.c-internal function, anyway.

> "PyUnicode_AsUnicodeAndSize"
> 
> This function was added to Python 3.3 and is directly deprecated. Why
> adding a function to deprecate it? PyUnicode_AsUnicode() and
> PyUnicode_GET_SIZE() were not enough?

If it was not in 3.2, we should certainly remove it right away.

--

___
Python tracker 

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



[issue2134] Add new attribute to TokenInfo to report specific token IDs

2011-12-15 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



[issue2134] Add new attribute to TokenInfo to report specific token IDs

2011-12-15 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Both the proposed text and 3.3 addition look good to me.

--

___
Python tracker 

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



[issue13604] update PEP 393 (match implementation)

2011-12-15 Thread Jim Jewett

Jim Jewett  added the comment:

Updated to resolve most of Victor's concerns, but this meant enough changes 
that I'm not sure it quite counts as editorial only.

A few questions that I couldn't answer:

(1)  Upon string creation, do we want to *promise* to discard the UTF-8 and 
wstr, so that the caller can memory manage?

(2)  PyUnicode_AS_DATA(), Py_UNICODE_strncpy, Py_UNICODE_strncmp seemed to be 
there in the code I was looking at.

(3)  I can't justify the born-deprecated function "PyUnicode_AsUnicodeAndSize". 
 Perhaps rename it with a leading underscore?  Though I'm not sure it is really 
needed at all.

(4)  I tried to reword the "for compatibility" ... "redundant" part ... but I'm 
not sure I resolved it.

--

___
Python tracker 

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



[issue13604] update PEP 393 (match implementation)

2011-12-15 Thread Jim Jewett

Changes by Jim Jewett :


Added file: http://bugs.python.org/file23968/pep-0393.txt

___
Python tracker 

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



[issue13606] test_clear_dict_in_ref_cycle in test_module only works by coincidence

2011-12-15 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset c9ae0eb66959 by Benjamin Peterson in branch 'default':
fix this test to actually test something (closes #13606)
http://hg.python.org/cpython/rev/c9ae0eb66959

--
nosy: +python-dev
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue13606] test_clear_dict_in_ref_cycle in test_module only works by coincidence

2011-12-15 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +benjamin.peterson
stage:  -> patch review
versions: +Python 3.2, Python 3.3

___
Python tracker 

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



[issue13606] test_clear_dict_in_ref_cycle in test_module only works by coincidence

2011-12-15 Thread Mark Shannon

New submission from Mark Shannon :

test_clear_dict_in_ref_cycle in test_module only works by coincidence,
if the name of the variable on line 77 is changed from 'a' to 'x', then the 
test fails.
This is a result of the arbitrary ordering of removals of values from a modules 
globals() during GC. 
Patch which passes in list, rather than using a global is attached.

--
components: Tests
files: test_module.patch
keywords: patch
messages: 149574
nosy: Mark.Shannon
priority: normal
severity: normal
status: open
title: test_clear_dict_in_ref_cycle in test_module only works by coincidence
type: behavior
Added file: http://bugs.python.org/file23967/test_module.patch

___
Python tracker 

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



[issue13596] Only recompile Lib/_sysconfigdata.py when needed

2011-12-15 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 06d83098d9a9 by Victor Stinner in branch 'default':
Close #13596: Only recompile Lib/_sysconfigdata.py when needed
http://hg.python.org/cpython/rev/06d83098d9a9

--
nosy: +python-dev
resolution:  -> fixed
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



[issue13545] Pydoc3.2: TypeError: unorderable types

2011-12-15 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset f2a5dcced66d by Victor Stinner in branch '2.7':
Issue #13545: Fix platform.libc_version() is the SO version is missing
http://hg.python.org/cpython/rev/f2a5dcced66d

--

___
Python tracker 

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



[issue13545] Pydoc3.2: TypeError: unorderable types

2011-12-15 Thread STINNER Victor

STINNER Victor  added the comment:

> The patch in msg<148968> solves the issue for me.

Cool, I applied the patch to Python 3.2 and 3.3.

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



[issue13545] Pydoc3.2: TypeError: unorderable types

2011-12-15 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 5ec7ecf62c1d by Victor Stinner in branch '3.2':
Issue #13545: Fix platform.libc_version() is the SO version is missing
http://hg.python.org/cpython/rev/5ec7ecf62c1d

New changeset a9ee21ac0879 by Victor Stinner in branch 'default':
(Merge 3.2) Issue #13545: Fix platform.libc_version() is the SO version is 
missing
http://hg.python.org/cpython/rev/a9ee21ac0879

--
nosy: +python-dev

___
Python tracker 

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



[issue11610] Improved support for abstract base classes with descriptors

2011-12-15 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset e979b26a9172 by Benjamin Peterson in branch 'default':
improve abstract property support (closes #11610)
http://hg.python.org/cpython/rev/e979b26a9172

--
nosy: +python-dev
resolution:  -> fixed
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



[issue11900] 2.7.1 unicode subclasses not calling __str__() for print statement

2011-12-15 Thread John Nagle

John Nagle  added the comment:

This has nothing to do with Python 3.  There's a difference in __str__ handling 
between Python 2.6 and Python 2.7.2.  It's enough to crash BeautifulSoup:

[Thread-8] Unexpected EXCEPTION while processing page 
"http://www.verisign.com": global name '__str__' is not defined
[Thread-8] Traceback (most recent call last):
...
[Thread-8]   File "C:\projects\sitetruth\BeautifulSoup.py", line 646, in 
prettify
[Thread-8] return self.__str__(encoding, True)
[Thread-8]   File "C:\projects\sitetruth\BeautifulSoup.py", line 621, in __str__
[Thread-8] contents = self.renderContents(encoding, prettyPrint, 
indentContents)
[Thread-8]   File "C:\projects\sitetruth\BeautifulSoup.py", line 656, in 
renderContents
[Thread-8] text = c.__str__(encoding)
[Thread-8]   File "C:\projects\sitetruth\BeautifulSoup.py", line 415, in __str__
[Thread-8] return "" % NavigableString.__str__(self, encoding)
[Thread-8]   File "C:\projects\sitetruth\BeautifulSoup.py", line 393, in 
__unicode__
[Thread-8] return __str__(self, None)
[Thread-8] NameError: global name '__str__' is not defined

The class method that's failing is simply

class NavigableString(unicode, PageElement):
...
def __unicode__(self):
return __str__(self, None)    EXCEPTION RAISED HERE 

def __str__(self, encoding=DEFAULT_OUTPUT_ENCODING):
if encoding:
return self.encode(encoding)
else:
return self

Using __str__ in the global namespace is probably wrong, and in a later version 
of BeautifulSoup, that code is changed to

def __unicode__(self):
return str(self).decode(DEFAULT_OUTPUT_ENCODING)

which seems to work.  However, it is a real change from 2.6 to 2.7 that breaks 
code.

--
nosy: +nagle

___
Python tracker 

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



[issue2134] Add new attribute to TokenInfo to report specific token IDs

2011-12-15 Thread Eric Snow

Changes by Eric Snow :


--
nosy: +eric.snow

___
Python tracker 

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



[issue11610] Improved support for abstract base classes with descriptors

2011-12-15 Thread Darren Dale

Darren Dale  added the comment:

Is this patch ready to go? I haven't heard any feedback on the most recent 
version.

--

___
Python tracker 

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



[issue13592] repr(regex) doesn't include actual regex

2011-12-15 Thread Eric Snow

Changes by Eric Snow :


--
nosy: +eric.snow

___
Python tracker 

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



[issue11957] re.sub confusion between count and flags args

2011-12-15 Thread Eric Snow

Changes by Eric Snow :


--
nosy: +eric.snow

___
Python tracker 

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



[issue2134] Add new attribute to TokenInfo to report specific token IDs

2011-12-15 Thread Meador Inge

Changes by Meador Inge :


--
nosy: +meador.inge

___
Python tracker 

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



[issue7652] Merge C version of decimal into py3k.

2011-12-15 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

2011/12/15 Stefan Krah 

>
> Stefan Krah  added the comment:
>
> Amaury has asked for more comments (and I agree). However, I'm not sure
> what
> level of detail would be appropriate. As an example, I've posted the full
> proof of the x87 modular multiplication in umodarith.h.
>
>
> Even with the Coq parts stripped, this would still be a massive comment.
>
>
> Would you prefer that level of detail or should I just post the core
> of the algorithm?
>

For my part, a two-lines description of the purpose of file is enough.
Something like
"Routines for the reverse transmogrification of randomized digits,
used in multiplication of numbers above 2**32 bits"
Or something else that makes sense :-)

At least something that makes it clear that I don't have to read further if
I'm only interested in the definition of Python classes for example.

--
nosy: +Amaury.Forgeot.d'Arc

___
Python tracker 

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



[issue13598] string.Formatter doesn't support empty curly braces "{}"

2011-12-15 Thread Meador Inge

Meador Inge  added the comment:

On Thu, Dec 15, 2011 at 1:42 AM, maniram maniram  wrote:

> Why isn't anybody commiting or commenting on my patches?

Your patch is much appreciated.  Thank you.  It takes some time to get
things reviewed.  Please read the Dev Guide.  In particular, the
"Lifecycle of a Patch"
section: http://docs.python.org/devguide/patch.html.

Also, please quit marking issues as "languishing" unless the issue meets the
qualifications spelled out here:
http://docs.python.org/devguide/languishing.html.

--
nosy: +meador.inge

___
Python tracker 

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



[issue10017] pprint.pprint raises TypeError on dictionaries with user-defined types as keys

2011-12-15 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 

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



[issue10592] pprint module doesn't work well with OrderedDicts

2011-12-15 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 

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



[issue13004] pprint: add option to truncate sequences

2011-12-15 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 

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



[issue6743] Add function compatible with print to pprint module

2011-12-15 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 

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



[issue7434] general pprint rewrite

2011-12-15 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 

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



[issue5131] pprint doesn't know how to print a defaultdict

2011-12-15 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 

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



[issue2292] Missing *-unpacking generalizations

2011-12-15 Thread Ezio Melotti

Changes by Ezio Melotti :


--
priority: low -> normal

___
Python tracker 

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



[issue13571] Backup files support in IDLE

2011-12-15 Thread Roger Serwy

Roger Serwy  added the comment:

Let's move this discussion to the IDLE-dev mailing list.

--

___
Python tracker 

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



[issue13597] Improve documentation of stdout/stderr buffering in Python 3.x

2011-12-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Should be ok now.

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



[issue13597] Improve documentation of stdout/stderr buffering in Python 3.x

2011-12-15 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 313fa7ea6c79 by Antoine Pitrou in branch '3.2':
Issue #13597: Improve documentation of standard streams.
http://hg.python.org/cpython/rev/313fa7ea6c79

New changeset 7343730185a3 by Antoine Pitrou in branch 'default':
Issue #13597: Improve documentation of standard streams.
http://hg.python.org/cpython/rev/7343730185a3

--
nosy: +python-dev

___
Python tracker 

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



[issue7502] All DocTestCase instances compare and hash equal to each other

2011-12-15 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



[issue13592] repr(regex) doesn't include actual regex

2011-12-15 Thread Ezio Melotti

Ezio Melotti  added the comment:

If an eval-able re.Regex is used, the flags can be showed as second arg, like:
  re.Regex('a', re.I|re.S)
instead of being added to the pattern as in
  re.Regex('(?is)a')

The repr can be generated with something like
  're.Regex({r.pattern!r}, {r.flags})'.format(r=r)
that currently prints
  re.Regex('abc', 50)
but if #11957 is fixed, the result will look like
  re.Regex('abc', re.I|re.S)
for a regex created with
  r = re.compile('abc', re.I|re.S)

--

___
Python tracker 

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



[issue13601] sys.stderr should be unbuffered (or always line-buffered)

2011-12-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Oops, I forgot the last two questions:

> Maybe we need better command-line control to override the defaults?

We already have -u to switch all stdio to unbuffered. This issue proposes to 
make stderr line-buffered/unbuffered by default, since it's less surprising 
than fully buffered.

> Are there precedents e.g. in Bash flags?

Well, `man bash` doesn't appear to say anything about stdio buffering.

--

___
Python tracker 

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



[issue13601] sys.stderr should be unbuffered (or always line-buffered)

2011-12-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Line-buffering should be good enough since in practice errors messages
> are always terminated by a newline.

What I think too.

> I'm hesitant to make it line-buffered by default when directed to a
> file, since this could significantly slow down a program that for some
> reason produces super-voluminous output (e.g. when running a program
> with heavy debug logging turned on).

The slow-down is impressive in relative terms (6x) but the timings are
still small in absolute value:

$ ./python -m timeit -s "f=open('/dev/null', 'a', buffering=4096)" 
"f.write('log message\n')"
1000 loops, best of 3: 0.156 usec per loop
$ ./python -m timeit -s "f=open('/dev/null', 'a', buffering=1)" "f.write('log 
message\n')"
100 loops, best of 3: 0.961 usec per loop

--

___
Python tracker 

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



[issue13594] Aifc markers write fix

2011-12-15 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
stage:  -> patch review

___
Python tracker 

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



[issue7652] Merge C version of decimal into py3k.

2011-12-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Amaury has asked for more comments (and I agree). However, I'm not sure what 
> level of detail would be appropriate. As an example, I've posted the full
> proof of the x87 modular multiplication in umodarith.h.
> 
> 
> Even with the Coq parts stripped, this would still be a massive comment.

You could ship it as a separate .txt file (like we have e.g.
Objects/dict_notes.txt).

--

___
Python tracker 

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



[issue7897] Support parametrized tests in unittest

2011-12-15 Thread Julian Berman

Changes by Julian Berman :


--
nosy: +Julian

___
Python tracker 

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



[issue7652] Merge C version of decimal into py3k.

2011-12-15 Thread Stefan Krah

Stefan Krah  added the comment:

Stefan Krah  wrote:
> Would you prefer that level of detail or should I just post the core
> of the algorithm?

Argh. s/post/add to comments in umodarith.h/

--

___
Python tracker 

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



[issue13604] update PEP 393 (match implementation)

2011-12-15 Thread STINNER Victor

STINNER Victor  added the comment:

Various comments of the PEP 393 and your patch.

"For compatibility with existing APIs, several representations
may exist in parallel; over time, this compatibility should be phased
out."
and
"For compatibility, redundant representations may be computed."

I never understood this statement: in most cases, PyUnicode_READY() replaces 
the Py_UNICODE* (wchar_t*) representation by a compact representation.

PyUnicode_AsUnicode(), PyUnicode_AS_UNICODE(), PyUnicode_GET_SIZE(), ... do 
reallocate a Py_UNICODE* string for a ready string, but I don't think that it 
is a usual use case. 
PyUnicode_AS_UNICODE() & friends are usually only used to build strings. So 
this issue should be documented in a section different than the Abstract, maybe 
in a Limitations section.

So even if a third party module uses the legagy Unicode API, the PEP 393 will 
still optimize the memory usage thanks to implicit calls to PyUnicode_READY() 
(done everywhere in Python source code).

In the current code, the most common case where a string has two 
representations is the conversion to wchar_t* on Windows. PyUnicode_AsUnicode() 
is used to encode arguments for the Windows Unicode API, and 
PyUnicode_AsUnicode() keeps the result in the wstr attribute.

Note: there is also the utf8 attribute which may contain a third representation 
if PyUnicode_AsUTF8() or PyUnicode_AsUTF8AndSize() (or the old 
_PyUnicode_AsString()) is called.

"Objects for which the maximum character is not given at creation time are 
called "legacy" objects, created through PyUnicode_FromStringAndSize(NULL, 
length)."

They can also be created by PyUnicode_FromUnicode().

"Resizing a Unicode string remains possible until it is finalized, generally by 
calling PyUnicode_READY."

I changed PyUnicode_Resize(): it is now *always* possible to resize a string. 
The change was required because some decoders overallocate the string, and then 
resize after decoding the input.

The sentence can be simply removed.

++ 000 => str is not initialized (data are in wstr)
++ 001 => 1 byte (Latin-1)
++ 010 => 2 byte (UCS-2)
++ 100 => 4 byte (UCS-4)
++ Other values are reserved at this time.

I don't like binary numbers, I would prefer decimal numbers here. Binary was 
maybe useful when we used bit masks, but we are now using the C "unsigned int 
field:bit_size;" trick for a nicer API. With the new values, it is even easier 
to remember them:

 1 byte <=> kind=1
 2 bytes <=> kind=2
 4 bytes <=> kind=4

"[PyUnicode_AsUTF8] is thus identical to the existing _PyUnicode_AsString, 
which is removed"

_PyUnicode_AsString() does still exist and is still heavily used (66 calls). It 
is not documented as deprecated in What's New in Python 3.3 (but it is a 
private function, so nobody uses it, right?.

"This section summarizes the API additions."

PyUnicode_IS_ASCII() is missing.

PyUnicode_CHARACTER_SIZE() has been removed (use kind directly).

UCS4 utility functions:

Py_UCS4_{strlen, strcpy, strcat, strncpy, strcmp, strncpy, strcmp, strncmp, 
strchr, strrchr} have been removed.


"The following functions are added to the stable ABI (PEP 384), as they
are independent of the actual representation of Unicode objects: ...
... PyUnicode_WriteChar "

PyUnicode_WriteChar() allows to modify an immutable object, which is something 
specific to CPython. Well, the function does now raise an error if the string 
is no more modifiable (e.g. more than 1 reference to the string, the hash has 
already been computed, etc.), but I don't know if it should be added to the 
stable ABI.

"PyUnicode_AsUnicodeAndSize"

This function was added to Python 3.3 and is directly deprecated. Why adding a 
function to deprecate it? PyUnicode_AsUnicode() and PyUnicode_GET_SIZE() were 
not enough?

"Deprecations, Removals, and Incompatibilities"

Missing: PyUnicode_AS_DATA(), Py_UNICODE_strncpy, Py_UNICODE_strncmp


--

A very important point is not well explained: it is very important that a 
("final") string is in its canonical representation. It means that a UCS2 
string must contain at least a character bigger than U+00FF for example. Not 
only some optimizations rely on the canonical representation, but also some 
core methods of the Unicode type.

I tried to list all properties of Unicode objects in the definition of the 
PyASCIIbject structure. And I implemented checks in 
_PyUnicode_CheckConsistency(). This method is only available in debug mode.

--

___
Python tracker 

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



[issue7652] Merge C version of decimal into py3k.

2011-12-15 Thread Stefan Krah

Stefan Krah  added the comment:

Amaury has asked for more comments (and I agree). However, I'm not sure what 
level of detail would be appropriate. As an example, I've posted the full
proof of the x87 modular multiplication in umodarith.h.


Even with the Coq parts stripped, this would still be a massive comment.


Would you prefer that level of detail or should I just post the core
of the algorithm?

--
Added file: http://bugs.python.org/file23966/ppro-mulmod.txt

___
Python tracker 

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



[issue12555] PEP 3151 implementation

2011-12-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Fixed now.

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

___
Python tracker 

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



[issue12555] PEP 3151 implementation

2011-12-15 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset d22c99e77768 by Antoine Pitrou in branch 'default':
Fix OSError.__init__ and OSError.__new__ so that each of them can be
http://hg.python.org/cpython/rev/d22c99e77768

--

___
Python tracker 

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



[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Hopefully this is fixed for good now. Thank you!

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



[issue13605] document argparse's nargs=REMAINDER

2011-12-15 Thread Steven Bethard

New submission from Steven Bethard :

There is an undocumented value for add_argument's nargs parameter, REMAINDER, 
which can be used to consume all the remaining arguments. This is commonly 
useful for command line utilities that dispatch to other command line utilities.

Though undocumented, it has been used successfully by at least a few different 
people:

http://stackoverflow.com/questions/5826881/how-to-use-argparse-to-collect-arguments-for-a-separate-command-line-without

http://code.google.com/p/argparse/issues/detail?id=52

And I just received an email from yet another user who used it successfully.

So I think it's time to graduate this from a hidden feature to a real 
documented one.

--
assignee: docs@python
components: Documentation
messages: 149552
nosy: bethard, docs@python
priority: normal
severity: normal
stage: needs patch
status: open
title: document argparse's nargs=REMAINDER
type: enhancement
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



[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset b196bcd7c34f by Antoine Pitrou in branch '3.2':
Fix the fix for issue #12149: it was incorrect, although it had the side
http://hg.python.org/cpython/rev/b196bcd7c34f

New changeset 195bfd4c3ea1 by Antoine Pitrou in branch 'default':
Fix the fix for issue #12149: it was incorrect, although it had the side
http://hg.python.org/cpython/rev/195bfd4c3ea1

New changeset da1d7f8cd487 by Antoine Pitrou in branch '2.7':
Fix the fix for issue #12149: it was incorrect, although it had the side
http://hg.python.org/cpython/rev/da1d7f8cd487

--

___
Python tracker 

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



[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Since PyType_Modified is generally called whenever a type is modified, 
> it is likely to act as a guardian for any future optimisations that 
> require classes to be unchanged.
> 
> Thus, given these two reasons, it seems wise to call PyType_Modified 
> anywhere the type is modified, however minor that modification appears 
> to be.

Well, unless we start reviewing all the places where a type might be
directly modified, I'm not sure there's much point in adding
PyType_Modified to those two.

--

___
Python tracker 

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



[issue12555] PEP 3151 implementation

2011-12-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Updated patch. I've renamed oserror_post_init to oserror_init. Also addressed 
Nick's other comments.

--
Added file: http://bugs.python.org/file23965/oserror_new2.patch

___
Python tracker 

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



[issue11807] Documentation of add_subparsers lacks information about parametres

2011-12-15 Thread Steven Bethard

Steven Bethard  added the comment:

Looks good. A few minor comments (click "review" by the patch).

--

___
Python tracker 

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



[issue11874] argparse assertion failure with brackets in metavars

2011-12-15 Thread Steven Bethard

Steven Bethard  added the comment:

I agree this is a bug. The patch needs to add unit tests that make sure 
metavars with [] work as expected.

--

___
Python tracker 

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



[issue11839] argparse: unexpected behavior of default for FileType('w')

2011-12-15 Thread Steven Bethard

Steven Bethard  added the comment:

I think Issue 12776, which delays type conversions on defaults, should solve 
this problem, right? If you agree, could you add your code here as a test case 
to that issue and mark this as duplicate?

--

___
Python tracker 

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



[issue9938] Documentation for argparse interactive use

2011-12-15 Thread Steven Bethard

Steven Bethard  added the comment:

Looks good to me.

--

___
Python tracker 

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



[issue12284] argparse.ArgumentParser: usage example option

2011-12-15 Thread Steven Bethard

Steven Bethard  added the comment:

%(prog)s is available in epilog:

-- temp.py --
import argparse

epilog = """\
Example usage:
  %(prog)s option1 option2
"""
parser = argparse.ArgumentParser(
formatter_class=argparse.RawTextHelpFormatter,
epilog=epilog)
parser.parse_args()
--
$ python temp.py -h
usage: temp.py [-h]

optional arguments:
  -h, --help  show this help message and exit

Example usage:
  temp.py option1 option2
--

Did you need more than that?

--

___
Python tracker 

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



[issue11708] argparse: suggestion for formatting optional positional args

2011-12-15 Thread Steven Bethard

Steven Bethard  added the comment:

I agree that this is a bug in current argparse formatting.

It might be a little difficult to fix though because the current option 
formatting handles arguments one at a time, and producing something like [arg1 
[arg2]] requires some understanding of how arguments interact, which the 
formatter currently doesn't have.

But patches are certainly welcome.

--

___
Python tracker 

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



[issue12686] argparse - document (and improve?) use of SUPPRESS with help=

2011-12-15 Thread Steven Bethard

Steven Bethard  added the comment:

Could you give some examples of bugs that you observed? Otherwise, this looks 
like a duplicate of issue 9349.

The intention is that help=SUPPRESS should cause the given argument to not be 
displayed in the help message. If there are cases where that's not true, then 
it's definitely a bug.

--

___
Python tracker 

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



[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Mark Shannon

Mark Shannon  added the comment:

Antoine Pitrou wrote:
> Antoine Pitrou  added the comment:
> 
>> I have added a call to PyType_Modified in type_clear (as well as
>> type_set_name and type_set_qualname, which also modify the type).
> 
> Can __name__ and __qualname__ be looked up through the method cache?

__name__ and __qualname__ are not looked up through the method cache,
but their descriptors could be.
Changing the descriptors would be caught elsewhere,
so there is no need to to add any PyType_Modified to
type_set_name and type_set_qualname.

However, calls to PyType_Modified will never cause any errors,
and if only used for genuine type modifications, will cause no 
discernible performance degradation.

Since PyType_Modified is generally called whenever a type is modified, 
it is likely to act as a guardian for any future optimisations that 
require classes to be unchanged.

Thus, given these two reasons, it seems wise to call PyType_Modified 
anywhere the type is modified, however minor that modification appears 
to be.

--

___
Python tracker 

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



[issue12713] argparse: allow abbreviation of sub commands by users

2011-12-15 Thread Steven Bethard

Steven Bethard  added the comment:

Modulo the comments already on the patch by others, this approach looks fine to 
me.

--

___
Python tracker 

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



[issue1559549] ImportError needs attributes for module and file name

2011-12-15 Thread Nick Coghlan

Nick Coghlan  added the comment:

The keyword-only idea is a backwards compatibility hack we discussed at the 
PyCon US sprints because ImportError currently accepts an arbitrary number of 
arguments:

>>> raise ImportError(1, 2, 3)
Traceback (most recent call last):
  File "", line 1, in 
ImportError: (1, 2, 3)

We don't really want to be claiming that the module name is some strange value 
due to existing code that passes multiple arguments, hence the suggestion to 
make this a keyword-only argument.

Regarding import.c, I think Brian misinterpreted Brett's last message. import.c 
absolutely *should* be modified by this patch, since it's still the default 
import implementation for the moment. Brett's comment was just to say that *he* 
wasn't going to do that part, since his aim with the importlib bootstrapping 
exercise is to nuke most of import.c from orbit :)

--

___
Python tracker 

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



[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Davide Rizzo

Davide Rizzo  added the comment:

As much as I hate being wrong, I must concur with you. ;) Thank you, Mark.

--

___
Python tracker 

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



[issue13023] argparse should allow displaying argument default values in addition to setting a formatter class

2011-12-15 Thread Steven Bethard

Steven Bethard  added the comment:

Your solution is actually the current recommended solution - mix together both 
classes that you want to combine and pass your subclass as the parameter. This 
should probably be documented somewhere (and tested more).

--

___
Python tracker 

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



[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> I have added a call to PyType_Modified in type_clear (as well as
> type_set_name and type_set_qualname, which also modify the type).

Can __name__ and __qualname__ be looked up through the method cache?

--

___
Python tracker 

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



[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Mark Shannon

Mark Shannon  added the comment:

Beat me to it, Antoine!

Don't forget type_set_name and type_set_qualname.

--

___
Python tracker 

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



[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Mark Shannon

Mark Shannon  added the comment:

What's happening is that the cycle GC calls type_clear to clear the type, but 
the method-cache is not invalidated.
I have added a call to PyType_Modified in type_clear (as well as type_set_name 
and type_set_qualname, which also modify the type).

Patch is attached.

--
Added file: http://bugs.python.org/file23964/patch

___
Python tracker 

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



[issue9253] argparse: optional subparsers

2011-12-15 Thread Steven Bethard

Steven Bethard  added the comment:

If you can make your patch relative to the cpython source tree, and add a 
couple tests, it will be easier to review.

Thanks for working on this!

--

___
Python tracker 

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



[issue12082] Python/import.c still references fstat even with DONT_HAVE_FSTAT/!HAVE_FSTAT

2011-12-15 Thread Chromatix

Changes by Chromatix :


--
nosy: +chromatix

___
Python tracker 

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



[issue12806] argparse: Hybrid help text formatter

2011-12-15 Thread Steven Bethard

Steven Bethard  added the comment:

As I understand it the current proposal is:

* Wrap each paragraph separately
* Don't wrap any lines indented by at least one additional space

This sounds like a useful formatter. I would probably call it 
"PargraphWrappingFormatter" or something like that which is more descriptive 
than FlexiFormatter.

Sadly, it can't be the default, since that would break backwards compatibility, 
but I'd certainly agree to an obvious note somewhere in the docs recommending 
the use of this formatter instead of the current default.

--

___
Python tracker 

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



[issue13041] argparse: terminal width is not detected properly

2011-12-15 Thread Steven Bethard

Steven Bethard  added the comment:

I'd feel more comfortable with the argparse fix if it were simply calling 
"os.get_terminal_size()". I recommend that you:

* Create a new issue called, say "add os.get_terminal_size()" proposing just 
the single method.

* Add that issue to the Dependencies of this issue.

Once that is fixed, then the argparse fix should be simple.

--
versions: +Python 2.7, Python 3.2

___
Python tracker 

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



[issue13271] When -h is used with argparse, default values that fail should not matter

2011-12-15 Thread Steven Bethard

Steven Bethard  added the comment:

I think http://bugs.python.org/issue12776, which delays type conversions on 
defaults should solve this problem, right? If you agree, could you add your 
code here as a test case to that issue and mark this as duplicate?

(And yes, I agree this is a bug.)

--

___
Python tracker 

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



[issue13249] argparse.ArgumentParser() lists arguments in the wrong order

2011-12-15 Thread Steven Bethard

Steven Bethard  added the comment:

The ArgumentParser constructor is definitely only intended to be called with 
keyword arguments, so it's definitely a documentation bug that it doesn't say 
this. I haven't actually applied the patch, but the basic approach and wording 
look fine to me.

--

___
Python tracker 

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



[issue12149] Segfault in _PyObject_GenericGetAttrWithDict

2011-12-15 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Thanks for the writeup, Mark. Here is a patch, calling PyType_Modified in the 
type's (not the instance's) tp_clear.

--
resolution: fixed -> 
status: closed -> open
Added file: http://bugs.python.org/file23963/type_clear.patch

___
Python tracker 

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



[issue10772] Several actions for argparse arguments missing from docs

2011-12-15 Thread Steven Bethard

Steven Bethard  added the comment:

Looks good to me too.

--

___
Python tracker 

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



[issue12776] argparse: type conversion function should be called only once

2011-12-15 Thread Steven Bethard

Steven Bethard  added the comment:

Could you add a test to verify that custom actions are still getting the 
converted values passed to their __call__? I suspect this may not be happening 
under the current patch - if that's the case, you may also need to add 
conversions in _get_values, where the lines look like "value = action.default".

Also, "action.default == getattr(namespace, action.dest)" should probably use 
"is" instead of "==".

Other than that, the patch looks okay.

--

___
Python tracker 

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



[issue13584] argparse doesn't respect double quotes

2011-12-15 Thread Steven Bethard

Steven Bethard  added the comment:

Can you submit some example code that shows this? I can't reproduce this with:

-- temp.py --
import argparse

parser = argparse.ArgumentParser()
parser.add_argument("--ng", action="store_true")
parser.add_argument("--INP")
print(parser.parse_args())
--

$ python temp.py --ng --INP="Demo IO"
Namespace(INP='Demo IO', ng=True)

--

___
Python tracker 

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



  1   2   >