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

2013-04-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, it is what I had in mean. Sorry for indistinctness.

As far as you change _fd_converter() it will be good to add also a test for 
float/decimal/fractional fd. Otherwise the patch LGTM.

--

___
Python tracker 

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



[issue17825] Indentation.offset and SyntaxError.offset mismatch

2013-04-24 Thread Florent Xicluna

New submission from Florent Xicluna:

I noticed a difference between computation of column offset for SyntaxError and 
IndentationError (a subclass of SyntaxError).
It is slightly confusing.


def report(exc):
print('lineno %s, offset %s' % (exc.lineno, exc.offset))
raise

try:
exec('except IOError:')
except Exception as e:
report(e)

try:
exec('open(filepath)')
except Exception as e:
report(e)


** OUTPUT **
lineno 1, offset 6
Traceback (most recent call last):
  File "", line 4, in 
  File "", line 2, in 
  File "", line 1
except IOError:
 ^
SyntaxError: invalid syntax

lineno 1, offset 4
Traceback (most recent call last):
  File "", line 4, in 
  File "", line 2, in 
  File "", line 1
open(filepath)
^
IndentationError: unexpected indent


** Analysis **

Case (1): offset is 6, and caret is below column 5 for SyntaxError
Case (2): offset is 4, and caret is below column 4 for IndentationError

--
messages: 187690
nosy: flox
priority: normal
severity: normal
status: open
title: Indentation.offset and SyntaxError.offset mismatch
type: behavior
versions: Python 2.7, Python 3.3

___
Python tracker 

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



[issue12634] Random Remarks in class documentation

2013-04-24 Thread Yongzhi Pan

Yongzhi Pan added the comment:

It may be worth to noting that when creating property attribute using the 
property decorator, we may tend to name the method using nouns, like here:
http://docs.python.org/2/library/functions.html#property

This is when I once overided data attribute with method.

--

___
Python tracker 

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



[issue17826] Setting a side_effect on mock from create_autospec doesn't work

2013-04-24 Thread Michael Foord

New submission from Michael Foord:

>>> from unittest.mock import create_autospec
>>> def f(): pass
... 
>>> m = create_autospec(f)
>>> m.side_effect = [1, 2]
>>> m()
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 3, in f
  File "/compile/py3k-cpython/Lib/unittest/mock.py", line 872, in __call__
return _mock_self._mock_call(*args, **kwargs)
  File "/compile/py3k-cpython/Lib/unittest/mock.py", line 931, in _mock_call
result = next(effect)
TypeError: 'list' object is not an iterator

--
assignee: michael.foord
components: Library (Lib)
messages: 187692
nosy: michael.foord
priority: normal
severity: normal
stage: needs patch
status: open
title: Setting a side_effect on mock from create_autospec doesn't work
type: behavior
versions: Python 3.3, Python 3.4

___
Python tracker 

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



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

2013-04-24 Thread Alex Leach

Alex Leach added the comment:

I don't think I can tell you anything you don't know already, but ...

On Tue, 23 Apr 2013 19:38:18 +0100, Dave Malcolm   
wrote:

> BTW, is that GCC format checking code available anywhere?

Is this what you mean?

http://gcc.gnu.org/viewcvs/gcc/trunk/gcc/c-family/c-format.c?annotate=193304&pathrev=193304

I got taken straight there from the link you sent, above...

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

No idea.. GCC plugins have been around for several years now, though and  
the patch was only introduced in November. If this patch was applied to  
any past GCC distributions, I'm sure someone else would have been  
overwhelmed with warnings and would have mentioned something before now.  
Either way, it looks like the patch is going to stay.

In case you hadn't seen it already, the invoke.texi source file probably  
has the most descriptive changes:-

  
http://gcc.gnu.org/viewcvs/gcc/trunk/gcc/doc/invoke.texi?r1=193304&r2=193303&pathrev=193304

KR,
Alex

--

___
Python tracker 

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



[issue17813] lzma and bz2 decompress methods lack max_size parameter

2013-04-24 Thread Ezio Melotti

Changes by Ezio Melotti :


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

___
Python tracker 

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



[issue10951] gcc 4.6 warnings

2013-04-24 Thread Martin v . Löwis

Martin v. Löwis added the comment:

I don't mind them being backported, in the spirit of supporting newer tools 
well in 2.7. OTOH, I don't see it as necessary, either. 2.7 will eventually be 
phased out, and then it doesn't matter how much warnings it produces.

--

___
Python tracker 

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



[issue16499] CLI option for isolated mode

2013-04-24 Thread yaccz

Changes by yaccz :


--
nosy: +yaccz

___
Python tracker 

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



[issue12238] Readline module loading in interactive mode

2013-04-24 Thread yaccz

Changes by yaccz :


--
nosy: +yaccz

___
Python tracker 

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



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

2013-04-24 Thread Martin v . Löwis

Martin v. Löwis added the comment:

I don't see any point in merely bringing the codecs back, without any 
convenience API to use them. If I need to do

  import codecs
  result = codecs.getencoder("base64").encode(data)

I don't think people would actually prefer this over

  import base64
  result = base64.encodebytes(data)

I't (IMO) only the convenience method (.encode) that made people love these 
codecs.

--

___
Python tracker 

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



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

2013-04-24 Thread Ezio Melotti

Ezio Melotti added the comment:

IMHO it's also a documentation problem.  Once people figure out that they can't 
use encode/decode anymore, it's not immediately clear what they should do 
instead.  By reading the codecs docs[0] it's not obvious that it can be done 
with codecs.getencoder("...").encode/decode, so people waste time finding a 
solution, get annoyed, and blame Python 3 because it removed a simple way to 
use these codecs without making clear what should be used instead.
FWIW I don't care about having to do an extra import, but indeed something 
simpler than codecs.getencoder("...").encode/decode would be nice.

[0]: http://docs.python.org/3/library/codecs.html

--

___
Python tracker 

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



[issue15392] Create a unittest framework for IDLE

2013-04-24 Thread Tomoki Imai

Tomoki Imai added the comment:

I have already posted idle_dev mailing list (and, no one replied :P).

I think, Ezio's suggestion is good if we will work for Python2.
Using unittest.mock and mock to support Python2 and Python3.
My proposal for GSoC is here.
Making very initial version for Python2 and Python3 and,
 complete Python3 version and, backport it in the end.
I'll set backporting for Python2 as optional work.
My main goal is to make unittest for Python3.

--

___
Python tracker 

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



[issue17226] libintl should also check for libiconv

2013-04-24 Thread Alan Hourihane

Alan Hourihane added the comment:

Bumping. How does Jeffrey's patch look folks ?

--

___
Python tracker 

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



[issue17827] Document codecs.encode and codecs.decode

2013-04-24 Thread Nick Coghlan

New submission from Nick Coghlan:

The codecs module has long offered encode() and decode() convenience functions 
(since 2004: http://hg.python.org/cpython-fullhistory/rev/8ea2cb1ec598), but 
they're not documented (except through docstrings). We should fix that.

>From the docstrings:
==
encode(obj, [encoding[,errors]]) -> object

Encodes obj using the codec registered for encoding. encoding defaults
to the default encoding. errors may be given to set a different error
handling scheme. Default is 'strict' meaning that encoding errors raise
a ValueError. Other possible values are 'ignore', 'replace' and
'xmlcharrefreplace' as well as any other name registered with
codecs.register_error that can handle ValueErrors.
==
decode(obj, [encoding[,errors]]) -> object

Decodes obj using the codec registered for encoding. encoding defaults
to the default encoding. errors may be given to set a different error
handling scheme. Default is 'strict' meaning that encoding errors raise
a ValueError. Other possible values are 'ignore' and 'replace'
as well as any other name registered with codecs.register_error that is
able to handle ValueErrors.
==

Note that the difference between the convenience functions in the codecs module 
and the methods on str, bytes and bytearray is that the latter have additional 
type checks to limit their usage to text encodings. str.encode expects a 
str->bytes conversion, while bytes.decode and bytearray.decode both expect the 
codec to produce a str object. codecs.encode and codecs.decode are both 
arbitrary object->object conversions, limited only by whatever the chosen codec 
supports.

--
assignee: docs@python
components: Documentation
messages: 187700
nosy: docs@python, ncoghlan
priority: normal
severity: normal
status: open
title: Document codecs.encode and codecs.decode
versions: Python 2.7, Python 3.3, Python 3.4

___
Python tracker 

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



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

2013-04-24 Thread Nick Coghlan

Nick Coghlan added the comment:

It turns out MAL added the convenience API I'm looking for back in 2004, it 
just didn't get documented, and is hidden behind the "from _codecs import *" 
call in the codecs.py source code:

http://hg.python.org/cpython-fullhistory/rev/8ea2cb1ec598

So, all the way from 2.4 to 2.7 you can write:

  from codecs import encode
  result = encode(data, "base64")

It works in 3.x as well, you just need to add the "_codec" to the end to 
account for the missing aliases:

>>> encode(b"example", "base64_codec")
b'ZXhhbXBsZQ==\n'
>>> decode(b"ZXhhbXBsZQ==\n", "base64_codec")
b'example'

Note that the convenience functions omit the extra checks that are part of the 
methods (although I admit the specific error here is rather quirky):

>>> b"ZXhhbXBsZQ==\n".decode("base64_codec")
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib64/python3.2/encodings/base64_codec.py", line 20, in 
base64_decode
return (base64.decodebytes(input), len(input))
  File "/usr/lib64/python3.2/base64.py", line 359, in decodebytes
raise TypeError("expected bytes, not %s" % s.__class__.__name__)
TypeError: expected bytes, not memoryview

I'me going to create some additional issues, so this one can return to just 
being about restoring the missing aliases.

--

___
Python tracker 

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



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

2013-04-24 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

Just copying some details here about codecs.encode() and
codec.decode() from python-dev:

"""
Just as reminder: we have the general purpose
encode()/decode() functions in the codecs module:

import codecs
r13 = codecs.encode('hello world', 'rot-13')

These interface directly to the codec interfaces, without
enforcing type restrictions. The codec defines the supported
input and output types.
"""

As Nick found, these aren't documented, which is a documentation
bug (I probably forgot to add documentation back then).
They have been in Python since 2004:

http://hg.python.org/cpython-fullhistory/rev/8ea2cb1ec598

These API are nice for general purpose codec work and
that's why I added them back in 2004.

For the codecs in question, it would still be nice to have
a more direct way to access them via methods on the types
that you typically use them with.

--

___
Python tracker 

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



[issue17827] Document codecs.encode and codecs.decode

2013-04-24 Thread Ezio Melotti

Changes by Ezio Melotti :


--
keywords: +easy
nosy: +ezio.melotti
stage:  -> needs patch
type:  -> enhancement

___
Python tracker 

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



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

2013-04-24 Thread Ezio Melotti

Ezio Melotti added the comment:

> It works in 3.x as well, you just need to add the "_codec" to the end
> to account for the missing aliases:

FTR this is because of ff1261a14573 (see #10807).

--

___
Python tracker 

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



[issue17825] Indentation.offset and SyntaxError.offset mismatch

2013-04-24 Thread R. David Murray

R. David Murray added the comment:

Well, that would be because the invalid indent is detected when the 'o' is 
encountered, whereas the invalid syntax is detected when the 't' completes the 
keyword 'except'.

I don't think there is a bug here.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue17828] More informative error handling when encoding and decoding

2013-04-24 Thread Nick Coghlan

New submission from Nick Coghlan:

Passing the wrong types to codecs can currently lead to rather confusing 
exceptions, like:


>>> b"ZXhhbXBsZQ==\n".decode("base64_codec")
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib64/python3.2/encodings/base64_codec.py", line 20, in 
base64_decode
return (base64.decodebytes(input), len(input))
  File "/usr/lib64/python3.2/base64.py", line 359, in decodebytes
raise TypeError("expected bytes, not %s" % s.__class__.__name__)
TypeError: expected bytes, not memoryview

>>> codecs.decode("example", "utf8")
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib64/python3.2/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
TypeError: 'str' does not support the buffer interface


This situation could be improved by having the affected APIs use the exception 
chaining system to wrap these errors in a more informative exception that also 
display information on the codec involved. Note that UnicodeEncodeError and 
UnicodeDecodeError are not appropriate, as those are specific to text encoding 
operations, while these new wrappers will apply to arbitrary codecs, regardless 
of whether or not they use the unicode error handlers. Furthermore, for 
backwards compatibility with existing exception handling, it is probably 
necessary to limit ourselves to specific exception types and ensure that the 
wrapper exceptions are subclasses of those types.

These new wrappers would have __cause__ set to the exception raised by the 
codec, but emit a message more along the lines of the following:

==
codecs.DecodeTypeError: encoding='utf8', details="TypeError: 'str' does not 
support the buffer interface"
==

Wrapping TypeError and ValueError should cover most cases, which would mean 
four new exception types in the codecs module:

Raised by codecs.decode, bytes.decode and bytearray.decode:
* codecs.DecodeTypeError
* codecs.DecodeValueError

Raised by codecs.encode, str.encode:
* codecs.EncodeTypeError
* codecs.EncodeValueError

Instances of UnicodeError wouldn't be wrapped, since they already contain codec 
information.

--
components: Library (Lib)
messages: 187704
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: More informative error handling when encoding and decoding
versions: Python 3.4

___
Python tracker 

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



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

2013-04-24 Thread Nick Coghlan

Nick Coghlan added the comment:

Issue 17827 covers adding documentation for codecs.encode and codecs.decode

Issue 17828 covers adding exception handling improvements for all encoding and 
decoding operations

--

___
Python tracker 

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



[issue17828] More informative error handling when encoding and decoding

2013-04-24 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti
stage:  -> needs patch
type:  -> enhancement

___
Python tracker 

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



[issue17828] More informative error handling when encoding and decoding

2013-04-24 Thread Nick Coghlan

Nick Coghlan added the comment:

There may also be some specific improvement to be made to str.encode, 
bytes.decode and bytearray.decode in relation to the additional type checks 
they do to enforce the appropriate input and output types (see the bizarre 
"expected bytes, not memoryview" example)

--

___
Python tracker 

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



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

2013-04-24 Thread Nick Coghlan

Nick Coghlan added the comment:

For me, the killer argument *against* a method based API is memoryview (and, 
equivalently, array.array). It should be possible to use those as inputs for 
the bytes->bytes codecs, and once you endorse codecs.encode and codecs.decode 
for that use case, it's hard to justify adding more exclusive methods to the 
already broad bytes and bytearray APIs (particularly given the problems with 
conveying direction of conversion unambiguously).

By contrast, I think "the codecs functions are generic while the str, bytes and 
bytearray methods are specific to text encodings" is something we can explain 
fairly easily, thus allowing the aliases mentioned in this issue to be restored 
for use with the codecs module functions. To avoid reintroducing the quirky 
errors described in issue 10807, the encoding and decoding error messages 
should first be improved as discussed in issue 17828.

--
dependencies: +More informative error handling when encoding and decoding

___
Python tracker 

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



[issue15106] Potential Bug in errors.c

2013-04-24 Thread Ezio Melotti

Changes by Ezio Melotti :


--
components: +Interpreter Core -None
nosy: +ezio.melotti, serhiy.storchaka
versions: +Python 3.4 -Python 3.3

___
Python tracker 

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



[issue17827] Document codecs.encode and codecs.decode

2013-04-24 Thread Florent Xicluna

Changes by Florent Xicluna :


--
nosy: +flox

___
Python tracker 

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



[issue17828] More informative error handling when encoding and decoding

2013-04-24 Thread Florent Xicluna

Changes by Florent Xicluna :


--
nosy: +flox

___
Python tracker 

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



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

2013-04-24 Thread Dave Malcolm

Dave Malcolm added the comment:

On Wed, 2013-04-24 at 10:48 +, Alex Leach wrote:
> Alex Leach added the comment:
> 
> I don't think I can tell you anything you don't know already, but ...
> 
> On Tue, 23 Apr 2013 19:38:18 +0100, Dave Malcolm   
> wrote:
> 
> > BTW, is that GCC format checking code available anywhere?
> 
> Is this what you mean?
> 
> http://gcc.gnu.org/viewcvs/gcc/trunk/gcc/c-family/c-format.c?annotate=193304&pathrev=193304
> 
> I got taken straight there from the link you sent, above...

[snip]

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

Sorry that I was a bit vague.

GCC's __attribute((format(i, j, k))__ takes 3 parameters.  The first
parameter is a string code naming the mini-language expressing valid
format strings and their mapping to the types that follow in the
varargs.

I was asking about the string code "PyArg_ParseTuple" used in the
CPython configure test: the link above is the implementation of GCC's
builtin format string codes: and AFAIK the only ones it "knows" about
there are the ones in 
   static const format_kind_info format_types_orig[] =
in the above file (lines 808-873 of gcc/c-family/c-format.c)

which are codes for printf, fprintf, various internal gcc APIs,
NSString, scanf, strftime, and strfmon.

i.e. I believe that the "PyArg_ParseTuple" code is from some 3rd party
patch to GCC that never made it into GCC mainline.  Does this code still
exist anywhere?

[Not that this has any bearing on this bug and the proposed patch: I'm a
big fan of compiler attributes, and wouldn't want to remove them from
the API.]

Hope the above makes sense

--

___
Python tracker 

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



[issue17829] csv.Sniffer.snif doesn't set up the dialect properly for a csv created with dialect=csv.excel_tab and containing quote (") char

2013-04-24 Thread Ghislain Hivon

New submission from Ghislain Hivon:

When sniffing the dialect of a file created with the csv module with 
dialect=csv.excel_tab and one of the row contain a quote ("), the delimiter is 
set to ' ' instead of '\t'.

--
files: csv_sniffing_excel_tab.py
messages: 187709
nosy: GhislainHivon
priority: normal
severity: normal
status: open
title: csv.Sniffer.snif doesn't set up the dialect properly for a csv created 
with dialect=csv.excel_tab and containing quote (") char
type: behavior
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file30001/csv_sniffing_excel_tab.py

___
Python tracker 

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



[issue17830] Fix test_keyword on Windows, clean up addCleanup

2013-04-24 Thread Zachary Ware

New submission from Zachary Ware:

(Copying the nosy list from issue9607)

test_keyword has a couple of failures on Windows, all due to newline 
issues--see for example 
http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/1845/steps/test/logs/stdio.
  

test_keywords_py_without_markers_produces_error looks for a line ending with 
'\n', but Windows ends it with '\r\n'.  

test_real_grammar_and_keyword_file, on the other hand, doesn't fail on my 
machine, due to the hg eol extension being enabled, but the cause of failure is 
filecmp.cmp working only in binary mode and paying no attention to line endings.

The attached patch fixes both failures, with and without the eol extension, by 
using a private _compare_files function instead of filecmp.cmp.  The private 
function makes use of universal newlines to avoid issue.  Also, all instances 
of ``self.addCleanup(lambda ...)`` have had the lambda removed as suggested by 
Éric Araujo in msg187567.

--
components: Tests
files: test_keyword_cleanup.diff
keywords: patch
messages: 187710
nosy: benjamin.peterson, eric.araujo, gregmalcolm, r.david.murray, zach.ware
priority: normal
severity: normal
status: open
title: Fix test_keyword on Windows, clean up addCleanup
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file30002/test_keyword_cleanup.diff

___
Python tracker 

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



[issue16316] Support xz compression in mimetypes module

2013-04-24 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag
resolution: fixed -> 
Added file: http://bugs.python.org/file30003/issue16316_27.diff

___
Python tracker 

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



[issue17831] urllib.URLopener.open breaks ActiveDirectory user

2013-04-24 Thread Nataly Glazyrina

New submission from Nataly Glazyrina:

When I try to open file from ftp by path like 
'ftp://domain\user:passw...@my.path'

line 
'fullurl = quote(fullurl, safe="%/:=&?~#+!$,;'@()*[]|")'

changes 'domain\user' to 'domain%5Cuser' and brokes username.
As a result - error 530 on login to ftp.

--
messages: 187711
nosy: Nataly.Glazyrina
priority: normal
severity: normal
status: open
title: urllib.URLopener.open breaks ActiveDirectory user

___
Python tracker 

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



[issue17831] urllib.URLopener.open breaks ActiveDirectory user

2013-04-24 Thread Nataly Glazyrina

Changes by Nataly Glazyrina :


--
components: +Library (Lib)
versions: +Python 2.7

___
Python tracker 

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



[issue17832] pythonrun.c:_print_total_refs missing prototype

2013-04-24 Thread David Edelsohn

Changes by David Edelsohn :


--
components: Interpreter Core
nosy: David.Edelsohn
priority: normal
severity: normal
status: open
title: pythonrun.c:_print_total_refs missing prototype
type: compile error
versions: Python 3.4

___
Python tracker 

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



[issue17831] urllib.URLopener.open breaks ActiveDirectory user

2013-04-24 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Can you give the full snippet that you are trying. I assume you are using 
urllib2? Also If you give the same URL to your other clients like browser, does 
the resolution happen properly?

--
nosy: +orsenthil

___
Python tracker 

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



[issue17832] pythonrun.c:_print_total_refs missing prototype

2013-04-24 Thread Antoine Pitrou

New submission from Antoine Pitrou:

Can you tell us a bit more about the compile / build options you used?

--
nosy: +pitrou

___
Python tracker 

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



[issue17832] pythonrun.c:_print_total_refs missing prototype

2013-04-24 Thread David Edelsohn

David Edelsohn added the comment:

A build warning from the PowerLinux buildbot

http://buildbot.python.org/all/builders/PPC64%20PowerLinux%203.x/builds/3/steps/compile/logs/stdio

gcc -pthread -c -Wno-unused-result -g -O0 -Wall -Wstrict-prototypes -m64 -m64   
-I. -IInclude -I./Include-DPy_BUILD_CORE -o Python/pythonrun.o 
Python/pythonrun.c
Python/pythonrun.c:39:6: warning: function declaration isn’t a prototype 
[-Wstrict-prototypes]

--

___
Python tracker 

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



[issue17832] pythonrun.c:_print_total_refs missing prototype

2013-04-24 Thread David Edelsohn

David Edelsohn added the comment:

CPython configured with --with-pydebug

--

___
Python tracker 

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



[issue17832] pythonrun.c:_print_total_refs missing prototype

2013-04-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6eacc6c134a5 by Antoine Pitrou in branch 'default':
Issue #17832: fix a compilation warning about a function prototype.
http://hg.python.org/cpython/rev/6eacc6c134a5

--
nosy: +python-dev

___
Python tracker 

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



[issue17832] pythonrun.c:_print_total_refs missing prototype

2013-04-24 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ah, right. This is fixed now, thanks for reporting.

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

___
Python tracker 

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



[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails

2013-04-24 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Test broken on Windows:

==
FAIL: test_exceptions_propagate (test.test_py_compile.PyCompileTests)
--
Traceback (most recent call last):
  File 
"C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_py_compile.py", 
line 66, in test_exceptions_propagate
py_compile.compile(self.source_path, self.pyc_path)
AssertionError: OSError not raised

http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/1850/steps/test/logs/stdio

--
status: closed -> open

___
Python tracker 

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



[issue9607] Test file 'test_keyword.py' submission for use with keyword.py

2013-04-24 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Tests broken under Windows:


==
FAIL: test_keywords_py_without_markers_produces_error 
(test.test_keyword.TestKeywordGeneration)
--
Traceback (most recent call last):
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_keyword.py", 
line 122, in test_keywords_py_without_markers_produces_error
self.assertEqual(stderr, b'target does not contain format markers\n')
AssertionError: b'target does not contain format markers\r\n' != b'target does 
not contain format markers\n'

==
FAIL: test_real_grammar_and_keyword_file 
(test.test_keyword.TestKeywordGeneration)
--
Traceback (most recent call last):
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_keyword.py", 
line 63, in test_real_grammar_and_keyword_file
self.assertTrue(filecmp.cmp(KEYWORD_FILE, TEST_PY_FILE))
AssertionError: False is not true

http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/1850/steps/test/logs/stdio

--
assignee:  -> r.david.murray
nosy: +pitrou
status: closed -> open

___
Python tracker 

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



[issue17833] test_gdb broken PPC64 Linux

2013-04-24 Thread David Edelsohn

New submission from David Edelsohn:

Verify that "py-bt" indicates threads that are waiting for the GIL ... FAIL

FAIL: test_threads (test.test_gdb.PyBtTests)
Verify that "py-bt" indicates threads that are waiting for the GIL
--
Traceback (most recent call last):
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/test/test_gdb.py",
 line 717, in test_threads
self.assertIn('Waiting for the GIL', gdb_output)
AssertionError: 'Waiting for the GIL' not found in 'Breakpoint 1 at 0x100ee8b0: 
file Python/bltinmodule.c, line 967.\n[Thread debugging using libthread_db 
enabled]\nUsing host libthread_db library "/lib64/libthread_db.so.1".\n[New 
Thread 0x3fffb14af200 (LWP 1699)]\n[New Thread 0x3fffb0caf200 (LWP 1703)]\n[New 
Thread 0x3fffabfff200 (LWP 1711)]\n[New Thread 0x3fffab7ff200 (LWP 
1730)]\n\nBreakpoint 1, builtin_id (self=, 
v=42) at Python/bltinmodule.c:967\n967\treturn 
PyLong_FromVoidPtr(v);\n\nThread 5 (Thread 0x3fffab7ff200 (LWP 
1730)):\nTraceback (most recent call first):\n  File "", line 10, in 
run\n  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/threading.py",
 line 642, in _bootstrap_inner\nself.run()\n  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/threading.py",
 line 619, in _bootstrap\nself._bootstrap_inner()\n\nThread 4 (Thread 
0x3fffabfff200 (LWP 1711)):\nTraceback (
 most recent call first):\n  File "", line 10, in run\n  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/threading.py",
 line 642, in _bootstrap_inner\nself.run()\n  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/threading.py",
 line 619, in _bootstrap\nself._bootstrap_inner()\n\nThread 3 (Thread 
0x3fffb0caf200 (LWP 1703)):\nTraceback (most recent call first):\n  File 
"", line 10, in run\n  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/threading.py",
 line 642, in _bootstrap_inner\nself.run()\n  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/threading.py",
 line 619, in _bootstrap\nself._bootstrap_inner()\n\nThread 2 (Thread 
0x3fffb14af200 (LWP 1699)):\nTraceback (most recent call first):\n  File 
"", line 10, in run\n  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/threading.py",
 line 642, in _bootstr
 ap_inner\nself.run()\n  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/threading.py",
 line 619, in _bootstrap\nself._bootstrap_inner()\n\nThread 1 (Thread 
0x8074e46670 (LWP 1616)):\nTraceback (most recent call first):\n  File 
"", line 18, in \n'

--
components: Tests
messages: 187720
nosy: David.Edelsohn
priority: normal
severity: normal
status: open
title: test_gdb broken PPC64 Linux
versions: Python 3.4

___
Python tracker 

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



[issue9607] Test file 'test_keyword.py' submission for use with keyword.py

2013-04-24 Thread Benjamin Peterson

Benjamin Peterson added the comment:

See #17830

--
status: open -> closed

___
Python tracker 

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



[issue17833] test_gdb broken PPC64 Linux

2013-04-24 Thread Dave Malcolm

Dave Malcolm added the comment:

Is this an optimized or a debug build?  (aka --with-pydebug)

What are the optimization flags passed to the C compiler?

--
nosy: +dmalcolm

___
Python tracker 

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



[issue17834] Add Heap (and DynamicHeap) classes to heapq module

2013-04-24 Thread Daniel Wong

New submission from Daniel Wong:

heapq already provides a bunch of functions for manipulating lists that 
preserve (or create) a heap invariant. My change adds two classes for 
representing heaps. These classes ensure that operations that violate the heap 
invariant are not possible (through the public interface). The also allow 
customization via subclassing.

--
components: Library (Lib)
files: heap.patch
hgrepos: 185
keywords: patch
messages: 187723
nosy: allyourcode
priority: normal
severity: normal
status: open
title: Add Heap (and DynamicHeap) classes to heapq module
type: enhancement
Added file: http://bugs.python.org/file30004/heap.patch

___
Python tracker 

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



[issue17833] test_gdb broken PPC64 Linux

2013-04-24 Thread David Edelsohn

David Edelsohn added the comment:

Unoptimized debug build (configured using --with-pydebug). Buildbot test 
failure running on gcc110 in GCC Compile Farm (running Fedora).

gcc -pthread -c -Wno-unused-result -g -O0 -Wall -Wstrict-prototypes -m64

--

___
Python tracker 

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



[issue17835] test_io broken on PPC64 Linux

2013-04-24 Thread David Edelsohn

New submission from David Edelsohn:

Unoptimized debug build (configured using --with-pydebug).
gcc -pthread -c -Wno-unused-result -g -O0 -Wall -Wstrict-prototypes -m64

test_interrupted_write_retry_buffered (test.test_io.CSignalsTest) ... ERROR
test_interrupted_write_retry_text (test.test_io.CSignalsTest) ... ERROR
test_interrupted_write_retry_buffered (test.test_io.PySignalsTest) ... ERROR
test_interrupted_write_retry_text (test.test_io.PySignalsTest) ... ERROR

==
ERROR: test_interrupted_write_retry_buffered (test.test_io.CSignalsTest)
--
Traceback (most recent call last):
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/test/test_io.py",
 line 3219, in test_interrupted_write_retry_buffered
self.check_interrupted_write_retry(b"x", mode="wb")
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/test/test_io.py",
 line 3203, in check_interrupted_write_retry
t.join()
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/threading.py",
 line 738, in join
raise RuntimeError("cannot join thread before it is started")
RuntimeError: cannot join thread before it is started

==
ERROR: test_interrupted_write_retry_text (test.test_io.CSignalsTest)
--
Traceback (most recent call last):
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/test/test_io.py",
 line 3222, in test_interrupted_write_retry_text
self.check_interrupted_write_retry("x", mode="w", encoding="latin1")
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/test/test_io.py",
 line 3203, in check_interrupted_write_retry
t.join()
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/threading.py",
 line 738, in join
raise RuntimeError("cannot join thread before it is started")
RuntimeError: cannot join thread before it is started

==
ERROR: test_interrupted_write_retry_buffered (test.test_io.PySignalsTest)
--
Traceback (most recent call last):
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/test/test_io.py",
 line 3219, in test_interrupted_write_retry_buffered
self.check_interrupted_write_retry(b"x", mode="wb")
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/test/test_io.py",
 line 3203, in check_interrupted_write_retry
t.join()
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/threading.py",
 line 738, in join
raise RuntimeError("cannot join thread before it is started")
RuntimeError: cannot join thread before it is started

==
ERROR: test_interrupted_write_retry_text (test.test_io.PySignalsTest)
--
Traceback (most recent call last):
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/test/test_io.py",
 line 3222, in test_interrupted_write_retry_text
self.check_interrupted_write_retry("x", mode="w", encoding="latin1")
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/test/test_io.py",
 line 3203, in check_interrupted_write_retry
t.join()
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/threading.py",
 line 738, in join
raise RuntimeError("cannot join thread before it is started")
RuntimeError: cannot join thread before it is started

--
components: Tests
messages: 187725
nosy: David.Edelsohn
priority: normal
severity: normal
status: open
title: test_io broken on PPC64 Linux
versions: Python 3.4

___
Python tracker 

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



[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails

2013-04-24 Thread Brett Cannon

Brett Cannon added the comment:

Does os.chmod(self.directory, stat.S_IREAD) not work on directories on Windows?

--

___
Python tracker 

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



[issue17835] test_io broken on PPC64 Linux

2013-04-24 Thread Antoine Pitrou

Antoine Pitrou added the comment:

What does the following say for you?

>>> import fcntl, os
>>> r, w = os.pipe()
>>> fcntl.fcntl(w, 1032)

--
nosy: +pitrou

___
Python tracker 

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



[issue17826] Setting a side_effect on mock from create_autospec doesn't work

2013-04-24 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue17835] test_io broken on PPC64 Linux

2013-04-24 Thread David Edelsohn

David Edelsohn added the comment:

>>> import fcntl, os
>>> r, w = os.pipe()
>>> fcntl.fcntl(w, 1032)
1048576

--

___
Python tracker 

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



[issue17835] test_io broken on PPC64 Linux

2013-04-24 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ah, right. That number is the pipe buffer size (1032 is F_GETPIPE_SZ).

It's 65536 here, so when the test tries to write 1 million bytes on a pipe, the 
write blocks as expected (you can read the comments to understand why the test 
is doint that). But with a 1 MiB buffer size, the write doesn't block and 
therefore doesn't have to wait for the auxiliary thread to start and read from 
the pipe buffer.

Something else, what does the following say:

>>> r, w = os.pipe()
>>> fcntl.fcntl(r, 1031, 1000)

--
nosy: +neologix

___
Python tracker 

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



[issue17833] test_gdb broken PPC64 Linux

2013-04-24 Thread Dave Malcolm

Dave Malcolm added the comment:

Thanks.  I can't see from that output what's going wrong.

Can you apply the following patch, which (I hope) will print more detailed info 
where the failure happens.

--
keywords: +patch
Added file: http://bugs.python.org/file30005/find-more-information.patch

___
Python tracker 

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



[issue17835] test_io broken on PPC64 Linux

2013-04-24 Thread David Edelsohn

David Edelsohn added the comment:

>>> r, w = os.pipe()
>>> fcntl.fcntl(r, 1031, 1000)
65536

--

___
Python tracker 

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



[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails

2013-04-24 Thread Tim Golden

Tim Golden added the comment:

Essentially: no. The permissions system in Windows is very different 
from that of Unix. The CRT attempts to mimic it, but for things like 
read-onlyness, it does so by setting the (old-style DOS) attributes. 
These are only just meaningful for files, and are meaningless for 
directories. (Or, strictly, have a different meaning since ISTR the 
Explorer shell uses the readonly bit to indicate that a directory has 
some special significance).

--
nosy: +tim.golden

___
Python tracker 

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



[issue17833] test_gdb broken PPC64 Linux

2013-04-24 Thread David Edelsohn

Changes by David Edelsohn :


Added file: http://bugs.python.org/file30006/test_gdb.out

___
Python tracker 

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



[issue17833] test_gdb broken PPC64 Linux

2013-04-24 Thread Dave Malcolm

Dave Malcolm added the comment:

Looking at test_gdb.out, the issue is that the threads waiting for the GIL have 
e.g. this at the top of their backtrace:

Thread 2 (Thread 0x3fffb14af200 (LWP 37119)):
#0  0x008075181ea8 in __pthread_cond_timedwait (cond=0x103ea140 , 
mutex=0x103ea170 , abstime=0x3fffb14abf68) at 
pthread_cond_timedwait.c:167
#1  0x100f59f8 in PyCOND_TIMEDWAIT (cond=0x103ea140 , 
mut=0x103ea170 , us=5000) at 
/home/dje/src/cpython/Python/condvar.h:103
#2  0x100f5ffc in take_gil (tstate=0x1043b020) at 
/home/dje/src/cpython/Python/ceval_gil.h:224

i.e. the topmost frame has name "__pthread_cond_timedwait" (two leading 
underscores.

However, the gdb hooks (in Tools/gdb/libpython.py) have:

def is_waiting_for_gil(self):
'''Is this frame waiting on the GIL?'''
# This assumes the _POSIX_THREADS version of Python/ceval_gil.h:
name = self._gdbframe.name()
if name:
return name.startswith('pthread_cond_timedwait')

i.e. no underscores, hence that name.startswith conditional doesn't match.

--

___
Python tracker 

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



[issue17833] test_gdb broken PPC64 Linux

2013-04-24 Thread Dave Malcolm

Dave Malcolm added the comment:

Can you try this candidate fix?

--
Added file: http://bugs.python.org/file30007/possible-fix.patch

___
Python tracker 

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



[issue17833] test_gdb broken PPC64 Linux

2013-04-24 Thread David Edelsohn

David Edelsohn added the comment:

__pthread_cond_timedwait with underscore may be a general GLibc change.

The patch fixes the failure.

--

___
Python tracker 

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



[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails

2013-04-24 Thread Brett Cannon

Brett Cannon added the comment:

Thanks for the info, Tim. I'll add a skip decorator to not run under Windows 
then.

--
resolution: fixed -> 
stage: committed/rejected -> needs patch

___
Python tracker 

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



[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails

2013-04-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0803a28dca3c by Brett Cannon in branch 'default':
Issue #17244: Windows doesn't let you set permissions on directories.
http://hg.python.org/cpython/rev/0803a28dca3c

--

___
Python tracker 

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



[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails

2013-04-24 Thread Brett Cannon

Changes by Brett Cannon :


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

___
Python tracker 

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



[issue17244] py_compile.compile() fails to raise exceptions when writing of target file fails

2013-04-24 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
stage: needs patch -> committed/rejected

___
Python tracker 

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



[issue17835] test_io broken on PPC64 Linux

2013-04-24 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, what does the following patch do for you:

diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -3168,7 +3168,7 @@ class SignalsTest(unittest.TestCase):
 select = support.import_module("select")
 # A quantity that exceeds the buffer size of an anonymous pipe's
 # write end.
-N = 1024 * 1024
+N = 1024 * 1024 + 1
 r, w = os.pipe()
 fdopen_kwargs["closefd"] = False
 # We need a separate thread to read from the pipe and allow the
@@ -3191,6 +3191,12 @@ class SignalsTest(unittest.TestCase):
 signal.signal(signal.SIGALRM, alarm1)
 try:
 wio = self.io.open(w, **fdopen_kwargs)
+if sys.platform.startswith('linux') and fcntl is not None:
+# Issue #17835: try to limit pipe size using F_SETPIPE_SZ
+pipe_size = fcntl.fcntl(w, 1031, 4096)
+if pipe_size >= N:
+self.skipTest("can't set pipe size to less than %d bytes: 
%d"
+  % (N, pipe_size))
 signal.alarm(1)
 # Expected behaviour:
 # - first raw write() is partial (because of the limited pipe 
buffer

--

___
Python tracker 

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



[issue17835] test_io broken on PPC64 Linux

2013-04-24 Thread Charles-François Natali

Charles-François Natali added the comment:

Why not simply increase the amount of data written instead of limiting
the pipe size?

By the way, there's support.PIPE_MAX_SIZE for that purpose.

--

___
Python tracker 

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



[issue17835] test_io broken on PPC64 Linux

2013-04-24 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Why not simply increase the amount of data written instead of limiting
> the pipe size?

Hmm, indeed :-)

> By the way, there's support.PIPE_MAX_SIZE for that purpose.

Hardwired to 3 MB. I wonder if it may broken soon.

--

___
Python tracker 

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



[issue17835] test_io broken on PPC64 Linux

2013-04-24 Thread David Edelsohn

David Edelsohn added the comment:

The patch limiting the pipe size resolves the test_io failure. Either of the 
approaches should work.

--

___
Python tracker 

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



[issue17835] test_io broken on PPC64 Linux

2013-04-24 Thread Charles-François Natali

Charles-François Natali added the comment:

>> Why not simply increase the amount of data written instead of limiting
>> the pipe size?
>
> Hmm, indeed :-)
>
>> By the way, there's support.PIPE_MAX_SIZE for that purpose.
>
> Hardwired to 3 MB. I wonder if it may broken soon.

On Linux, for non root users, it's limited to 1048576, and can be set
to /proc/sys/fs/pipe-max-size.
After a quick look at the kernel code, there's apparently no max value
(it must be a multiple of the page size, though).

I think 3MB should be more than enough, so I suggest to update the
test to use support.PIPE_MAX_SIZE.
If this breaks up again, then we could set PIPE_MAX_SIZE dynamically, like:

r, w = os.pipe()
PIPE_MAX_SIZE = 2 * fcntl.fcntl(w, 1032)

But F_GETPIPE_SZ is Linux only, and quite recent (since 2.6.35 apparently).

--

___
Python tracker 

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



[issue17835] test_io broken on PPC64 Linux

2013-04-24 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, here is a new patch updating PIPE_MAX_SIZE with a proper value if possible.

--
keywords: +patch
Added file: http://bugs.python.org/file30008/pipe_max_size.patch

___
Python tracker 

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



[issue17835] test_io broken on PPC64 Linux

2013-04-24 Thread David Edelsohn

David Edelsohn added the comment:

The PIPE_MAX_SIZE patch also fixes the failure.

--

___
Python tracker 

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



[issue17835] test_io broken on PPC64 Linux

2013-04-24 Thread Charles-François Natali

Charles-François Natali added the comment:

> Ok, here is a new patch updating PIPE_MAX_SIZE with a proper value if
> possible.

The patch is correct, however I think it's a bit overkill, especially
since it's Linux only.
Choosing a fixed large value (3 or 4 MB) just consumes a bit more
memory and should be more than enough.

Anyway, this problem also affects all versions from 2.7, so
PIPE_MAX_SIZE should be backported there.

--

___
Python tracker 

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



[issue17835] test_io broken on PPC64 Linux

2013-04-24 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> The patch is correct, however I think it's a bit overkill, especially
> since it's Linux only.
> Choosing a fixed large value (3 or 4 MB) just consumes a bit more
> memory and should be more than enough.

Ok, so let's say 4MB + 1 then.

--

___
Python tracker 

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



[issue17835] test_io broken on PPC64 Linux

2013-04-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4b4ed1e11fd0 by Antoine Pitrou in branch '3.3':
Issue #17835: Fix test_io when the default OS pipe buffer size is larger than 
one million bytes.
http://hg.python.org/cpython/rev/4b4ed1e11fd0

New changeset de35eae9048a by Antoine Pitrou in branch 'default':
Issue #17835: Fix test_io when the default OS pipe buffer size is larger than 
one million bytes.
http://hg.python.org/cpython/rev/de35eae9048a

New changeset 09811ecd5df1 by Antoine Pitrou in branch '2.7':
Issue #17835: Fix test_io when the default OS pipe buffer size is larger than 
one million bytes.
http://hg.python.org/cpython/rev/09811ecd5df1

--
nosy: +python-dev

___
Python tracker 

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



[issue17835] test_io broken on PPC64 Linux

2013-04-24 Thread Antoine Pitrou

Antoine Pitrou added the comment:

This should be fixed now. David, please re-open if the failure still occurs.

--
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed
versions: +Python 2.7, Python 3.3

___
Python tracker 

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



[issue17834] Add Heap (and DynamicHeap) classes to heapq module

2013-04-24 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +rhettinger
stage:  -> patch review
versions: +Python 3.4

___
Python tracker 

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



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

2013-04-24 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +r.david.murray, serhiy.storchaka

___
Python tracker 

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



[issue17834] Add Heap (and DynamicHeap) classes to heapq module

2013-04-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

queue.PriorityQueue?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue17834] Add Heap (and DynamicHeap) classes to heapq module

2013-04-24 Thread Daniel Wong

Daniel Wong added the comment:

Hey Serhiy,

Are you suggesting that I put my new classes in a new module and rename them? I 
think it'd be better to keep them in heapq, unless someone intended to add more 
classes to your proposed queue module, because heap functionality would be 
spread between two modules (heapq and queue).

One could argue that these classes could go in the collections module, but I 
think sticking to heapq is best.

--

___
Python tracker 

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



[issue17836] multiprocessing exceptions with useful traceback

2013-04-24 Thread Andres Riancho

New submission from Andres Riancho:

In pool.py, the worker function reads as follows:

http://svn.python.org/view/python/trunk/Lib/multiprocessing/pool.py?view=markup
"""
68  job, i, func, args, kwds = task
69  try:
70  result = (True, func(*args, **kwds))
71  except Exception, e:
72  result = (False, e)
...
488 if self._success:
489 return self._value
490 else:
491 raise self._value
"""

If an exception is raised in the function you sent to the pool, the exception 
you get has "raise self._value" as the last line; which is correct but useless 
for debugging.

mp_exception_bug.py reproduces this error. This is the output:

"""
Traceback (most recent call last):
  File "mp_exception_bug.py", line 8, in 
print p.map(f, [1,2,3])
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 227, in map
return self.map_async(func, iterable, chunksize).get()
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 528, in get
raise self._value
NameError: global name 'y' is not defined
"""

As you can imagine, "NameError: global name 'y' is not defined" is not enough 
in complex projects.

If we apply some changes to the pool.py we could get something similar to this:

"""
Traceback (most recent call last):
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 98, in worker
result = (True, func(*args, **kwds))
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 67, in mapstar
return map(*args)
  File "mp_exception_bug.py", line 4, in f
return x*y
NameError: global name 'y' is not defined

Traceback (most recent call last):
  File "mp_exception_bug.py", line 8, in 
print p.map(f, [1,2,3])
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 231, in map
return self.map_async(func, iterable, chunksize).get()
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 535, in get
raise self._value[0]
NameError: global name 'y' is not defined
"""

The patch is simple but ugly:

"""
> import sys
> import traceback
72c100,102
< result = (False, e)
---
> exc_info = sys.exc_info()
> tb_string = traceback.format_exc(exc_info[2])
> result = (False, (e, tb_string))
491c532,535
< raise self._value
---
> # Do something with the exception here, the simplest (but ugliest)
> # thing to do is to simply print it to the console
> print self._value[1]
> raise self._value[0]
"""

Note that I tried to replace the "raise self._value[0]" with a raise with three 
parameters, being the last one the traceback we get using "exc_info = 
sys.exc_info()" but sadly it is not possible to pickle tracebacks.

I understand that printing is not the best thing to do here, but I wanted to 
get this discussion started and come to a real solution.

Thanks

--
components: Library (Lib)
files: mp_exception_bug.py
messages: 187751
nosy: Andres.Riancho
priority: normal
severity: normal
status: open
title: multiprocessing exceptions with useful traceback
versions: Python 3.5
Added file: http://bugs.python.org/file30009/mp_exception_bug.py

___
Python tracker 

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



[issue17836] multiprocessing exceptions with useful traceback

2013-04-24 Thread Ned Deily

Ned Deily added the comment:

(FYI, cpython source is no longer maintained in svn.python.org; the browser 
link you provided is out-of-date.  Current source for the 2.7 branch can be 
viewed here: http://hg.python.org/cpython/file/2.7/)

--
nosy: +ned.deily, sbt
versions: +Python 3.4 -Python 3.5

___
Python tracker 

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



[issue17836] multiprocessing exceptions with useful traceback

2013-04-24 Thread Ned Deily

Changes by Ned Deily :


--
nosy:  -ned.deily

___
Python tracker 

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



[issue17834] Add Heap (and DynamicHeap) classes to heapq module

2013-04-24 Thread R. David Murray

R. David Murray added the comment:

Serhiy is pointing you to an existing use of heapq in the stdlib.  I'm not 
quite sure what his intent is in pointing it out, though it *might* be to point 
out that heapq is a primitive, and PriorityQueue already implements a 
subclassable class using it.

I don't personally have any opinion either way on the utility of your proposed 
classes.  I've only ever used PriorityQueue once :)

--
nosy: +r.david.murray

___
Python tracker 

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



[issue9849] Argparse needs better error handling for nargs

2013-04-24 Thread paul j3

paul j3 added the comment:

This is a revision of yesterday's patch.  It includes a couple of test cases 
that check that parser, groups, and exclusive groups all produce the error 
message.

I also changed the metavar tuple case to return an ArgumentError, and changed 
test_argparse.py accordingly.  (this metavar testing was added in 
http://bugs.python.org/issue9348).

This issue overlaps with http://bugs.python.org/issue16970, 'argparse: bad 
nargs value raises misleading message'.  There, though, the focus is  more on 
the error message when nargs=0.  While nargs<1 might not make much sense, it 
technically does not break anything.

--
Added file: http://bugs.python.org/file30010/nargswarn.patch

___
Python tracker 

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



[issue16970] argparse: bad nargs value raises misleading message

2013-04-24 Thread paul j3

paul j3 added the comment:

http://bugs.python.org/issue9849
also deals with nargs values.  However there the focus is on string values like 
'1', not whether an integer value can be 0 or <0.

I submitted a patch that moves the nargs testing to a 
ArgumentParser._check_argument() method.  It still depends on _format_args to 
do the actual testing of nargs.  I also make sure that group.add_argument() 
does this test.

Regarding this issue, can nargs=0 or <0?  _Store_action objects to 0, not 
because it causes runtime errors, but because it does not make sense.  Code 
with nargs=-1 runs without error, not consuming a string and returning [], just 
as a nargs=0 would.  

In http://bugs.python.org/issue14191 I found it useful to temporarily set 
nargs=0 to 'turn off' a positional.

I would vote for leaving this error message as is:

"ValueError: nargs for store actions must be > 0; if you have nothing to store, 
actions such as store true or store const may be more appropriate"

even though the test is actually nargs==0.  For normal use the recommendation 
that nargs>0 makes sense.

--
nosy: +paul.j3

___
Python tracker 

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



[issue17834] Add Heap (and DynamicHeap) classes to heapq module

2013-04-24 Thread Daniel Wong

Daniel Wong added the comment:

Ah, Serhiy is pointing out that there's already a class named PriorityQueue in 
the queue module. I didn't know that exists.

Now that I've had a chance to look at it, queue.PriorityQueue is like my Heap 
class, but there are some interesting difference; moreover, I'm also proposing 
DynamicHeap, which is pretty different from PriorityQueue. Perhaps, I should 
find a way to augment PriorityQueue so that it supports the interesting 
features of DynamicHeap?

--

___
Python tracker 

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



[issue17794] Priority Queue

2013-04-24 Thread Daniel Wong

Daniel Wong added the comment:

from the peanut gallery:

This looks right to me; you are seeing that PriorityQueue is trying to compare 
dicts, because that's how tuple comparison works: it is lexicographic. Since 
the first element of the two tuples that you are trying to insert have the same 
value, comparison of the two tuple reduces to comparing the second elements.

Your work around also looks good to me.

--
components: +Library (Lib) -Interpreter Core
nosy: +allyourcode

___
Python tracker 

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



[issue17837] Support for building on ppc64p7

2013-04-24 Thread Bohuslav "Slavek" Kabrda

New submission from Bohuslav "Slavek" Kabrda:

Hi, would it be possible to add ppc64p7 (Power7 optimized) to supported arches 
in config.sub? It should be as easy as the attached one-liner patch.
Thanks.

--
components: Build
files: python-add-support-for-ppc64p7.patch
keywords: patch
messages: 187758
nosy: bkabrda
priority: normal
severity: normal
status: open
title: Support for building on ppc64p7
versions: Python 2.7, Python 3.3, Python 3.4
Added file: 
http://bugs.python.org/file30011/python-add-support-for-ppc64p7.patch

___
Python tracker 

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



[issue17838] Can't assign a different value for sys.stdin in IDLE

2013-04-24 Thread Guilherme Simões

New submission from Guilherme Simões:

Something like:

sys.stdin = open('file')

works in Python but doesn't in the IDLE shell. After trying to do that, a 
dialog is open asking if the user wants to kill the program. This happens 
because the method "close" of the class "PseudoInputFile" (which was created in 
#17585) is called.

--
components: IDLE
messages: 187759
nosy: Guilherme.Simões
priority: normal
severity: normal
status: open
title: Can't assign a different value for sys.stdin in IDLE
type: behavior
versions: Python 3.4

___
Python tracker 

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



[issue17838] Can't assign a different value for sys.stdin in IDLE

2013-04-24 Thread Guilherme Simões

Changes by Guilherme Simões :


--
nosy: +Todd.Rovito, roger.serwy, terry.reedy

___
Python tracker 

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