[issue25959] tkinter - PhotoImage.zoom() causes segfault

2015-12-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you. Can you provide your image?

--

___
Python tracker 

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



[issue25864] collections.abc.Mapping should include a __reversed__ that raises TypeError

2015-12-26 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage:  -> needs patch

___
Python tracker 

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



[issue25958] Implicit ABCs have no means of "anti-registration"

2015-12-26 Thread Nick Coghlan

Changes by Nick Coghlan :


--
nosy: +ncoghlan

___
Python tracker 

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



[issue25864] collections.abc.Mapping should include a __reversed__ that raises TypeError

2015-12-26 Thread Nick Coghlan

Changes by Nick Coghlan :


--
nosy: +ncoghlan

___
Python tracker 

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



[issue24844] Python 3.5rc1 compilation error with Apple clang 4.2 included with Xcode 4

2015-12-26 Thread Tim Smith

Changes by Tim Smith :


--
nosy: +tdsmith

___
Python tracker 

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



[issue25930] Document that os.remove is semantically identical to os.unlink

2015-12-26 Thread Swati Jaiswal

Swati Jaiswal added the comment:

Please check this. Fixed according to previous comment.

--
keywords: +patch
nosy: +curioswati
Added file: http://bugs.python.org/file41428/iss_25930.patch

___
Python tracker 

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



[issue24931] _asdict breaks when inheriting from a namedtuple

2015-12-26 Thread Jens Troeger

Jens Troeger added the comment:

With my update from Python 3.4.3 to Python 3.4.4 (default, Dec 25 2015, 
06:14:41) I started experiencing crashes of my applications and I suspect this 
change is the culprit.

I have a class that inherits from namedtuple, and code calls vars() (i.e. 
retrieve __dict__) to iterate over an instance's attributes. Much like Raymond 
points out in http://bugs.python.org/msg249100

For example with 3.4.3:

>>> from collections import namedtuple
>>> Point = namedtuple('Point', ['x', 'y'])
>>> p = Point(1,2)
>>> p
Point(x=1, y=2)
>>> p.__dict__
OrderedDict([('x', 1), ('y', 2)])
>>> vars(p)
OrderedDict([('x', 1), ('y', 2)])

After the most recent update this breaks with 3.4.4:

>>> from collections import namedtuple
>>> Point = namedtuple('Point', ['x', 'y'])
>>> p = Point(1,2)
>>> p
Point(x=1, y=2)
>>> p.__dict__
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'Point' object has no attribute '__dict__'
>>> vars(p)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: vars() argument must have __dict__ attribute

I am not sure about the fix on my side. Should I use _asdict() instead of 
vars() although I would argue that vars() should remain functional across this 
change.  Calling _asdict() seems messy to me, but it works:

>>> p._asdict()
OrderedDict([('x', 1), ('y', 2)])

Why not keep the __dict__ property in tact?

  @property
  def __dict__(self):
  return self._asdict()

Thanks!

--
nosy: +_savage

___
Python tracker 

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



[issue25864] collections.abc.Mapping should include a __reversed__ that raises TypeError

2015-12-26 Thread Guido van Rossum

Guido van Rossum added the comment:

All sounds fine.

--

___
Python tracker 

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



[issue25864] collections.abc.Mapping should include a __reversed__ that raises TypeError

2015-12-26 Thread Andrew Barnert

Andrew Barnert added the comment:

> This sounds good. Also, reversed() could then be modified to produce a
better error.

Should `iter` also be modified to produce a better error if `__iter__` is None?

Also, should this be documented? Maybe a sentence in the "Special method names" 
section of the "Data model" chapter, like this:

> To indicate that some syntax is not supported, set the corresponding special 
> method name to None. For example, if __iter__ is None, the class is not 
> iterable, so iter() will not look for __getitem__.

--

___
Python tracker 

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



[issue25864] collections.abc.Mapping should include a __reversed__ that raises TypeError

2015-12-26 Thread Guido van Rossum

Guido van Rossum added the comment:

This sounds good. Also, reversed() could then be modified to produce a
better error. (The "unhashable" error comes from the hash() builtin, so
that's also a precedent.)

On Sat, Dec 26, 2015 at 4:32 PM, Andrew Barnert 
wrote:

>
> Andrew Barnert added the comment:
>
> As mentioned in #25958, Guido pointed out on -ideas that `__hash__ = None`
> is already the standard way to declare a class unhashable, and it's
> recognized by `collections.abc.Hashable`.
>
> Doing `__reversed__ = None` does make `reversed(m)` raise a `TypeError`
> (although with a description saying "'NoneType' is not callable", which
> isn't quite as nice a description, but probably good enough).
>
> So, I think `Mapping` should set `__reversed__ = None`, rather than
> setting it to a method that raises `TypeError`. (If we need something more
> general, that's for #25958 and/or Serhiy's typechecking bug.)
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue25959] tkinter - PhotoImage.zoom() causes segfault

2015-12-26 Thread hcdb

hcdb added the comment:

system 1:
os: Linux Mint 17.3 (64bit Mate)

python version: 2.7.6
python-tk version: 2.7.5-1ubuntu1 (according to packagemanager)

python3 version 3.4.3
python3-tk version: 3.4.3-1~14.04.2 (according to packagemanager)

running python in gdb on this system gives me these outputs:

(gdb) run test2.py
Starting program: /usr/bin/python test2.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x747ca700 (LWP 14639)]

Program received signal SIGSEGV, Segmentation fault.
memset () at ../sysdeps/x86_64/memset.S:80
80  ../sysdeps/x86_64/memset.S: No such file or directory.
(gdb) backtrace
#0  memset () at ../sysdeps/x86_64/memset.S:80
#1  0x766ce4ad in ?? () from /usr/lib/x86_64-linux-gnu/libtk8.6.so
#2  0x766cffab in Tk_PhotoPutZoomedBlock ()
   from /usr/lib/x86_64-linux-gnu/libtk8.6.so
#3  0x766cc12b in ?? () from /usr/lib/x86_64-linux-gnu/libtk8.6.so
#4  0x762c8337 in TclNRRunCallbacks ()
   from /usr/lib/x86_64-linux-gnu/libtcl8.6.so
#5  0x76982030 in ?? () from /usr/lib/python2.7/lib-dynload/_tkinter.so
#6  0x0049968d in PyEval_EvalFrameEx ()
#7  0x004a090c in PyEval_EvalCodeEx ()
#8  0x00499a52 in PyEval_EvalFrameEx ()
#9  0x004a1634 in ?? ()
#10 0x0044e4a5 in PyRun_FileExFlags ()
#11 0x0044ec9f in PyRun_SimpleFileExFlags ()
#12 0x0044f904 in Py_Main ()
#13 0x77818ec5 in __libc_start_main (main=0x44f9c2 , argc=2, 
argv=0x7fffe0b8, init=, fini=, 
rtld_fini=, stack_end=0x7fffe0a8) at libc-start.c:287
#14 0x00578c4e in _start ()
---

system2:
os: Debian Jessie (Gnome3)

python version:2.7.9
python-tk version:2.7.8-2+b1

python3 version:3.4.2
python3-tk version: 3.4.2-1+b1

output from gdb from this system (gui.py is my program that does the same as 
test.py only loads more widgets:

Starting program: /usr/bin/python gui.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7435d700 (LWP 10798)]

Program received signal SIGSEGV, Segmentation fault.
0x764ba07b in Tk_PhotoPutZoomedBlock ()
   from /usr/lib/x86_64-linux-gnu/libtk8.6.so
(gdb) backtrace
#0  0x764ba07b in Tk_PhotoPutZoomedBlock ()
   from /usr/lib/x86_64-linux-gnu/libtk8.6.so
#1  0x764b6171 in ?? () from /usr/lib/x86_64-linux-gnu/libtk8.6.so
#2  0x76092a87 in TclNRRunCallbacks ()
   from /usr/lib/x86_64-linux-gnu/libtcl8.6.so
#3  0x76ae53c0 in ?? () from /usr/lib/python2.7/lib-dynload/_tkinter.so
#4  0x004c9e05 in PyEval_EvalFrameEx ()
#5  0x004c87a1 in PyEval_EvalCodeEx ()
#6  0x004ca31a in PyEval_EvalFrameEx ()
#7  0x004c87a1 in PyEval_EvalCodeEx ()
#8  0x004ca31a in PyEval_EvalFrameEx ()
#9  0x004ca592 in PyEval_EvalFrameEx ()
#10 0x004ca592 in PyEval_EvalFrameEx ()
#11 0x004ca592 in PyEval_EvalFrameEx ()
#12 0x004e5fe8 in ?? ()
#13 0x005045d8 in ?? ()
#14 0x004eb950 in PyInstance_New ()
#15 0x004caaa1 in PyEval_EvalFrameEx ()
#16 0x004c87a1 in PyEval_EvalCodeEx ()
#17 0x005030ef in ?? ()
#18 0x004f8c72 in PyRun_FileExFlags ()
#19 0x004f7d77 in PyRun_SimpleFileExFlags ()
#20 0x004982f2 in Py_Main ()
---Type  to continue, or q  to quit---
#21 0x76f14b45 in __libc_start_main (main=0x497d80 , argc=2, 
argv=0x7fffe3b8, init=, fini=, 
rtld_fini=, stack_end=0x7fffe3a8) at libc-start.c:287
#22 0x00497ca0 in _start ()

--

___
Python tracker 

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



[issue25937] DIfference between utf8 and utf-8 when i define python source code encoding.

2015-12-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> I wonder why this does not trigger the exception.

Because in case of utf-8 and iso-8859-1 decoding and encoding steps are omitted.

In general case the input is decoded from specified encoding and than encoded 
to UTF-8 for parser. But for utf-8 and iso-8859-1 encodings the parser gets the 
raw data.

--

___
Python tracker 

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



[issue25958] Implicit ABCs have no means of "anti-registration"

2015-12-26 Thread Andrew Barnert

Andrew Barnert added the comment:

As Serhiy pointed out on -ideas, there's no reason `reversed` couldn't add 
special handling for `__reversed__ is None`, akin to `hash`'s special handling 
for `__hash__ is None`, to produce whatever error message we wanted in the 
`TypeError`, instead of "'NoneType' object is not callable". So, retract that 
argument against #2.

--

___
Python tracker 

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



[issue25959] tkinter - PhotoImage.zoom() causes segfault

2015-12-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Can't reproduce a crash. What is your OS? What versions of your Python and Tk? 
Can you provide your image?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue25958] Implicit ABCs have no means of "anti-registration"

2015-12-26 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue25864] collections.abc.Mapping should include a __reversed__ that raises TypeError

2015-12-26 Thread Andrew Barnert

Andrew Barnert added the comment:

As mentioned in #25958, Guido pointed out on -ideas that `__hash__ = None` is 
already the standard way to declare a class unhashable, and it's recognized by 
`collections.abc.Hashable`.

Doing `__reversed__ = None` does make `reversed(m)` raise a `TypeError` 
(although with a description saying "'NoneType' is not callable", which isn't 
quite as nice a description, but probably good enough).

So, I think `Mapping` should set `__reversed__ = None`, rather than setting it 
to a method that raises `TypeError`. (If we need something more general, that's 
for #25958 and/or Serhiy's typechecking bug.)

--

___
Python tracker 

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



[issue25958] Implicit ABCs have no means of "anti-registration"

2015-12-26 Thread Andrew Barnert

Andrew Barnert added the comment:

As Guido pointed out on -ideas, hashing already uses the convention of 
`__hash__ is None` to declare a type unhashable, and 
`collections.abc.Hashable.__subclasshook__` already checks for that.

Meanwhile, setting `__iter__` and `__reversed__` to `None` already raises a 
`TypeError` on `iter` and `reversed` (although not with the most helpful 
description).

So, maybe that should be documented as the standard way to unimplement 
`__iter__` and `__reversed__`, and `collections.abc.Iterable` should check that 
the looked-up `__iter__` is not `None` (and presumably typecheckers doing the 
equivalent for both `Iterable` and `Reversible`)?

--

___
Python tracker 

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



[issue25959] tkinter - PhotoImage.zoom() causes segfault

2015-12-26 Thread hcdb

New submission from hcdb:

My 6 lines of code crash and cause a segmentation fault when using .zoom() on a 
PhotoImage in tkinter (run test.py)

tested and crashed in python 2.7.6, 2.7.9, 3.4.2 & 3.4.3 on linux mint 17.3 and 
debian jessie

ps. just learning to code python, so maybe i'm doing it wrong.

--
components: Tkinter
files: test.py
messages: 257055
nosy: hcbd
priority: normal
severity: normal
status: open
title: tkinter - PhotoImage.zoom() causes segfault
type: crash
versions: Python 2.7, Python 3.4
Added file: http://bugs.python.org/file41427/test.py

___
Python tracker 

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



[issue25956] Unambiguous representation of recursive objects

2015-12-26 Thread Chris Angelico

Chris Angelico added the comment:

LGTM. I'm currently seeing failures in test_ssl, but they weren't introduced by 
this patch. I'll run with this patch and see if I run into any third party test 
failures.

+1 on the change.

--
nosy: +Rosuav

___
Python tracker 

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



[issue25864] collections.abc.Mapping should include a __reversed__ that raises TypeError

2015-12-26 Thread Andrew Barnert

Andrew Barnert added the comment:

Also, I filed #25958 as an ABC equivalent to Serhiy's typehinting problem. I 
don't know if that actually needs to be solved, but that definitely takes it 
out of the way for this issue.

--

___
Python tracker 

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



[issue25958] Implicit ABCs have no means of "anti-registration"

2015-12-26 Thread Andrew Barnert

New submission from Andrew Barnert:

Serhiy Storchaka raised an issue (http://bugs.python.org/msg256910) with static 
type hints on #25864 (http://bugs.python.org/issue25864), which I believe also 
applies to runtime ABCs.

Consider this class, which uses `[]` in a way similar to generic types:

class Thing:
def __getitem__(self, specialization):
return type(self)._specialize(specialization)(self)
def __len__(self):
return len(self._specializations)

Because this type looks like it supports the old-style sequence protocol, 
calling either `iter` or `reversed` on an instance will successfully return a 
useless iterator. (You may get an error when you start trying to iterate it, 
but you may not even then.) You don't want that, so you add either this:

__iter__ = None
__reversed__ = None

... or this:

def __iter__(self): raise TypeError('not iterable')
def __reversed__(self): raise TypeError('not iterable')

Unfortunately, doing either means that `issubclass(Thing, 
collections.abc.Iterable)` now returns true. Which is the exact opposite of the 
intention of that check. (The same is true for `typing.Iterable` and 
`typing.Reversible`.) So, fixing the problem for duck typing creates the 
equivalent problem for explicit typing.

There are a few possible solutions here:

1. Maybe document it, otherwise do nothing.

2. Change the ABCs to check that the dunder method exists and is not None (or 
is callable, or is a non-data descriptor). Then, the one way to opt out is to 
assign `__iter__ = __reversed__ = None`.

3. Add an `ABC.unregister` method that can be used to explicitly state that 
this type does not support that ABC, regardless of what its `__subclasshook__` 
says.

Possible argument for #1: `Iterable` rarely has a problem. (Types that use 
`__getitem__` for something completely un-sequence-like, like `typing`'s 
generic types, usually don't have `__len__`. Types that have both `__getitem__` 
and `__len__`, like mappings, usually have a reasonable alternative `__iter__` 
to offer.) `Reversible` would have a problem if there was such an ABC, but 
there isn't. Off the top of my head, I can't think of any of the other implicit 
ABCs that are susceptible to this problem.

The counter-argument is that static typehinting definitely does have this 
problem (https://github.com/ambv/typehinting/issues/170), and, depending on how 
that's solved, it may well make sense to use the same solution here.

If we do need a solution, #2 seems better than #3 (or anything else I could 
think up). The only problem there is that `def __iter__(self): raise 
TypeError('not iterable')` gives you a nicer error than `__iter__ = None`.

--
components: Library (Lib)
messages: 257052
nosy: abarnert
priority: normal
severity: normal
status: open
title: Implicit ABCs have no means of "anti-registration"
versions: Python 3.6

___
Python tracker 

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



[issue25937] DIfference between utf8 and utf-8 when i define python source code encoding.

2015-12-26 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 26.12.2015 22:46, STINNER Victor wrote:
> 
> In Python, there are multiple implementations of the utf-8 codec with many
> shortcuts. I'm not surprised to see bugs depending on the exact syntax of
> the utf-8 codec name. Maybe we need to share even more code to normalize
> and compare codec names. (I think that py3 is better than py2 on this part.)

There's only one implementation (the one in unicodeobject.c), which is used
directly or via the wrapper in the encodings package, but there
are a few shortcuts to bypass the codec registry scattered around
the code since UTF-8 is such a commonly used codec.

In the case in question, the codec registry should trigger decoding
via the encodings package (rather than going directly to C APIs),
so will eventually end up using the same code. I wonder why this does not
trigger the exception.

--

___
Python tracker 

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



[issue25937] DIfference between utf8 and utf-8 when i define python source code encoding.

2015-12-26 Thread STINNER Victor

STINNER Victor added the comment:

In Python, there are multiple implementations of the utf-8 codec with many
shortcuts. I'm not surprised to see bugs depending on the exact syntax of
the utf-8 codec name. Maybe we need to share even more code to normalize
and compare codec names. (I think that py3 is better than py2 on this part.)

--

___
Python tracker 

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



[issue25864] collections.abc.Mapping should include a __reversed__ that raises TypeError

2015-12-26 Thread Andrew Barnert

Andrew Barnert added the comment:

Serhiy already filed the typing.Reversible bug on the separate typehinting 
tracker (https://github.com/ambv/typehinting/issues/170). So, unless fixing 
that bug requires some changes back to collections.abc or something else in the 
stdlib, I think the only issue here is the original one, on Mapping.

--

___
Python tracker 

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



[issue25955] email.utils.formataddr does not support RFC 6532

2015-12-26 Thread Sergei Maertens

Sergei Maertens added the comment:

I could probably come up with a patch, but the reason I ran into this is 
because it's used in the core of Django. I already submitted a bug with Django, 
and with the legaciness of this function it feels like Django should move to 
the new API or implement its own variant of the function. I'll report as such 
in tje downstream bug report.

--

___
Python tracker 

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



[issue25937] DIfference between utf8 and utf-8 when i define python source code encoding.

2015-12-26 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

Please fold these cases into one:

 if (strcmp(buf, "utf-8") == 0 ||
 strncmp(buf, "utf-8-", 6) == 0)
 return "utf-8";
 else if (strcmp(buf, "utf8") == 0 ||
 strncmp(buf, "utf8-", 6) == 0)
 return "utf-8";

->

 if (strcmp(buf, "utf-8") == 0 ||
 strncmp(buf, "utf-8-", 6) == 0 ||
 strcmp(buf, "utf8") == 0 ||
 strncmp(buf, "utf8-", 6) == 0)
 return "utf-8";

Also: I wonder why the regular utf_8.py codec doesn't complain about this case, 
since the above are only shortcuts for frequently used source code encodings.

--

___
Python tracker 

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



[issue25864] collections.abc.Mapping should include a __reversed__ that raises TypeError

2015-12-26 Thread R. David Murray

R. David Murray added the comment:

So this issue now has two problems being discussed in it.  Someone should start 
a new issue for the typing.Reversible problem.

--

___
Python tracker 

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



[issue25864] collections.abc.Mapping should include a __reversed__ that raises TypeError

2015-12-26 Thread Andrew Barnert

Andrew Barnert added the comment:

> Perhaps there is a bug in typing.Reversible. It doesn't accept all types 
> supported by reversed().

> ... And accepts types that don't work with reversed().

The problem is the way the two are defined:

* Reversible is true if you implement __reversed__
* reverse works if you implement __reversed__ or implement the old-style 
sequence protocol.

That explains why it doesn't work on tuple, bytearray, etc. Iterable actually 
has the exact same problem, but, because it's a supertype of Sequence, and we 
have explicit Sequence.register(tuple) and MutableSequence.register(bytearray) 
in collections.abc, and typing.Iterable specifies collections.abc.Iterable as 
its "extra", it all works out.

We could do the same for Reversible: add a collections.abc.Reversible, make it 
a subtype of Iterable and make Sequence a subtype of Reversible instead of 
Iterable, and make that the extra for typing.Reversible. Then it would work for 
all of those builtin types (and many third-party types that explicitly register 
with Sequence), just as Iterable does.

But that only solves the problem in one direction. To solve it in the other 
direction, we'd need some way to either explicitly mark a method as not 
implemented (maybe setting it to None, or to any non-callable, or any data 
descriptor?) that ABC subclass hooks and/or typing checks are expected to 
understand, or unregister a class with an ABC so that it isn't a subtype even 
if it passes the implicit hooks.

Or... could we just drop Reversible as an implicit protocol? The lack of an 
explicit "deny" mechanism for implicit protocols and ABCs is a more general 
problem, but if this is the only actual instance of that problem in real life, 
do we need to solve the general problem? If not, there's no obvious way to 
define typing.Reversible that isn't wrong, it doesn't have a corresponding ABC, 
it doesn't seem like it will be useful often enough to be worth the problems it 
causes, and I doubt there's much real-life code out there already depending on 
it, so that seems a lot easier.

--

___
Python tracker 

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



[issue25949] Lazy creation of __dict__ in OrderedDict

2015-12-26 Thread Camilla Montonen

Camilla Montonen added the comment:

Hi Serhiy, 
I tried to see whether the patch's unit test in test_ordered_dict.py would fail 
when the changes to odictobject.c were not applied and it did not. 
The code change to test_ordered_dict.py does not appear to test the fact that a 
dict is not automatically created when an ordered dict is instantiated (?).

--
nosy: +Winterflower

___
Python tracker 

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



[issue25957] sockaddr_l2 lacks CID, address type (AF_BLUETOOTH sockets)

2015-12-26 Thread Mike Ryan

New submission from Mike Ryan:

The AF_BLUETOOTH socket type lacks support for specifying CID and address type 
in sockaddr_l2. These structure members have been present since 2009 and 2012 
respectively:

https://git.kernel.org/cgit/bluetooth/bluez.git/commit/?id=3de95535
https://git.kernel.org/cgit/bluetooth/bluez.git/commit/?id=ba801fcd

The current version of the full structure can be found here:

https://git.kernel.org/cgit/bluetooth/bluez.git/tree/lib/l2cap.h?id=1b9e48f4#n40

The Python code in question can be found here:

https://github.com/python/cpython/blob/4f9794dbcaa6ee7ddc6ab175a57e7f01ebe64353/Modules/socketmodule.c#L1108

--
components: Extension Modules
messages: 257043
nosy: mikeryan
priority: normal
severity: normal
status: open
title: sockaddr_l2 lacks CID, address type (AF_BLUETOOTH sockets)
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue25702] Link Time Optimizations support for GCC and CLANG

2015-12-26 Thread Alecsandru Patrascu

Alecsandru Patrascu added the comment:

I'm adding Brett, Gregory, Stefan and Victor as nosy because this issue might 
be interesting for them also.

--
nosy: +brett.cannon, gregory.p.smith, haypo, scoder, skrah

___
Python tracker 

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



[issue25954] Python 3.5.1 installer fails on Windows 7

2015-12-26 Thread Eryk Sun

Eryk Sun added the comment:

Packages are installed from the ProgramData folder on the system volume. For 
example, the log shows the CRT update executed as follows:

"C:\Windows\system32\wusa.exe" "C:\ProgramData\Package Cache\
D4036846864773E3D647F421DFE7F6CA536E307B\
Windows6.1-KB2999226-x86.msu" /quiet /norestart

Is it installing from the same ProgramData directory when it succeeds?

--

___
Python tracker 

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



[issue25664] Logging cannot handle Unicode logger names

2015-12-26 Thread Vinay Sajip

Vinay Sajip added the comment:

> Why not doing that in record constructor?

You're right, that's probably better. Perhaps I was too hasty ...

--

___
Python tracker 

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



[issue25955] email.utils.formataddr does not support RFC 6532

2015-12-26 Thread R. David Murray

R. David Murray added the comment:

formataddr is part of the legacy interface and has no knowledge of the current 
policy.  So it doesn't support RFC 6532.  For that you need to use the new API: 
just assign your address to the appropriate field, or create a 
headerregistry.Address object.

I'm in the process of rewriting the docs to make all of this clear, but, well, 
I'm slow...

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue25955] email.utils.formataddr does not support RFC 6532

2015-12-26 Thread Alessandro Cucci

Alessandro Cucci added the comment:

Sergei can you submit a patch? 
Otherwise I can work on that, I have free time.

--
nosy: +acucci

___
Python tracker 

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



[issue25956] Unambiguous representation of recursive objects

2015-12-26 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

For now repr() of recursive object replaces nested representations of self with 
a placeholder containing "...": "[...]" for list, "{...}" for dict, "set(...)" 
for set, and just "..." for Python classes that use reprlib. Unfortunately such 
replacements are valid expressions in Python 3.

The same replacement is used for too deeply nested objects in reprlib and 
pprint.

Proposed patch makes "<...>" to be always used as a placeholder. This is 
invalid syntax and well visually distinguishable.

Python-Ideas discussion: http://comments.gmane.org/gmane.comp.python.ideas/37555

--
components: Interpreter Core, Library (Lib)
files: repr_recursive.patch
keywords: patch
messages: 257037
nosy: fdrake, ncoghlan, rhettinger, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Unambiguous representation of recursive objects
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file41426/repr_recursive.patch

___
Python tracker 

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



[issue25664] Logging cannot handle Unicode logger names

2015-12-26 Thread STINNER Victor

STINNER Victor added the comment:

> New changeset 512a628c683e by Vinay Sajip in branch '2.7':
> Closes #25664: handled logger names in Unicode.
> https://hg.python.org/cpython/rev/512a628c683e

.format() doesn't look to me like the best place to encode the name. Why not 
doing that in record constructor?

I don't want to add one try/except for each record field :-/

--

___
Python tracker 

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



[issue25954] Python 3.5.1 installer fails on Windows 7

2015-12-26 Thread Ned Batchelder

Ned Batchelder added the comment:

This is in a virtualbox. I have my host OS files mapped in the guest Windows OS 
to drive N:.   When I try to install by running N:\Downloads\python-3.5.1.exe, 
it fails with the error shown above.  When I copy the file to the C: drive, it 
succeeds! ?

--

___
Python tracker 

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



[issue25955] email.utils.formataddr does not support RFC 6532

2015-12-26 Thread Claude Paroz

Changes by Claude Paroz :


--
nosy: +claudep

___
Python tracker 

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



[issue25955] email.utils.formataddr does not support RFC 6532

2015-12-26 Thread Sergei Maertens

New submission from Sergei Maertens:

The function `formataddr` in stdlib `email.utils` does not allow unicode e-mail 
addresses where the first part (before the @) is unicode. Python 3.5 promises 
support for SMTPUTF8 through `EmailPoliy.utf8` 
(https://docs.python.org/3/whatsnew/3.5.html#email), but this utility function 
doesn't respect this, as it calls `address.encode('ascii')`.

For unicode addresses, an obvious `UnicodeEncodeError` is raised.

Reproduce steps:

➜  ~  python
Python 3.5.1 (default, Dec  7 2015, 12:58:09) 
[GCC 5.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from email.utils import formataddr
>>> formataddr(('dummy', 'juan.lóp...@abc.com'))
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.5/email/utils.py", line 91, in formataddr
address.encode('ascii')
UnicodeEncodeError: 'ascii' codec can't encode character '\xf3' in position 6: 
ordinal not in range(128)

Interesting is that on Python 2.7 the behaviour is more naive, but it works::

➜  ~  python2
Python 2.7.11 (default, Dec  6 2015, 15:43:46) 
[GCC 5.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from email.utils import formataddr
>>> formataddr(('dummy', u'juan.lóp...@abc.com'))
u'dummy '

--
components: email
messages: 257034
nosy: Sergei Maertens, barry, r.david.murray
priority: normal
severity: normal
status: open
title: email.utils.formataddr does not support RFC 6532
type: enhancement
versions: Python 3.5

___
Python tracker 

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



[issue24940] RotatingFileHandler uses tell in non-binary mode to determine size of the file in bytes

2015-12-26 Thread Vinay Sajip

Vinay Sajip added the comment:

I propose to close this as not a bug, as the exact rollover size is just meant 
to be in the close ball-park rather than to the exact byte.

--
resolution:  -> not a bug
status: open -> pending

___
Python tracker 

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



[issue25360] pyw should search for pythonw to implement #!/usr/bin/env python

2015-12-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2af2367d7eda by Vinay Sajip in branch '3.5':
Fixes #25360: Search for pythonw.exe when in pyw.exe.
https://hg.python.org/cpython/rev/2af2367d7eda

New changeset ba1e102c3320 by Vinay Sajip in branch 'default':
Closes #25360: Merged fix from 3.5.
https://hg.python.org/cpython/rev/ba1e102c3320

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue25954] Python 3.5.1 installer fails on Windows 7

2015-12-26 Thread Ned Batchelder

Ned Batchelder added the comment:

This was my second attempt, and there is no other installation running.

--

___
Python tracker 

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



[issue25685] Inefficiency with SocketHandler - may send log record message string twice in pickled data structure

2015-12-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6210b41a2394 by Vinay Sajip in branch '3.5':
Closes #25685: Made SocketHandler emission more efficient.
https://hg.python.org/cpython/rev/6210b41a2394

New changeset 6a6a68a3d323 by Vinay Sajip in branch 'default':
Closes #25685: Merged fix from 3.5.
https://hg.python.org/cpython/rev/6a6a68a3d323

--
nosy: +python-dev
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue25789] py launcher stderr is not piped to subprocess.Popen.stderr

2015-12-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d0a84d0c5ceb by Vinay Sajip in branch 'default':
Closes #25789: Improved buffering behaviour in launcher.
https://hg.python.org/cpython/rev/d0a84d0c5ceb

--
nosy: +python-dev
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue25937] DIfference between utf8 and utf-8 when i define python source code encoding.

2015-12-26 Thread 王杰

王杰 added the comment:

I'm learning about Python's encoding rule and I write it as a test case.

--

___
Python tracker 

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



[issue25664] Logging cannot handle Unicode logger names

2015-12-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 512a628c683e by Vinay Sajip in branch '2.7':
Closes #25664: handled logger names in Unicode.
https://hg.python.org/cpython/rev/512a628c683e

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue25937] DIfference between utf8 and utf-8 when i define python source code encoding.

2015-12-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The problem is not that an error is raised with coding:utf8, but that it isn't 
raised with coding:utf-8.

Here is an example with bad iso8859-3. An error is raised as expected.

--
nosy: +serhiy.storchaka
Added file: http://bugs.python.org/file41425/bad_iso8859_3.py

___
Python tracker 

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



[issue25937] DIfference between utf8 and utf-8 when i define python source code encoding.

2015-12-26 Thread STINNER Victor

STINNER Victor added the comment:

> I has a file "gbk-utf-8.py" and it's encoding is GBK.

I don't understand why you use "# coding: utf-8" if the file is encoded to GBK. 
Why not using "# coding: gbk"?

--

___
Python tracker 

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



[issue25937] DIfference between utf8 and utf-8 when i define python source code encoding.

2015-12-26 Thread STINNER Victor

STINNER Victor added the comment:

> Here is a fix with a patch.

Oops, I mean 'with an unit test', sorry ;-)

--

___
Python tracker 

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



[issue25937] DIfference between utf8 and utf-8 when i define python source code encoding.

2015-12-26 Thread STINNER Victor

STINNER Victor added the comment:

Here is a fix with a patch.

--
keywords: +patch
versions: +Python 2.7
Added file: http://bugs.python.org/file41424/utf8.patch

___
Python tracker 

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



[issue25923] More const char

2015-12-26 Thread Stefan Krah

Stefan Krah added the comment:

There's no need to revert it.  Both versions are okay, but I wanted
to point out that these kinds of changes a) add a cognitive load for
other developers (I have to look what has changed in memoryobject.c)
and b) may override other developers' conscious decisions.

--

___
Python tracker 

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



[issue20767] Some python extensions can't be compiled with clang 3.4

2015-12-26 Thread Stefan Krah

Stefan Krah added the comment:

Over at the llvm bug tracker this is marked as a release blocker:

https://llvm.org/bugs/show_bug.cgi?id=18164

--
nosy: +skrah

___
Python tracker 

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



[issue25937] DIfference between utf8 and utf-8 when i define python source code encoding.

2015-12-26 Thread 王杰

王杰 added the comment:

Python 2.7

--

___
Python tracker 

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