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

2011-12-15 Thread Geoffrey Bache

Changes by Geoffrey Bache gjb1...@users.sourceforge.net:


--
nosy: +gjb1002

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13601
___
___
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 Mark Dickinson

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

Agree with the -1s.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13603
___
___
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 maniram maniram

Changes by maniram maniram maniandra...@gmail.com:


--
status: open - languishing

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13603
___
___
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 ericsnowcurren...@gmail.com added the comment:

Just following up on this ticket.  Anyone have any objections to Brian's patch?

Also, would 'fullname' be more appropriate than 'name', to be more in sync with 
that identifier in importlib?

--

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



[issue2377] Replace __import__ w/ importlib.__import__

2011-12-15 Thread Eric Snow

Eric Snow ericsnowcurren...@gmail.com added the comment:

AFAICT, #1559549 is the ImportError attribute ticket.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2377
___
___
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 Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
resolution:  - rejected
status: languishing - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13603
___
___
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 sor...@gmail.com added the comment:

Mark, it's been a long time since I went through this bug and don't remember 
the details. Are you sure subtype_dealloc should not call PyType_Modified? It 
looked like the appropriate place at the time. In the example the reference 
cycle was introduced on purpose by the Python program. Maybe we can try and 
explore the reference graph again?

I understood while posting the patch that this would have impacted performance. 
But deallocation of a subtype is not something that happens a lot in most 
programs. An overall 4% looks huge though.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12149
___
___
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 pit...@free.fr added the comment:

Here is a patch. Can someone take a look?

--
Added file: http://bugs.python.org/file23962/oserror_new.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12555
___
___
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 Antoine Pitrou

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

The patch doesn't appear to have the necessary mechanics to pass the new 
arguments from the import machinery when an ImportError is raised, is this 
deliberate?

Also, I'm not sure why the new arguments are keyword-only.

--
nosy: +pitrou
stage: test needed - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1559549
___
___
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 Antoine Pitrou

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


--
nosy: +haypo, loewis
stage:  - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13604
___
___
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 m...@hotpy.org added the comment:

Absolutely. subtype_dealloc deals with deallocation of subtype 
*instances*, not the types themselves.

  Maybe we can try and explore the reference graph again?
This sort of thing is one of the reasons that the cycle GC does not call 
any finalisers. Attempting to do finalisation during deallocation is 
asking for trouble, and it seems to be pervasive in CPython.
I'm surprised this sort of bug is not more common.

But subtype_dealloc deals with instances not classes, and deallocation 
of instances may happen many millions of times.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12149
___
___
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 Eric V. Smith

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

This bug is assigned to me. Sometimes it takes a while before a committer has 
time to review a bug and act on it. I can assure you that I will review this 
before the next release of Python.

Thank you for the bug report, and especially thanks for the patch!

One thing that will definitely need to be developed before this is committed is 
one or more tests. Either you can add them, or I will before I commit the fix. 
There are some existing tests for str.format that can be leveraged for 
string.Formatter.

--
stage:  - patch review

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



[issue13540] Document the Action API in argparse

2011-12-15 Thread Steven Bethard

Steven Bethard steven.beth...@gmail.com added the comment:

Sorry about being out of contact (I'm flying back and forth between the US and 
the EU every 4-5 weeks right now), and thanks Terry for bringing this to my 
attention.

Essentially, the API is:

* The argument to action= must be a callable that accepts at least a dest and 
option_strings keyword arguments, and returns some object. The keyword 
arguments passed to this callable will be dest, option_strings, and whatever 
other keyword arguments were passed to add_argument().

* The object returned by the action= callable should have attributes dest, 
option_strings, default, type, required, help, etc. defined in 
essentially the same way as the add_argument() documentation.

* The object returned by the action= callable should itself be callable, and 
should accept the arguments (self, parser, namespace, values, 
option_string=None). This method can do whatever it wants, but as you note, the 
typical approach is to invoke setattr(namespace, self.dest, ...)

Now, all that said, the easiest way of creating a callable that returns an 
callable where both have the right signatures and the right attributes is to 
subclass argparse.Action. In fact, doing it any other way is probably crazy. 
I'm against changing the name of __call__ to invoke because it removes the 
possibility of defining an action as a function returning another function 
(which is currently possible), but I'm all for making the documentation 
strongly recommend subclassing argparse.Action. I would just say something like:

You may also specify an arbitrary action by passing a subclass of 
:class:`argparse.Action`, or another callable object that implements the same 
interface.

I wouldn't bother to go into more detail about implements the same interface 
- all sane people will just subclass Action. ;-)

As to argparse.Action.__init__, hopefully the above bullet points make it clear 
that you must accept dest and option_strings, but what other keyword 
arguments you want to accept are up to you. Be sure to call the superclass 
__init__ to set any attributes that you didn't accept to appropriate default 
values. A simple example of accepting an additional keyword argument is the 
_VersionAction, which accepts a version keyword argument that the other 
actions don't accept. The current example of a custom action should probably 
define __init__ to show how this works.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13540
___
___
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 steven.beth...@gmail.com 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 rep...@bugs.python.org
http://bugs.python.org/issue13584
___
___
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 steven.beth...@gmail.com 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 rep...@bugs.python.org
http://bugs.python.org/issue12776
___
___
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 steven.beth...@gmail.com added the comment:

Looks good to me too.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10772
___
___
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 pit...@free.fr 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 rep...@bugs.python.org
http://bugs.python.org/issue12149
___
___
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 steven.beth...@gmail.com 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 rep...@bugs.python.org
http://bugs.python.org/issue13249
___
___
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 steven.beth...@gmail.com 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 rep...@bugs.python.org
http://bugs.python.org/issue13271
___
___
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 steven.beth...@gmail.com 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 rep...@bugs.python.org
http://bugs.python.org/issue13041
___
___
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 steven.beth...@gmail.com 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 rep...@bugs.python.org
http://bugs.python.org/issue12806
___
___
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 cpmicro...@gmail.com:


--
nosy: +chromatix

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12082
___
___
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 steven.beth...@gmail.com 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 rep...@bugs.python.org
http://bugs.python.org/issue9253
___
___
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 m...@hotpy.org 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 rep...@bugs.python.org
http://bugs.python.org/issue12149
___
___
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 m...@hotpy.org added the comment:

Beat me to it, Antoine!

Don't forget type_set_name and type_set_qualname.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12149
___
___
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 pit...@free.fr 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 rep...@bugs.python.org
http://bugs.python.org/issue12149
___
___
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 steven.beth...@gmail.com 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 rep...@bugs.python.org
http://bugs.python.org/issue13023
___
___
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 sor...@gmail.com added the comment:

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

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12149
___
___
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 ncogh...@gmail.com 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 stdin, line 1, in module
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 rep...@bugs.python.org
http://bugs.python.org/issue1559549
___
___
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 steven.beth...@gmail.com added the comment:

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

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12713
___
___
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 m...@hotpy.org added the comment:

Antoine Pitrou wrote:
 Antoine Pitrou pit...@free.fr 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 rep...@bugs.python.org
http://bugs.python.org/issue12149
___
___
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 steven.beth...@gmail.com 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 rep...@bugs.python.org
http://bugs.python.org/issue12686
___
___
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 steven.beth...@gmail.com 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 rep...@bugs.python.org
http://bugs.python.org/issue11708
___
___
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 steven.beth...@gmail.com 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 rep...@bugs.python.org
http://bugs.python.org/issue12284
___
___
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 steven.beth...@gmail.com added the comment:

Looks good to me.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9938
___
___
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 steven.beth...@gmail.com 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 rep...@bugs.python.org
http://bugs.python.org/issue11839
___
___
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 steven.beth...@gmail.com 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 rep...@bugs.python.org
http://bugs.python.org/issue11874
___
___
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 steven.beth...@gmail.com added the comment:

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

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11807
___
___
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 pit...@free.fr 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 rep...@bugs.python.org
http://bugs.python.org/issue12555
___
___
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 pit...@free.fr 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 rep...@bugs.python.org
http://bugs.python.org/issue12149
___
___
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 devn...@psf.upfronthosting.co.za 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 rep...@bugs.python.org
http://bugs.python.org/issue12149
___
___
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 steven.beth...@gmail.com:

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 rep...@bugs.python.org
http://bugs.python.org/issue13605
___
___
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 pit...@free.fr added the comment:

Hopefully this is fixed for good now. Thank you!

--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12149
___
___
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 devn...@psf.upfronthosting.co.za 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 rep...@bugs.python.org
http://bugs.python.org/issue12555
___
___
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 pit...@free.fr added the comment:

Fixed now.

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

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12555
___
___
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 stefan-use...@bytereef.org 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 rep...@bugs.python.org
http://bugs.python.org/issue7652
___
___
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 victor.stin...@haypocalc.com 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 rep...@bugs.python.org
http://bugs.python.org/issue13604
___
___
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 stefan-use...@bytereef.org added the comment:

Stefan Krah rep...@bugs.python.org 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 rep...@bugs.python.org
http://bugs.python.org/issue7652
___
___
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 julian+python@grayvines.com:


--
nosy: +Julian

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7897
___
___
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 pit...@free.fr 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 rep...@bugs.python.org
http://bugs.python.org/issue7652
___
___
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 pit...@free.fr:


--
stage:  - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13594
___
___
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 pit...@free.fr 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 rep...@bugs.python.org
http://bugs.python.org/issue13601
___
___
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 pit...@free.fr 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 rep...@bugs.python.org
http://bugs.python.org/issue13601
___
___
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 ezio.melo...@gmail.com 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 rep...@bugs.python.org
http://bugs.python.org/issue13592
___
___
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 ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7502
___
___
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 devn...@psf.upfronthosting.co.za 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 rep...@bugs.python.org
http://bugs.python.org/issue13597
___
___
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 pit...@free.fr added the comment:

Should be ok now.

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

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13597
___
___
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 roger.se...@gmail.com added the comment:

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

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13571
___
___
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 ezio.melo...@gmail.com:


--
priority: low - normal

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2292
___
___
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' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5131
___
___
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' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue6743] Add function compatible with print to pprint module

2011-12-15 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6743
___
___
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' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13004
___
___
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' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10592
___
___
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' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10017
___
___
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 mead...@gmail.com added the comment:

On Thu, Dec 15, 2011 at 1:42 AM, maniram maniram rep...@bugs.python.org 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 rep...@bugs.python.org
http://bugs.python.org/issue13598
___
___
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 amaur...@gmail.com added the comment:

2011/12/15 Stefan Krah rep...@bugs.python.org


 Stefan Krah stefan-use...@bytereef.org 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 rep...@bugs.python.org
http://bugs.python.org/issue7652
___
___
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 mead...@gmail.com:


--
nosy: +meador.inge

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2134
___
___
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 ericsnowcurren...@gmail.com:


--
nosy: +eric.snow

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11957
___
___
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 ericsnowcurren...@gmail.com:


--
nosy: +eric.snow

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13592
___
___
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 dsdal...@gmail.com added the comment:

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

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11610
___
___
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 ericsnowcurren...@gmail.com:


--
nosy: +eric.snow

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2134
___
___
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 na...@users.sourceforge.net 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 !--%s-- % 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 rep...@bugs.python.org
http://bugs.python.org/issue11900
___
___
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 devn...@psf.upfronthosting.co.za 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 rep...@bugs.python.org
http://bugs.python.org/issue11610
___
___
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 devn...@psf.upfronthosting.co.za 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 rep...@bugs.python.org
http://bugs.python.org/issue13545
___
___
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 victor.stin...@haypocalc.com added the comment:

 The patch in msg148968 solves the issue for me.

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

--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13545
___
___
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 devn...@psf.upfronthosting.co.za 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 rep...@bugs.python.org
http://bugs.python.org/issue13545
___
___
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 devn...@psf.upfronthosting.co.za 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 rep...@bugs.python.org
http://bugs.python.org/issue13596
___
___
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 m...@hotpy.org:

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 rep...@bugs.python.org
http://bugs.python.org/issue13606
___
___
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 pit...@free.fr:


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

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13606
___
___
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 devn...@psf.upfronthosting.co.za 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 rep...@bugs.python.org
http://bugs.python.org/issue13606
___
___
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 jimjjew...@gmail.com:


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

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13604
___
___
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 jimjjew...@gmail.com 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 rep...@bugs.python.org
http://bugs.python.org/issue13604
___
___
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 tjre...@udel.edu added the comment:

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

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2134
___
___
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 ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2134
___
___
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 mar...@v.loewis.de 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 rep...@bugs.python.org
http://bugs.python.org/issue13604
___
___
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 mar...@v.loewis.de 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 rep...@bugs.python.org
http://bugs.python.org/issue13604
___
___
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 mar...@v.loewis.de 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 rep...@bugs.python.org
http://bugs.python.org/issue13603
___
___
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 p.f.mo...@gmail.com:


--
nosy: +pmoore

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2292
___
___
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 pjen...@underboss.org 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 rep...@bugs.python.org
http://bugs.python.org/issue13575
___
___
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 ron3...@gmail.com:

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 rep...@bugs.python.org
http://bugs.python.org/issue13607
___
___
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 jimjjew...@gmail.com 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 rep...@bugs.python.org
http://bugs.python.org/issue13604
___
___
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á denilso...@gmail.com:


--
nosy: +denilsonsa

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9399
___
___
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 jimjjew...@gmail.com:


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

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13604
___
___
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 ericsnowcurren...@gmail.com:


--
nosy: +eric.snow

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2292
___
___
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á denilso...@gmail.com:

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 rep...@bugs.python.org
http://bugs.python.org/issue13609
___
___
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á denilso...@gmail.com added the comment:

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

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13041
___
___
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 tjre...@udel.edu 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 rep...@bugs.python.org
http://bugs.python.org/issue2292
___
___
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 phillip.m.feld...@gmail.com 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 rep...@bugs.python.org wrote:

 Steven Bethard steven.beth...@gmail.com 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 rep...@bugs.python.org
 http://bugs.python.org/issue13584
 ___

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

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13584
___
___
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 e...@trueblade.com:


--
assignee:  - eric.smith

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



  1   2   >