[issue15270] Economy of Expression section outdated

2012-07-07 Thread Chris Jerdonek

New submission from Chris Jerdonek chris.jerdo...@gmail.com:

The Economy of Expression section of the Dev Guide's Documenting Python--

http://docs.python.org/devguide/documenting.html#economy-of-expression

says, The documentation for super() is an example of where a good deal of 
information was condensed into a few short paragraphs.

However, the documentation for super() is now nine short paragraphs.  Back in 
Python 2.2 (when super() was introduced), the description really was only two 
short paragraphs (along with a brief code snippet):

http://docs.python.org/release/2.2.3/lib/built-in-funcs.html

So this might no longer be the best example.

--
components: Devguide
keywords: easy
messages: 164788
nosy: cjerdonek, ezio.melotti
priority: normal
severity: normal
status: open
title: Economy of Expression section outdated
versions: Python 3.3

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



[issue15246] Line coverage for collectionts.abc.Set

2012-07-07 Thread Raymond Hettinger

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


--
assignee:  - rhettinger

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



[issue15265] random.sample() docs unclear on k len(population)

2012-07-07 Thread Raymond Hettinger

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


--
assignee: docs@python - rhettinger
priority: normal - low

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



[issue15125] argparse: positional arguments containing - in name not handled well

2012-07-07 Thread Ionuț Arțăriși

Ionuț Arțăriși io...@artarisi.eu added the comment:

I'm working on this right now as part of EuroPython's CPython sprint.

--
nosy: +mapleoin

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



[issue12907] Update test coverage devguide page

2012-07-07 Thread Dougal Matthews

Changes by Dougal Matthews douga...@gmail.com:


--
nosy: +d0ugal

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



[issue5053] http.client.HTTPMessage.getallmatchingheaders() always returns []

2012-07-07 Thread Catalin Iacob

Catalin Iacob iacobcata...@gmail.com added the comment:

So, how to move this further?

In #13425 Petri proposes 4 alternatives, copying them here:

1) Document the function to make it officially part of the public API
2) Rename and move the function to http.server
3) Leave it undocumented and just fix it
4) Deprecate the function to be removed in 3.4 or 3.5 and fix it to always 
return [].

I assume 4) meant:
4) Deprecate the function to be removed in 3.4 or 3.5 and fix to do what its 
docstring specifies.

My proposal is a more explicitly spelled out version 2):
5) Remove the function, replace its usage in http.server.CGIHTTPRequestHandler 
and add a test for http.server.CGIHTTPRequestHandler that exercises the part 
that currently uses getallmatchingheaders since that's obviously broken now.

The rationale for removal without deprecation is:
* the function duplicates get_all so there's no reason to have it
* it's probably not used by any (working) code because it just doesn't work

Mike can you tell us how you found out about this breakage? Were you using the 
function? Did you use something else to workaround it since it's broken now?

Senthil, Petri do you agree with option 5)? If so I can provide a patch.

--
nosy: +catalin.iacob

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



[issue11027] Implement sectionxform in configparser

2012-07-07 Thread Łukasz Langa

Changes by Łukasz Langa luk...@langa.pl:


--
versions: +Python 3.4 -Python 3.3

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



[issue1410680] Add 'surgical editing' to ConfigParser

2012-07-07 Thread Łukasz Langa

Changes by Łukasz Langa luk...@langa.pl:


--
versions: +Python 3.4 -Python 3.2

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



[issue12178] csv writer doesn't escape escapechar

2012-07-07 Thread Catalin Iacob

Changes by Catalin Iacob iacobcata...@gmail.com:


--
nosy: +larry

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



[issue15271] argparse: repeatedly specifying the same argument ignores the previous ones

2012-07-07 Thread Ionuț Arțăriși

New submission from Ionuț Arțăriși io...@artarisi.eu:

To reproduce:

 import argparse
[74536 refs]
 parser = argparse.ArgumentParser()
[74809 refs]
 parser.add_argument(foo)
 parser.add_argument(foo)
 parser.parse_args([bar])

usage: ipython [-h] foo foo
ipython: error: too few arguments
An exception has occurred, use %tb to see the full traceback.

SystemExit: 2

 parser.parse_args([bar, baz])
 Namespace(foo='baz')

So it actually makes you provide two arguments, but it loses/ignores the first 
one and there's no way to get it back.

--
messages: 164791
nosy: bethard, mapleoin
priority: normal
severity: normal
status: open
title: argparse: repeatedly specifying the same argument ignores the previous 
ones
type: behavior

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



[issue15125] argparse: positional arguments containing - in name not handled well

2012-07-07 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

I don't see a valid use case to support - in the name of the positional 
argument.

IMHO, it should raise an error (probably a ValueError) for the add_argument in 
this case ...


Or we keep it as-is and close as wont-fix: if the op wants to pass foo-bar 
for the name of the positional argument ... it is his problem.
He can retrieve the value if he really want, with something like:
getattr(args, 'foo-bar')

In this case a single note in the documentation about using valid Python 
identifier for the names could be enough.

--
nosy: +flox

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



[issue14814] Implement PEP 3144 (the ipaddress module)

2012-07-07 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 16ff4889a858 by Nick Coghlan in branch 'default':
Issue 14814: Provide more informative error messages in ipaddress, and ensure 
that errors are caught as expected
http://hg.python.org/cpython/rev/16ff4889a858

--

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



[issue14814] Implement PEP 3144 (the ipaddress module)

2012-07-07 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

There's actually one semantic change in that last patch: IPv4Address (et al) 
will now accept leading zeroes in those cases where they're *not* ambiguous 
(i.e. values less than 8, which have identical representations in both decimal 
and octal notation).

--

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



[issue14814] Implement PEP 3144 (the ipaddress module)

2012-07-07 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

Also, I noted the provisional API status in the NEWS message, but I wonder if 
it would make more sense to leave that kind of note for the commit messages.

--

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



[issue14241] io.UnsupportedOperation.__new__(io.UnsupportedOperation) fails

2012-07-07 Thread Larry Hastings

Changes by Larry Hastings la...@hastings.org:


--
nosy: +larry

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



[issue11908] Weird `slice.stop or sys.maxint`

2012-07-07 Thread Brian Brazil

Brian Brazil brian.bra...@gmail.com added the comment:

The attached patch fixes this

--
keywords: +patch
nosy: +bbrazil
Added file: http://bugs.python.org/file26283/issue11908-islice-docs.patch

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



[issue15271] argparse: repeatedly specifying the same argument ignores the previous ones

2012-07-07 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

Confirmed.
It should probably raise an ArgumentError like this one.

http://docs.python.org/library/argparse.html#conflict-handler

--
components: +Library (Lib)
nosy: +flox
stage:  - needs patch
versions: +Python 3.3

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



[issue14241] io.UnsupportedOperation.__new__(io.UnsupportedOperation) fails

2012-07-07 Thread Antoine Pitrou

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


--
nosy: +ncoghlan

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



[issue15270] Economy of Expression section outdated

2012-07-07 Thread Antoine Pitrou

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

The super() doc is also a good example of unreadable jargon (dynamic execution 
environment ??). Nowhere is it obvious to a beginner what super() is 
*practically* used for.

--
assignee:  - docs@python
components: +Documentation
nosy: +docs@python, pitrou, rhettinger

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



[issue15144] Possible integer overflow in operations with addresses and sizes.

2012-07-07 Thread Mark Dickinson

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

If we're worrying about undefined behaviour, it looks like recent optimizations 
have *introduced* new undefined behaviour in the form of strict aliasing 
violations.  E.g., from ascii_decode:

unsigned long value = *(const unsigned long *) _p;

(here _p has type const char *).  This should really be fixed;  compilers are 
known to make optimizations based on the assumption that this sort of undefined 
behaviour doesn't occur.

--

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



[issue15144] Possible integer overflow in operations with addresses and sizes.

2012-07-07 Thread Antoine Pitrou

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

 This should really be fixed;  compilers are known to make optimizations 
 based on the assumption that this sort of undefined behaviour doesn't
 occur.

Doesn't the compiler have all the necessary information here? It's not like a 
subroutine is called.
(also, I'm not sure what optimization it could actually make)

--
nosy: +pitrou

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



[issue15144] Possible integer overflow in operations with addresses and sizes.

2012-07-07 Thread Mark Dickinson

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

 (also, I'm not sure what optimization it could actually make)

Me neither, but it doesn't seem safe to assume that no compiler will take 
advantage of this.  I don't want to start guessing what compilers might or 
might not do;  it would be much better simply to stick to valid C where 
possible.

--

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



[issue11176] give more meaningful argument names in argparse documentation

2012-07-07 Thread Greg Roodt

Greg Roodt gro...@gmail.com added the comment:

Is this still an issue? If so, I've created a simpler first example as 
suggested below. 

If we decide these docs still need a bit more work, I can also continue to 
provide better examples than the foo bar ones.

--
keywords: +patch
nosy: +groodt
Added file: http://bugs.python.org/file26284/argparse_simple_example.diff

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



[issue13498] os.makedirs exist_ok documentation is incorrect, as is some of the behavior

2012-07-07 Thread Dougal Matthews

Changes by Dougal Matthews douga...@gmail.com:


--
nosy: +d0ugal

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



[issue15265] random.sample() docs unclear on k len(population)

2012-07-07 Thread Eugenio Minardi

Eugenio Minardi eugenio.mina...@gmail.com added the comment:

Added the related line to the documentation describing when the exception is 
raised.

--
keywords: +patch
nosy: +kmox83
Added file: http://bugs.python.org/file26285/issue15265-fix-docs.patch

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



[issue15144] Possible integer overflow in operations with addresses and sizes.

2012-07-07 Thread Mark Dickinson

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

N.B. This could probably be fixed without affecting performance by using the 
usual union trick.  (IIUC, that trick was technically still undefined behaviour 
for a while, but was eventually made legal by C99 + TC3.)  As far as I know 
there aren't any instances of compilers causing problems with that construct.

--

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



[issue15144] Possible integer overflow in operations with addresses and sizes.

2012-07-07 Thread Antoine Pitrou

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

 N.B. This could probably be fixed without affecting performance by
 using the usual union trick.

How would it work? We would have to add various unions to the
PyUnicode_Object definition?

--

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



[issue15272] pkgutil.find_loader accepts invalid module names

2012-07-07 Thread Nick Coghlan

New submission from Nick Coghlan ncogh...@gmail.com:

The pkgutil import emulation is insane and permits modules identifiers to 
contain paths.

Identified in #15230 (reporting some very surprising behaviour from 
runpy.run_module).

--
messages: 164806
nosy: brett.cannon, ncoghlan
priority: normal
severity: normal
status: open
title: pkgutil.find_loader accepts invalid module names
versions: Python 3.2, Python 3.3

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



[issue15130] remove redundant paragraph in socket howto

2012-07-07 Thread Brian Brazil

Brian Brazil brian.bra...@gmail.com added the comment:

Issue confirmed, patch looks good.

--
nosy: +bbrazil

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



[issue15125] argparse: positional arguments containing - in name not handled well

2012-07-07 Thread Ionuț Arțăriși

Ionuț Arțăriși io...@artarisi.eu added the comment:

I agree with Florent that this is maybe just a documentation issue, since the 
argument is accessible via getattr().

--
keywords: +patch
Added file: http://bugs.python.org/file26286/argparse-argument-names.diff

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



[issue15144] Possible integer overflow in operations with addresses and sizes.

2012-07-07 Thread Mark Dickinson

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

 How would it work? We would have to add various unions to the
 PyUnicode_Object definition?

No, you'd just need a temporary union defined in unicodeobject.c that would 
look something like:

typedef union { unsigned long v; char s[SIZEOF_LONG]; } U;

(with better choices of names).  Python/dtoa.c does a similar thing to read / 
write the pieces of a C double using integers safely.

--

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



[issue15144] Possible integer overflow in operations with addresses and sizes.

2012-07-07 Thread Mark Dickinson

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

I'll see if I can come up with a patch, and open a new issue for it (since I've 
successfully derailed this issue from its original topic)

--

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



[issue14990] detect_encoding should fail with SyntaxError on invalid encoding

2012-07-07 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 5020afc0b7c9 by Florent Xicluna in branch '3.2':
Issue #14990: tokenize: correctly fail with SyntaxError on invalid encoding 
declaration.
http://hg.python.org/cpython/rev/5020afc0b7c9

--
nosy: +python-dev

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



[issue14990] detect_encoding should fail with SyntaxError on invalid encoding

2012-07-07 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

Thanks. Fixed in trunk too, changeset b4322ad1fec4

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

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



[issue15094] Incorrectly placed #endif in _tkinter.c.

2012-07-07 Thread Brian Brazil

Brian Brazil brian.bra...@gmail.com added the comment:

Issue confirmed, patch looks good.

--
nosy: +bbrazil

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



[issue14879] invalid docs for subprocess exceptions with shell=True

2012-07-07 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

I would add a simple note to the exceptions section:

Note, when shell=True, OSError will be raised by the child only if the 
selected shell itself cannot be found. To determine if the shell failed to find 
the requested application, it is necessary to check the return code or output 
from the subprcess.

--

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



[issue5053] http.client.HTTPMessage.getallmatchingheaders() always returns []

2012-07-07 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

My 4) actually meant that it should always return []. This is what it currently 
does, so it could be spelled out clearly in the code.

IIRC, getallmatchingheaders() cannot be emulated one-to-one using get_all(), 
because it handles continuation lines differently. That's why I thought 
removing or deprecating without fixing it would be the best.

rfc822.Message.getallmatchingheaders() is documented in Python 2, so removing 
it could make it harder to port code from Python 2 to Python 3. On the other 
hand, it's broken, so having it removed could actually make things better by 
not introducing hard-to-find bugs.

All in all, I'm not sure what's the best thing to do.

--
nosy: +ezio.melotti
versions: +Python 3.3 -Python 3.1

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



[issue8881] socket.getaddrinfo() should return named tuples

2012-07-07 Thread Floris Bruynooghe

Floris Bruynooghe floris.bruynoo...@gmail.com added the comment:

Attached in a patch for this, I've also changed the version to 3.4 since this 
is a feature and therefore probably too late to go in 3.3.  Please let me know 
if anything is inadequate.

--
keywords: +patch
versions: +Python 3.4 -Python 3.3
Added file: http://bugs.python.org/file26287/getaddrinfo.patch

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



[issue15230] runpy.run_path doesn't set __package__ correctly

2012-07-07 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

Firstly, I think you've identified a real bug with __package__ not being set 
correctly when using runpy.run_path (and I have updated this issue title 
accordingly).

I have also created a separate bug report (#15272) for the bizarre behaviour 
you identified in runpy.run_module - names containing / characters should be 
rejected as invalid. 

One of the main reasons you're having trouble though is that you can only do 
relative imports when inside a package - at the top level (as both of your 
modules are) relative imports are illegal. By forcing package to __main__ you 
are claiming a location in the package namespace of __main__.__main__ which 
doesn't make any sense.

The module life cycle problem for functions is covered in #812369. The only 
reason you're not hitting it in the run_module case is that when alter_sys is 
False, no temporary module is created. For data attributes (the intended use 
case for runpy), this all works fine regardless, but functions (which retain a 
reference to the original module namespace) will only work properly with 
alter_sys turned off. There should probably be a general disclaimer in the 
module docs that functions and classes are not guaranteed to be valid after 
using runpy, and importlib.import_module should be used instead for such cases.

#9235 looks into ways the runpy module might be enhanced with a CodeRunner 
class for other reasons, but the same mechanism could be used to keep the 
temporary module alive without storing it in sys.modules.

--
title: runpy.run_path broken: Breaks scoping; pollutes sys.modules; doesn't set 
__package__ - runpy.run_path doesn't set __package__ correctly

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



[issue15144] Possible integer overflow in operations with addresses and sizes.

2012-07-07 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

 If we're worrying about undefined behaviour, it looks like recent 
 optimizations have *introduced* new undefined behaviour in the form of strict 
 aliasing violations.  E.g., from ascii_decode:
 
 unsigned long value = *(const unsigned long *) _p;
 
 (here _p has type const char *).

I don't see what the undefined behavior. Can you specify exactly the
item of the Standard, in which it is mentioned?

   This should really be fixed;  compilers are known to make optimizations 
 based on the assumption that this sort of undefined behaviour doesn't occur.

I don't know how else you can rewrite it, without destroying completely
the effect of optimization.

In any case, I don't think that the original patch introduces some new
undefined behavior.

--

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



[issue8881] socket.getaddrinfo() should return named tuples

2012-07-07 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
nosy: +flox
stage: needs patch - patch review

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



[issue15183] it should be made clear that the statement in the --setup option and the setup kw arg aren't included in the count

2012-07-07 Thread Greg Roodt

Greg Roodt gro...@gmail.com added the comment:

Confirmed that the setup statement is correctly excluded from the overall timed 
run.

I've updated the docstring and rst to make this clearer.

--
keywords: +patch
nosy: +groodt
Added file: http://bugs.python.org/file26288/timeit_setup_clarification.diff

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



[issue8264] hasattr doesn't show private (double underscore) attributes exist

2012-07-07 Thread Catalin Iacob

Catalin Iacob iacobcata...@gmail.com added the comment:

Attached a patch that adds a note for getattr and setattr. hasattr is 
documented in terms of getattr so I would say it's not needed there.

I don't know if the interaction with private attributes is confusing enough 
that it's worth increasing the verbosity of the getattr and setattr docs, all 
in all I think I'm +0 to adding the note and -0 to just closing the bug as by 
design and no doc change needed.

--
keywords: +patch
nosy: +catalin.iacob
title: hasattr doensn't show private (double underscore) attributes exist - 
hasattr doesn't show private (double underscore) attributes exist
Added file: 
http://bugs.python.org/file26289/get-set-attr-private-name-mangling.patch

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



[issue15144] Possible integer overflow in operations with addresses and sizes.

2012-07-07 Thread Mark Dickinson

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

 I don't see what the undefined behavior. Can you specify exactly the
 item of the Standard, in which it is mentioned?

It's C99 section 6.5, paragraph 7:  An object shall have its stored value 
accessed only by an lvalue expression that has one of the following types  
 It's the dereferencing of the pointer that's the problem: that's accessing a 
stored value of type 'char' by an lvalue expression that has type 'unsigned 
long'.

 In any case, I don't think that the original patch introduces some new
 undefined behavior.

Ah;  were the strict aliasing problems already there before the patch?  I 
didn't check.

--

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



[issue15230] runpy.run_path doesn't set __package__ correctly

2012-07-07 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


--
assignee:  - ncoghlan

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



[issue15230] runpy.run_path doesn't set __package__ correctly

2012-07-07 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

You may also have identified a bug with pkgutil's import emulation failing to 
clean up sys.modules correctly when an import fails.

--

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



[issue15230] runpy.run_path doesn't set __package__ correctly

2012-07-07 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

Sorry, that's not accurate - you have enough code in b.py to make the relative 
import work by convincing the interpreter it's actually being done in a package.

So what you're seeing in that regard is the fact that runpy is not any kind of 
sandbox - it shares process global state, including the import system, with all 
other modules. While the temporary module will be reverted automatically by 
runpy, any child imports will always remain visible in sys.modules, and any 
other side effects will remain in place (e.g. codec registrations).

--

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



[issue14814] Implement PEP 3144 (the ipaddress module)

2012-07-07 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset af4ae710daf3 by Nick Coghlan in branch 'default':
Issue 14814: Make the ipaddress code easier to follow by using newer language 
features (patch by Serhiy Storchaka)
http://hg.python.org/cpython/rev/af4ae710daf3

--

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



[issue14290] Importing script as module causes ImportError with pickle.load

2012-07-07 Thread Floris Bruynooghe

Floris Bruynooghe floris.bruynoo...@gmail.com added the comment:

Hi, I think this is a usage error and if not you should try to provide a test 
case with both files for this.

Pickle needs to be able to import the module which contains the classes by the 
same name as the original module.  That means pickling an instance of a class 
defined in a script will not work unless it is the same script which did the 
pickling.  The object is probably pickled under the name __main__.YourClass and 
when you import it in another script it will be objectScript.YourClass, hence 
pickle is unable to find the class for the object you are trying to unpickle.

--
nosy: +flub

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



[issue5053] http.client.HTTPMessage.getallmatchingheaders() always returns []

2012-07-07 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

The CGIHTTPRequestHandler fix and test would be the best thing to start with, 
though, as it's not related to the eventual fate of getallmatchingheaders().

--
stage:  - needs patch

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



[issue14814] Implement PEP 3144 (the ipaddress module)

2012-07-07 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

Many of Serhiy's tweaks were also micro-optimisations, but I committed them 
mainly because I found them easier to read.

--

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



[issue15002] urllib2 does not download 4 MB file completely using ftp

2012-07-07 Thread Brian Brazil

Brian Brazil brian.bra...@gmail.com added the comment:

I've tested this on head, and the issue appears to be buggy ftp code in python.

From the attached tcpdump for fetching delegated-ripencc-20120706:

12:57:19.933607 IP myhost.39627  ftp.ripe.net.ftp: Flags [.], ack 511, win 
115, options [nop,nop,TS val 129353190 ecr 1632444059], length 0
12:57:19.934853 IP myhost.39627  ftp.ripe.net.ftp: Flags [F.], seq 97, ack 
511, win 115, options [nop,nop,TS val 129353191 ecr 1632444059], length 0

and a bit later:

12:57:20.043701 IP ftp.ripe.net.42707  myhost.50818: Flags [.], seq 
46337:47785, ack 1, win 227, options [nop,nop,TS val 2552550247 ecr 129353204], 
length 1448
12:57:20.043717 IP myhost.50818  ftp.ripe.net.42707: Flags [.], ack 47785, win 
353, options [nop,nop,TS val 129353218 ecr 2552550247], length 0
12:57:20.043816 IP ftp.ripe.net.42707  myhost.50818: Flags [FP.], seq 
47785:49153, ack 1, win 227, options [nop,nop,TS val 2552550247 ecr 129353204], 
length 1368
12:57:20.043992 IP myhost.50818  ftp.ripe.net.42707: Flags [F.], seq 1, ack 
49154, win 376, options [nop,nop,TS val 129353218 ecr 2552550247], length 0
12:57:20.094067 IP ftp.ripe.net.42707  myhost.50818: Flags [.], ack 2, win 
227, options [nop,nop,TS val 2552550299 ecr 129353218], length 0

As you can see we're sending a FIN without sending a close command to the 
control connection, and in response the server stops sending data about 49k in. 
Per RFC 959 section 2.3: The server may abort data transfer if the control 
connections are closed without command. so this is acceptable behaviour on the 
part of the server, and means we need to keep the control connection open for 
longer.

--
nosy: +bbrazil
Added file: http://bugs.python.org/file26290/issue15002-tcpdump-early-fin

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



[issue15222] mailbox.mbox writes without empty line after each message

2012-07-07 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

MDAs blindly write their message to the end of the user's mail spool file. So, 
if there's no newline at the end, the mailbox gets corrupted (the new message 
is joined with the previous one).

I tested with Postfix, but this probably happens for other MDA's too.

--

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



[issue14814] Implement PEP 3144 (the ipaddress module)

2012-07-07 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset d03dbc324b60 by Nick Coghlan in branch 'default':
Issue 14814: Explain how to get more error detail in the ipaddress tutorial, 
and tweak the display for octet errors in IPv4 (noticed the formatting problem 
when adding to the docs)
http://hg.python.org/cpython/rev/d03dbc324b60

--

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



[issue15002] urllib2 does not download 4 MB file completely using ftp

2012-07-07 Thread Antoine Pitrou

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


--
nosy: +giampaolo.rodola

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



[issue15273] Remove unnecessarily random behavior from test_unparse.py

2012-07-07 Thread Larry Hastings

New submission from Larry Hastings la...@hastings.org:

Tools/parser/test_unparse.py is the regression test suite for Tools/unparse.  
To save time, if the cpu resource is not enabled it only test unparsing ten 
files.  However it picks these files at random.

It would be nice if the test was 100% repeatable.  It might be nice if it 
picked the most tortuous ten files.  What ten are the most tortuous is not 
immediately clear, but a nice first approximation might be to pick the largest 
ten, provided the stat calls don't themselves make the test slow again.

--
assignee: mark.dickinson
messages: 164831
nosy: larry, mark.dickinson
priority: low
severity: normal
stage: needs patch
status: open
title: Remove unnecessarily random behavior from test_unparse.py
type: behavior
versions: Python 3.3

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



[issue15273] Remove unnecessarily random behavior from test_unparse.py

2012-07-07 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


--
assignee: mark.dickinson - 
keywords: +easy
versions: +Python 3.4 -Python 3.3

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



[issue15273] Remove unnecessarily random behavior from test_unparse.py

2012-07-07 Thread Mark Dickinson

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

Ideally, it would pick a small number of files that are likely to fully 
exercise Python's grammar.  So things like Lib/test/test_grammar might be 
useful to include.

Or perhaps there should be a Python file somewhere in Lib/test whose entire 
purpose is to contain at least one example of each grammar construction?

--

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



[issue15002] urllib2 does not download 4 MB file completely using ftp

2012-07-07 Thread Brian Brazil

Brian Brazil brian.bra...@gmail.com added the comment:

More particularly, the ftpwrapper's ftp member is being GCed sometime after 
FtpHandler.ftp_open returns.

--

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



[issue14814] Implement PEP 3144 (the ipaddress module)

2012-07-07 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 86d3b4067f74 by Nick Coghlan in branch 'default':
Issue 14814: Further clean ups to the ipaddress tutorial
http://hg.python.org/cpython/rev/86d3b4067f74

--

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



[issue10142] Support for SEEK_HOLE/SEEK_DATA

2012-07-07 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset d69f95e57792 by Jesus Cea in branch 'default':
Cope with OSs lying - #10142: Support for SEEK_HOLE/SEEK_DATA
http://hg.python.org/cpython/rev/d69f95e57792

--

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



[issue12271] panel.h is not found even if it's installed on various flavours of SUSE

2012-07-07 Thread Catalin Iacob

Catalin Iacob iacobcata...@gmail.com added the comment:

The same happens on OpenSUSE 12.1 so Python can't be fully built there which is 
a bit of a shame.

OpenSUSE uses this patch for their packages, but that would break other 
distributions so it's not a good solution:
-#include panel.h
+#include ncurses/panel.h

Here's a list of all curses related files in /usr/include on my OpenSUSE 12.1:
catalin@linux-vo6z:~/cpython/issue12271 find  /usr/include/  -regex 
'.*curses.*' -and \( -type f -or -type l \) -exec ls -lh {} \; 
-rw-r--r-- 1 root root 4.1K May 10 15:28 /usr/include/python2.7/py_curses.h
lrwxrwxrwx 1 root root 16 Nov 20  2011 /usr/include/curses.h - ncurses/curses.h
-rw-r--r-- 1 root root 75K Oct 29  2011 /usr/include/ncurses/curses.h
-rw-r--r-- 1 root root 6.5K Oct 29  2011 /usr/include/ncurses/cursesapp.h
-rw-r--r-- 1 root root 27K Oct 29  2011 /usr/include/ncurses/cursesf.h
-rw-r--r-- 1 root root 20K Oct 29  2011 /usr/include/ncurses/cursesm.h
-rw-r--r-- 1 root root 8.3K Oct 29  2011 /usr/include/ncurses/cursesp.h
-rw-r--r-- 1 root root 49K Oct 29  2011 /usr/include/ncurses/cursesw.h
-rw-r--r-- 1 root root 7.2K Oct 29  2011 /usr/include/ncurses/cursslk.h
-rw-r--r-- 1 root root 2.9K Oct 29  2011 /usr/include/ncurses/eti.h
-rw-r--r-- 1 root root 9.1K Oct 29  2011 /usr/include/ncurses/etip.h
-rw-r--r-- 1 root root 18K Oct 29  2011 /usr/include/ncurses/form.h
-rw-r--r-- 1 root root 12K Oct 29  2011 /usr/include/ncurses/menu.h
-rw-r--r-- 1 root root 4.0K Oct 29  2011 /usr/include/ncurses/nc_tparm.h
lrwxrwxrwx 1 root root 8 Nov 20  2011 /usr/include/ncurses/ncurses.h - curses.h
-rw-r--r-- 1 root root 3.9K Oct 29  2011 /usr/include/ncurses/ncurses_dll.h
-rw-r--r-- 1 root root 4.0K Oct 29  2011 /usr/include/ncurses/panel.h
-rw-r--r-- 1 root root 40K Oct 29  2011 /usr/include/ncurses/term.h
-rw-r--r-- 1 root root 7.2K Oct 29  2011 /usr/include/ncurses/term_entry.h
-rw-r--r-- 1 root root 3.5K Oct 29  2011 /usr/include/ncurses/termcap.h
-rw-r--r-- 1 root root 13K Oct 29  2011 /usr/include/ncurses/tic.h
-rw-r--r-- 1 root root 3.1K Oct 29  2011 /usr/include/ncurses/unctrl.h
lrwxrwxrwx 1 root root 17 Nov 20  2011 /usr/include/ncurses.h - 
ncurses/ncurses.h
lrwxrwxrwx 1 root root 16 Nov 20  2011 /usr/include/ncurses6/curses.h - 
ncurses/curses.h
-rw-r--r-- 1 root root 75K Oct 29  2011 /usr/include/ncurses6/ncurses/curses.h
-rw-r--r-- 1 root root 6.5K Oct 29  2011 
/usr/include/ncurses6/ncurses/cursesapp.h
-rw-r--r-- 1 root root 27K Oct 29  2011 /usr/include/ncurses6/ncurses/cursesf.h
-rw-r--r-- 1 root root 20K Oct 29  2011 /usr/include/ncurses6/ncurses/cursesm.h
-rw-r--r-- 1 root root 8.3K Oct 29  2011 /usr/include/ncurses6/ncurses/cursesp.h
-rw-r--r-- 1 root root 49K Oct 29  2011 /usr/include/ncurses6/ncurses/cursesw.h
-rw-r--r-- 1 root root 7.2K Oct 29  2011 /usr/include/ncurses6/ncurses/cursslk.h
-rw-r--r-- 1 root root 2.9K Oct 29  2011 /usr/include/ncurses6/ncurses/eti.h
-rw-r--r-- 1 root root 9.1K Oct 29  2011 /usr/include/ncurses6/ncurses/etip.h
-rw-r--r-- 1 root root 18K Oct 29  2011 /usr/include/ncurses6/ncurses/form.h
-rw-r--r-- 1 root root 12K Oct 29  2011 /usr/include/ncurses6/ncurses/menu.h
-rw-r--r-- 1 root root 4.0K Oct 29  2011 
/usr/include/ncurses6/ncurses/nc_tparm.h
lrwxrwxrwx 1 root root 8 Nov 20  2011 /usr/include/ncurses6/ncurses/ncurses.h 
- curses.h
-rw-r--r-- 1 root root 3.9K Oct 29  2011 
/usr/include/ncurses6/ncurses/ncurses_dll.h
-rw-r--r-- 1 root root 4.0K Oct 29  2011 /usr/include/ncurses6/ncurses/panel.h
-rw-r--r-- 1 root root 40K Oct 29  2011 /usr/include/ncurses6/ncurses/term.h
-rw-r--r-- 1 root root 7.2K Oct 29  2011 
/usr/include/ncurses6/ncurses/term_entry.h
-rw-r--r-- 1 root root 3.5K Oct 29  2011 /usr/include/ncurses6/ncurses/termcap.h
-rw-r--r-- 1 root root 13K Oct 29  2011 /usr/include/ncurses6/ncurses/tic.h
-rw-r--r-- 1 root root 3.1K Oct 29  2011 /usr/include/ncurses6/ncurses/unctrl.h
lrwxrwxrwx 1 root root 17 Nov 20  2011 /usr/include/ncurses6/ncurses.h - 
ncurses/ncurses.h
-rw-r--r-- 1 root root 92K Oct 29  2011 /usr/include/ncurses6/ncursesw/curses.h

If we look just for panel.h we get:
catalin@linux-vo6z:~/cpython/issue12271 find  /usr/include/  -regex 
'.*curses.*' -and \( -type f -or -type l \) -exec ls -lh {} \;  | grep panel.h
-rw-r--r-- 1 root root 4.0K Oct 29  2011 /usr/include/ncurses/panel.h
-rw-r--r-- 1 root root 4.0K Oct 29  2011 /usr/include/ncurses6/ncurses/panel.h
-rw-r--r-- 1 root root 4.0K Oct 29  2011 /usr/include/ncurses6/ncursesw/panel.h
-rw-r--r-- 1 root root 4.0K Oct 29  2011 /usr/include/ncursesw/panel.h

There is some specific code that appends '/usr/include/ncursesw' to the include 
list in setup.py but that doesn't get triggered here because curses_library == 
'ncurses' because readline is built against that.

The attached patch makes it build and the curses tests pass but it feels kind 
of hack-ish. panel.h is there so Python should find it somehow therefore this 
is a genuine bug. Ideas for a better solution?

--
keywords: 

[issue10142] Support for SEEK_HOLE/SEEK_DATA

2012-07-07 Thread Jesús Cea Avión

Jesús Cea Avión j...@jcea.es added the comment:

Thanks for the head-up, Antoine.

--

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



[issue14814] Implement PEP 3144 (the ipaddress module)

2012-07-07 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 2e9cba1d1554 by Nick Coghlan in branch 'default':
Issue 14814: Correctly return NotImplemented from ipaddress._BaseNetwork.__eq__
http://hg.python.org/cpython/rev/2e9cba1d1554

--

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



[issue15274] Patch for issue 5765: stack overflow evaluating eval(() * 30000)

2012-07-07 Thread Andrea Griffini

New submission from Andrea Griffini agr...@tin.it:

This is a fix for issue #5765: stack overflow evaluating eval(() * 3)

The solution was to add two fields (recursion_depth and
recursion_limit) to the symbol table object and just increment and
check the depth in symtable_visit_expr raising a RuntimeError in case
the limit is exceeded.

The test case added also covers other similar cases (a.b.b.b.b.b...
and a[0][0][0][0])

There is no depth check in when visiting statement because I cannot
think to a way to nesting statements too much without getting other
errors before. If there is a way to do it, it would be trivial to also
cover that part.

The patch uses the current depth and current recursion limit but
multiplies them for a factor because I suppose that the amount of C
stack used by the compiler per recursion is smaller than the amount
used by the interpreter; the constant in the patch is 4. Using a
constant of 1 (i.e. just using the normal recursion limit) doesn't
allow a previously existing test about big expressions to pass.

--
files: compiler_recursion_limit_check.patch
keywords: patch
messages: 164839
nosy: ag6502
priority: normal
severity: normal
status: open
title: Patch for issue 5765: stack overflow evaluating eval(() * 3)
Added file: 
http://bugs.python.org/file26292/compiler_recursion_limit_check.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15274
___diff -r d9c98730e2e8 Include/symtable.h
--- a/Include/symtable.hSat Jul 07 13:34:50 2012 +1000
+++ b/Include/symtable.hSat Jul 07 14:39:38 2012 +0200
@@ -30,6 +30,8 @@
 PyObject *st_private;   /* name of current class or NULL */
 PyFutureFeatures *st_future;/* module's future features that affect
the symbol table */
+int recursion_depth;/* current recursion depth */
+int recursion_limit;/* recursion limit */
 };
 
 typedef struct _symtable_entry {
diff -r d9c98730e2e8 Lib/test/test_compile.py
--- a/Lib/test/test_compile.py  Sat Jul 07 13:34:50 2012 +1000
+++ b/Lib/test/test_compile.py  Sat Jul 07 14:39:38 2012 +0200
@@ -474,6 +474,14 @@
 self.assertInvalidSingle('f()\nxy # blah\nblah()')
 self.assertInvalidSingle('x = 5 # comment\nx = 6\n')
 
+def test_compiler_recursion_limit(self):
+self.assertRaises(RuntimeError, self.compile_single, () * 10)
+self.assertRaises(RuntimeError, self.compile_single, a + .b * 
10)
+self.assertRaises(RuntimeError, self.compile_single, a + [0] * 
10)
+self.compile_single(() * 2000)
+self.compile_single(a + .b * 2000)
+self.compile_single(a + [0] * 2000)
+
 def test_main():
 support.run_unittest(TestSpecifics)
 
diff -r d9c98730e2e8 Python/symtable.c
--- a/Python/symtable.c Sat Jul 07 13:34:50 2012 +1000
+++ b/Python/symtable.c Sat Jul 07 14:39:38 2012 +0200
@@ -218,17 +218,37 @@
 return NULL;
 }
 
+/* When compiling the use of C stack is probably going to be a lot
+   lighter than when executing Python code but still can overflow
+   and causing a Python crash if not checked (e.g. eval(()*30)).
+   Using the current recursion limit for the compiler too seems
+   overconstraining so a factor is used to allow deeper recursion
+   when compiling an expression.
+*/
+#define COMPILER_STACK_FRAME_SCALE 4
+
 struct symtable *
 PySymtable_Build(mod_ty mod, const char *filename, PyFutureFeatures *future)
 {
 struct symtable *st = symtable_new();
 asdl_seq *seq;
 int i;
+PyThreadState *tstate;
 
 if (st == NULL)
 return st;
 st-st_filename = filename;
 st-st_future = future;
+
+/* Setup recursion depth check counters */
+tstate = PyThreadState_GET();
+if (!tstate) {
+PySymtable_Free(st);
+return NULL;
+}
+st-recursion_depth = tstate-recursion_depth * COMPILER_STACK_FRAME_SCALE;
+st-recursion_limit = Py_GetRecursionLimit() * COMPILER_STACK_FRAME_SCALE;
+
 /* Make the initial symbol information gathering pass */
 if (!GET_IDENTIFIER(top) ||
 !symtable_enter_block(st, top, ModuleBlock, (void *)mod, 0, 0)) {
@@ -1268,6 +1288,12 @@
 static int
 symtable_visit_expr(struct symtable *st, expr_ty e)
 {
+if (++st-recursion_depth  st-recursion_limit) {
+PyErr_SetString(PyExc_RuntimeError,
+maximum recursion depth exceeded while compiling an 
expression);
+--st-recursion_depth;
+return 0;
+}
 switch (e-kind) {
 case BoolOp_kind:
 VISIT_SEQ(st, expr, e-v.BoolOp.values);
@@ -1280,8 +1306,10 @@
 VISIT(st, expr, e-v.UnaryOp.operand);
 break;
 case Lambda_kind: {
-if (!GET_IDENTIFIER(lambda))
+if (!GET_IDENTIFIER(lambda)) {
+--st-recursion_depth;
 return 0;
+}
 if 

[issue5765] stack overflow evaluating eval(() * 30000)

2012-07-07 Thread Andrea Griffini

Andrea Griffini agr...@tin.it added the comment:

This is a fix for this issue.

The solution was to add two fields (recursion_depth and
recursion_limit) to the symbol table object and just increment and
check the depth in symtable_visit_expr raising a RuntimeError in case
the limit is exceeded.

The test case added also covers other similar cases (a.b.b.b.b.b...
and a[0][0][0][0])

There is no depth check in when visiting statement because I cannot
think to a way to nesting statements too much without getting other
errors before. If there is a way to do it, it would be trivial to also
cover that part.

The patch uses the current depth and current recursion limit but
multiplies them for a factor because I suppose that the amount of C
stack used by the compiler per recursion is smaller than the amount
used by the interpreter; the constant in the patch is 4. Using a
constant of 1 (i.e. just using the normal recursion limit) doesn't
allow a previously existing test about big expressions to pass.

--
keywords: +patch
nosy: +ag6502
Added file: 
http://bugs.python.org/file26293/compiler_recursion_limit_check.patch

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



[issue15274] Patch for issue 5765: stack overflow evaluating eval(() * 30000)

2012-07-07 Thread Andrea Griffini

Andrea Griffini agr...@tin.it added the comment:

I sent an email because I was not able to log in. The patch has been submitted 
to the correct issue (6765).

--
resolution:  - duplicate
status: open - closed

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



[issue15275] isinstance is called a more times that needed in ntpath

2012-07-07 Thread Manuel de la Pena

New submission from Manuel de la Pena man...@canonical.com:

The problem is simple, the code that allows to use binary strings and unicode 
is making more calls that needed to isinstance(path, bytes) since the result of 
the code is not shared. For example, the following calls are present in the 
module:

def _get_empty(path):
if isinstance(path, bytes):
return b'' 
else:
return ''

def _get_sep(path):
if isinstance(path, bytes):
return b'\\'
else:
return '\\'

def _get_altsep(path):
if isinstance(path, bytes):
return b'/'
else:
return '/'

def _get_bothseps(path):
if isinstance(path, bytes):
return b'\\/'
else:
return '\\/'

def _get_dot(path):
if isinstance(path, bytes):
return b'.'
else:
return '.'

...

And then something similar to the following is found in the code:

def normpath(path):
Normalize path, eliminating double slashes, etc.
sep = _get_sep(path)
dotdot = _get_dot(path) * 2
special_prefixes = _get_special(path)
if path.startswith(special_prefixes):
# in the case of paths with these prefixes:
# \\.\ - device names
# \\?\ - literal paths
# do not do any normalization, but return the path unchanged
return path
path = path.replace(_get_altsep(path), sep)
prefix, path = splitdrive(path)

As you can see the isinstance call is performed more than needed which 
certainly affects the performance of the path operations. 

The attached patch removes the number of calls to isinstance(obj, bytes) and 
also ensures that the function that returns the correct literal is as fast as 
possible by using a dict.

--
components: Windows
files: less_isinstance.patch
hgrepos: 140
keywords: patch
messages: 164842
nosy: mandel
priority: normal
severity: normal
status: open
title: isinstance is called a more times that needed in ntpath
versions: Python 3.3
Added file: http://bugs.python.org/file26294/less_isinstance.patch

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



[issue15265] random.sample() docs unclear on k len(population)

2012-07-07 Thread Roy Smith

Roy Smith r...@panix.com added the comment:

The docs describe population as a sequence.  Your patch describes it as a 
list.  I would go with:

If *len(population)* is less than *k*, raises :exc:`ValueError`.

--

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



[issue15275] isinstance is called a more times that needed in ntpath

2012-07-07 Thread Manuel de la Pena

Changes by Manuel de la Pena man...@canonical.com:


Added file: http://bugs.python.org/file26295/f5c57ba1124b.diff

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



[issue15276] unicode format does not really work in Python 2.x

2012-07-07 Thread Ariel Ben-Yehuda

New submission from Ariel Ben-Yehuda arie...@mail.tau.ac.il:

unicode formats (u'{:n}'.format) in python 2.x assume that the thousands 
seperator is in ascii, so this fails:

 import locale
 locale.setlocale(locale.LC_NUMERIC, 'fra') # or fr_FR on UNIX
 u'{:n}'.format(1)
Traceback (most recent call last):
  File pyshell#3, line 1, in module
u'{:n}'.format(1)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xa0 in position 2: ordinal 
not in range(128)

However, it works correctly in python 3, properly returning '10\xA0' (the 
\xA0 is a nbsp)

--
messages: 164844
nosy: Ariel.Ben-Yehuda
priority: normal
severity: normal
status: open
title: unicode format does not really work in Python 2.x
versions: Python 2.7

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



[issue15275] isinstance is called a more times that needed in ntpath

2012-07-07 Thread Manuel de la Pena

Changes by Manuel de la Pena man...@canonical.com:


Removed file: http://bugs.python.org/file26295/f5c57ba1124b.diff

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



[issue15265] random.sample() docs unclear on k len(population)

2012-07-07 Thread Eugenio Minardi

Eugenio Minardi eugenio.mina...@gmail.com added the comment:

Ok, I have updated the patch

--
Added file: http://bugs.python.org/file26296/issue15265-fix-docs-update.patch

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



[issue1616125] Cached globals+builtins lookup optimization

2012-07-07 Thread Andrea Griffini

Andrea Griffini agr...@tin.it added the comment:

Closing as it was a partial implementation of a bad idea with questionable 
gains.

--
resolution:  - invalid
status: open - closed

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



[issue15276] unicode format does not really work in Python 2.x

2012-07-07 Thread Chris Jerdonek

Chris Jerdonek chris.jerdo...@gmail.com added the comment:

Cf. the related issue 7300: Unicode arguments in str.format().

--
nosy: +cjerdonek

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



[issue10248] Fix resource warnings in test_xmlrpclib

2012-07-07 Thread Brian Brazil

Brian Brazil brian.bra...@gmail.com added the comment:

Looks like someone else has already fixed this.

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

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



[issue14241] io.UnsupportedOperation.__new__(io.UnsupportedOperation) fails

2012-07-07 Thread Mark Shannon

Mark Shannon m...@hotpy.org added the comment:

 io.UnsupportedOperation.__new__(io.UnsupportedOperation)
behaves correctly now (rev d9c98730e2e8)

This bug was (I believe) caused somehow by an error in OSError_new() which did 
not initialize self-args if OSError_init() was not called.

Here is a crash which exploited the lack of initialization:
(Works on rev 2a142141e5fd)

 class C(ValueError, OSError):pass
... 
 c = OSError.__new__(C)
 str(c)
Segmentation fault (core dumped)

This has already been fixed, so I'm closing this issue.

--
assignee:  - eric.araujo
components: +Distutils2 -Interpreter Core
nosy: +alexis, tarek
resolution:  - fixed
status: open - closed

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



[issue13248] deprecated in 3.2, should be removed in 3.3

2012-07-07 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

Do we agree to remove the max_buffer_size from the io module in 3.3?

This argument is unused, and deprecated. Just dead code.
See attachment.

--
Added file: http://bugs.python.org/file26297/issue13248_io_max_buffer_size.diff

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



[issue13248] deprecated in 3.2, should be removed in 3.3

2012-07-07 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


Removed file: 
http://bugs.python.org/file23928/issue13248_argparse_io_lib2to3.diff

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



[issue8823] urllib2 does not catch httplib.BadStatusLine

2012-07-07 Thread Greg Roodt

Greg Roodt gro...@gmail.com added the comment:

I've made a small change to urllib2 to catch the httplib.BadStatusLine and 
raise as URLError. This exception should rarely happen as it means the server 
is returning invalid responses. Nevertheless, I've added a test and hopefully 
fixed the issue.

Patch is attached. I will check if this needs to be added to newer versions of 
Python.

--
keywords: +patch
nosy: +groodt
Added file: http://bugs.python.org/file26298/bad_status_urlerror.diff

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



[issue13248] deprecated in 3.2, should be removed in 3.3

2012-07-07 Thread Antoine Pitrou

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

 Do we agree to remove the max_buffer_size from the io module in 3.3?

Yes!

--

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



[issue7651] Python3: guess text file charset using the BOM

2012-07-07 Thread Łukasz Langa

Łukasz Langa luk...@langa.pl added the comment:

After reading the mailing list thread at

  http://mail.python.org/pipermail/python-dev/2010-January/097102.html

and waging on other concerns (e.g. how to behave on write-only and read-write 
modes), it looks like a PEP might be necessary to solve this once and for all.

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

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



[issue7651] Python3: guess text file charset using the BOM

2012-07-07 Thread Łukasz Langa

Changes by Łukasz Langa luk...@langa.pl:


--
type:  - enhancement

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



[issue11786] ConfigParser.[Raw]ConfigParser optionxform()

2012-07-07 Thread Łukasz Langa

Changes by Łukasz Langa luk...@langa.pl:


--
status: pending - closed

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



[issue7651] Python3: guess text file charset using the BOM

2012-07-07 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

For the implementation part, there's something which already plays with the BOM 
in the tokenize module.

See tokenize.open(), which uses tokenize.detect_encoding() to read the BOM in 
some cases.

--
nosy: +flox

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



[issue15277] Fix resource leak in support.py:_is_ipv6_enabled

2012-07-07 Thread Brian Brazil

New submission from Brian Brazil brian.bra...@gmail.com:

I'm running Ubuntu Precise and have net.ipv6.conf.all.disable_ipv6 = 1 in my 
sysctl.conf. With this configuration at head there's a fd leak in 
_is_ipv6_enabled in support.py when the bind fails, which the attached patch 
should fix.

--
components: Tests
files: ipv6-enabled-fd-leak-fix.patch
keywords: patch
messages: 164855
nosy: bbrazil
priority: normal
severity: normal
status: open
title: Fix resource leak in support.py:_is_ipv6_enabled
type: resource usage
versions: Python 3.4
Added file: http://bugs.python.org/file26299/ipv6-enabled-fd-leak-fix.patch

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



[issue13405] Add DTrace probes

2012-07-07 Thread Jesús Cea Avión

Jesús Cea Avión j...@jcea.es added the comment:

I need to pass a --with-dtrace to the buildbot configure. How can I do it, 
beside faking it manipulating the pushed configure script?.

--

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



[issue13405] Add DTrace probes

2012-07-07 Thread Antoine Pitrou

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

 I need to pass a --with-dtrace to the buildbot configure. How can I
 do it, beside faking it manipulating the pushed configure script?.

This is done on the buildmaster. I just did the change, can you try
again?

--

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



[issue1767933] Badly formed XML using etree and utf-16

2012-07-07 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

 Serhiy, note that _SimpleElementPath is now gone in 3.3, since ElementPath.py 
 is always there in stdlib. Could you update the patch to reflect this?

Don't worry, _SimpleElementPath is not used in changes.

 Another thing. I'm trying really hard to phase out the doctest tests of 
 etree, replacing them with unittest-based tests as much as possible. The 
 doctests are causing all kinds of trouble with parametrized testing for both 
 the Python and the C implementations. Please don't add new doctests. If you 
 add tests, add them to existing TestCase classes, or create new ones.

Done. I replaced the encoding doctest by unittest-based tests and merge
it with StringIOTest and user IO tests in one IOTest class. Added test
for StringIO writing.

Also I've improved support of unbuffered file objects (as for
issue1470548).

--
Added file: http://bugs.python.org/file26300/etree_write_utf16_3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1767933
___diff -r d03dbc324b60 Lib/test/test_xml_etree.py
--- a/Lib/test/test_xml_etree.pySat Jul 07 22:15:22 2012 +1000
+++ b/Lib/test/test_xml_etree.pySat Jul 07 17:23:00 2012 +0300
@@ -888,65 +888,6 @@
 
 ET.XML(?xml version='1.0' encoding='%s'?xml / % encoding)
 
-def encoding():
-r
-Test encoding issues.
-
- elem = ET.Element(tag)
- elem.text = abc
- serialize(elem)
-'tagabc/tag'
- serialize(elem, encoding=utf-8)
-b'tagabc/tag'
- serialize(elem, encoding=us-ascii)
-b'tagabc/tag'
- serialize(elem, encoding=iso-8859-1)
-b?xml version='1.0' encoding='iso-8859-1'?\ntagabc/tag
-
- elem.text = \\'
- serialize(elem)
-'taglt;amp;\'gt;/tag'
- serialize(elem, encoding=utf-8)
-b'taglt;amp;\'gt;/tag'
- serialize(elem, encoding=us-ascii) # cdata characters
-b'taglt;amp;\'gt;/tag'
- serialize(elem, encoding=iso-8859-1)
-b'?xml version=\'1.0\' 
encoding=\'iso-8859-1\'?\ntaglt;amp;\'gt;/tag'
-
- elem.attrib[key] = \\'
- elem.text = None
- serialize(elem)
-'tag key=lt;amp;quot;\'gt; /'
- serialize(elem, encoding=utf-8)
-b'tag key=lt;amp;quot;\'gt; /'
- serialize(elem, encoding=us-ascii)
-b'tag key=lt;amp;quot;\'gt; /'
- serialize(elem, encoding=iso-8859-1)
-b'?xml version=\'1.0\' encoding=\'iso-8859-1\'?\ntag 
key=lt;amp;quot;\'gt; /'
-
- elem.text = '\xe5\xf6\xf6'
- elem.attrib.clear()
- serialize(elem)
-'tag\xe5\xf6\xf6lt;gt;/tag'
- serialize(elem, encoding=utf-8)
-b'tag\xc3\xa5\xc3\xb6\xc3\xb6lt;gt;/tag'
- serialize(elem, encoding=us-ascii)
-b'tag#229;#246;#246;lt;gt;/tag'
- serialize(elem, encoding=iso-8859-1)
-b?xml version='1.0' 
encoding='iso-8859-1'?\ntag\xe5\xf6\xf6lt;gt;/tag
-
- elem.attrib[key] = '\xe5\xf6\xf6'
- elem.text = None
- serialize(elem)
-'tag key=\xe5\xf6\xf6lt;gt; /'
- serialize(elem, encoding=utf-8)
-b'tag key=\xc3\xa5\xc3\xb6\xc3\xb6lt;gt; /'
- serialize(elem, encoding=us-ascii)
-b'tag key=#229;#246;#246;lt;gt; /'
- serialize(elem, encoding=iso-8859-1)
-b'?xml version=\'1.0\' encoding=\'iso-8859-1\'?\ntag 
key=\xe5\xf6\xf6lt;gt; /'
-
-
 def methods():
 r
 Test serialization methods.
@@ -2166,16 +2107,129 @@
 self.assertEqual(self._subelem_tags(e), ['a1'])
 
 
-class StringIOTest(unittest.TestCase):
+class IOTest(unittest.TestCase):
+def test_encoding(self):
+# Test encoding issues.
+elem = ET.Element(tag)
+elem.text = abc
+self.assertEqual(serialize(elem), 'tagabc/tag')
+self.assertEqual(serialize(elem, encoding=utf-8),
+b'tagabc/tag')
+self.assertEqual(serialize(elem, encoding=us-ascii),
+b'tagabc/tag')
+for enc in (iso-8859-1, utf-16, utf-32):
+self.assertEqual(serialize(elem, encoding=enc),
+(?xml version='1.0' encoding='%s'?\n
+ tagabc/tag % enc).encode(enc))
+
+elem = ET.Element(tag)
+elem.text = \\'
+self.assertEqual(serialize(elem), 'taglt;amp;\'gt;/tag')
+self.assertEqual(serialize(elem, encoding=utf-8),
+b'taglt;amp;\'gt;/tag')
+self.assertEqual(serialize(elem, encoding=us-ascii),
+b'taglt;amp;\'gt;/tag')
+for enc in (iso-8859-1, utf-16, utf-32):
+self.assertEqual(serialize(elem, encoding=enc),
+(?xml version='1.0' encoding='%s'?\n
+ taglt;amp;\'gt;/tag % enc).encode(enc))
+
+elem = ET.Element(tag)
+elem.attrib[key] = \\'
+self.assertEqual(serialize(elem), 'tag key=lt;amp;quot;\'gt; 
/')
+self.assertEqual(serialize(elem, encoding=utf-8),
+b'tag key=lt;amp;quot;\'gt; /')
+self.assertEqual(serialize(elem, 

[issue5815] locale.getdefaultlocale() missing corner case

2012-07-07 Thread Greg Roodt

Greg Roodt gro...@gmail.com added the comment:

Bumping this as part of a bug scrub at EuroPython. Is this still an issue? 
Should we fix in docs or in code?

--
nosy: +groodt

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



[issue13248] deprecated in 3.2, should be removed in 3.3

2012-07-07 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


Removed file: http://bugs.python.org/file23929/issue13248_obsolescence_v2.diff

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



[issue13248] deprecated in 3.2, should be removed in 3.3

2012-07-07 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


Added file: http://bugs.python.org/file26301/issue13248_obsolescence_v3.diff

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



[issue14814] Implement PEP 3144 (the ipaddress module)

2012-07-07 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 9b359b6c9a39 by Nick Coghlan in branch 'default':
Issue 14814: Ensure ordering semantics across all 3 entity types in ipaddress 
are consistent and well-defined
http://hg.python.org/cpython/rev/9b359b6c9a39

--

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



[issue14905] zipimport.c needs to support namespace packages when no 'directory' entry exists

2012-07-07 Thread Stephen Thorne

Stephen Thorne step...@thorne.id.au added the comment:

Here is a patch that synthesises the directory names at the point where file 
names are read in. The unit test now passes, and has had the expected failure 
removed.

Patch collaboration with Diarmuid Bourke diarmuidbou...@gmail.com at the 
europython sprint.

--
keywords: +patch
nosy: +jerub
Added file: http://bugs.python.org/file26302/zipimport-issue14905.patch

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



[issue5931] Python runtime name hardcoded in wsgiref.simple_server

2012-07-07 Thread Greg Roodt

Greg Roodt gro...@gmail.com added the comment:

Bumping as part of bug scrub at EuroPython. Patch seems sensible to me. Obvious 
options to me are to either accept patch, close bug or write docs. Bug has not 
seen activity in years, so can probably be closed.

--
nosy: +groodt

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



[issue14814] Implement PEP 3144 (the ipaddress module)

2012-07-07 Thread Serhiy Storchaka

Serhiy Storchaka storch...@gmail.com added the comment:

Should do _version and _max_prefixlen be instance members? Or they can be class 
members as _HEX_DIGITS?

--
nosy: +storchaka

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



[issue14241] io.UnsupportedOperation.__new__(io.UnsupportedOperation) fails

2012-07-07 Thread Benjamin Peterson

Changes by Benjamin Peterson benja...@python.org:


--
resolution: fixed - out of date

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



[issue15271] argparse: repeatedly specifying the same argument ignores the previous ones

2012-07-07 Thread Ionuț Arțăriși

Ionuț Arțăriși io...@artarisi.eu added the comment:

So I was looking into this and it seems that there are (at least) two 
contradicting test cases. When inheriting a parser from two parents, there are 
two different behaviours for positionals and for options.

In the case of positionals, there is this test:

def test_same_argument_name_parents(self):
parents = [self.wxyz_parent, self.z_parent]
parser = ErrorRaisingArgumentParser(parents=parents)
self.assertEqual(parser.parse_args('1 2'.split()),
 NS(w=None, y=None, z='2'))

and this is the context from higher up:

self.wxyz_parent.add_argument('z')
...
self.z_parent.add_argument('z')

So the tests don't expect an error when two parents provide the same argument. 
Instead, the eating up of the first argument (in this case '1') seems to be 
condoned?


When I tried to change the conflict_handler during parent action merging to 
'resolve' I got another test failing:

def test_conflicting_parents(self):
self.assertRaises(
argparse.ArgumentError,
argparse.ArgumentParser,
parents=[self.w_parent, self.wxyz_parent])

context:

self.wxyz_parent.add_argument('--w')
...
self.w_parent.add_argument('--w')

This tests that two parents which provide the exact same option will raise an 
error.


So I think the first test is wrong and should be modified to expect an error in 
the case where two arguments with the same name are provided. Or is there some 
use case where this behaviour makes sense?

--

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



[issue13248] deprecated in 3.2, should be removed in 3.3

2012-07-07 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 5393382c1b1d by Florent Xicluna in branch 'default':
Issue #13248: argparse: Remove obsolete argument version of ArgumentParser.
http://hg.python.org/cpython/rev/5393382c1b1d

New changeset 700f989afbad by Florent Xicluna in branch 'default':
Issue #13248: io: Remove obsolete argument max_buffer_size of BufferedWriter 
and BufferedRWPair.
http://hg.python.org/cpython/rev/700f989afbad

--

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



[issue15271] argparse: repeatedly specifying the same argument ignores the previous ones

2012-07-07 Thread Ionuț Arțăriși

Ionuț Arțăriși io...@artarisi.eu added the comment:

Here's a stab at a patch to consider conflicts between positionals. Right now 
conflict resolution is handled the same as in the case of options.

--
keywords: +patch
Added file: http://bugs.python.org/file26303/disallow_duplicate_positionals.diff

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



  1   2   3   >