[issue26743] Unable to import random with python2.7 on power pc based machine

2016-04-13 Thread Raghu

Raghu added the comment:

Serhiy,

root@host:~# python
Python 2.7.3 (default, Apr  3 2016, 22:31:30)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import struct
>>> struct.pack('d', 2.0)
'@\x00\x00\x00\x00\x00\x00\x00'
>>> struct.pack('d', float(2))
'@\x00\x00\x00\x00\x00\x00\x00'
>>>

--

___
Python tracker 

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



[issue26743] Unable to import random with python2.7 on power pc based machine

2016-04-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What is the output of `struct.pack('d', 2.0)` and `struct.pack('d', float(2))`?

--

___
Python tracker 

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



[issue26751] Possible bug in sorting algorithm

2016-04-13 Thread Tim Peters

Tim Peters added the comment:

If that's the actual code you're using, it has a bug:  the "if k2[1] is None" 
test is useless, since regardless of whether it's true or false, the next `if` 
suite overwrites `retval`.  You probably meant

elif k1[1] ...
^^

instead of

if k1[1] ...

Does that fix your problem?

If not, please augment the bug report with the _complete_ code you're actually 
using, a sample problematic input, the exact output you're expecting, and the 
exact output you're seeing instead.  We're not telepathic ;-)

--
nosy: +tim.peters

___
Python tracker 

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



[issue26751] Possible bug in sorting algorithm

2016-04-13 Thread David Manowitz

New submission from David Manowitz:

I'm trying to sort a list of tuples.  Most of the tuples are pairs of US state 
names.  However, some of the tuples have None instead of the 2nd name.  I want 
the items sorted first by the 1st element, and then by the 2nd element, BUT I 
want the None to count as LARGER than any name.  Thus, I want to see 
[('Alabama', 'Iowa'), ('Alabama', None)] rather than [('Alabama', None), 
('Alabama', 'Iowa')].  I defined the following comparitor:

def cmp_keys (k1, k2):
retval = cmp(k1[0], k2[0])
if retval == 0:
if k2[1] is None:
retval = -1
if k1[1] is None:
retval = 1
else:
retval = cmp(k1[1], k2[1])

return retval

However, once I sort using this, some of the elements are out of order.

--
components: Interpreter Core
messages: 263367
nosy: David.Manowitz
priority: normal
severity: normal
status: open
title: Possible bug in sorting algorithm
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



[issue26743] Unable to import random with python2.7 on power pc based machine

2016-04-13 Thread Raghu

Raghu added the comment:

It's windriver linux. Processor is PPC64-E5500

--

___
Python tracker 

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



[issue26743] Unable to import random with python2.7 on power pc based machine

2016-04-13 Thread STINNER Victor

STINNER Victor added the comment:

What is your Linux distribution and what is your CPU? (try to read 
/proc/cpuinfo)

You cannot install a C compiler?

--

___
Python tracker 

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



[issue26693] Exception ignored in: in _shutdown, assert tlock.locked()

2016-04-13 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue26743] Unable to import random with python2.7 on power pc based machine

2016-04-13 Thread Raghu

Raghu added the comment:

my host details:

Linux fpc0 3.10.62-ltsi-WR6.0.0.18_standard #1 SMP PREEMPT Sun Apr 3 23:17:02 
PDT 2016 ppc64 ppc64 ppc64 GNU/Linux

--

___
Python tracker 

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



[issue26743] Unable to import random with python2.7 on power pc based machine

2016-04-13 Thread Raghu

Raghu added the comment:

stinner victor, my host doesn't have a gcc compiler. is there a way you can 
give me the binary?

--

___
Python tracker 

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



[issue26743] Unable to import random with python2.7 on power pc based machine

2016-04-13 Thread STINNER Victor

STINNER Victor added the comment:

>>> print math.sqrt(2.0)
Traceback (most recent call last):
  File "", line 1, in 
ValueError: math domain error

I'm surprised that such basic math function fails.

Can you please try to compile and run attached C program?

$ gcc sqrt.c -o sqrt -lm && ./sqrt
sqrt(2) = 1.41421

--
nosy: +haypo
Added file: http://bugs.python.org/file42459/sqrt.c

___
Python tracker 

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



[issue26750] Mock autospec does not work with subclasses of property()

2016-04-13 Thread Amaury Forgeot d'Arc

New submission from Amaury Forgeot d'Arc:

When patching a class, mock.create_autospec() correctly detects properties and 
__slot__ attributes, but not subclasses of property() or other kinds of data 
descriptors.

The attached patch detects all data descriptors and patch them the way they 
should be.

--
components: Tests
files: mock-descriptor.patch
keywords: patch
messages: 263361
nosy: amaury.forgeotdarc, michael.foord
priority: normal
severity: normal
status: open
title: Mock autospec does not work with subclasses of property()
type: enhancement
Added file: http://bugs.python.org/file42458/mock-descriptor.patch

___
Python tracker 

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



[issue26743] Unable to import random with python2.7 on power pc based machine

2016-04-13 Thread Raghu

Raghu added the comment:

Hi, I apologize. I didn't expect a quick reply.
Here are the outputs you requested.

root@host:~# python
Python 2.7.3 (default, Apr  3 2016, 22:31:30)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> print math.sqrt(2.0)
Traceback (most recent call last):
  File "", line 1, in 
ValueError: math domain error
>>> print math

>>> import struct
>>> struct.pack('>>

--

___
Python tracker 

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



[issue26748] enum.Enum is False-y

2016-04-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See also issue23008.

--
nosy: +serhiy.storchaka

___
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

2016-04-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Le 13/04/2016 21:55, Marc-Andre Lemburg a écrit :
>>
>> LTO is not stable on all platforms (according to doko), and people don't
>> want to wait for PGO to build when they just run ./configure && make.
>>
>> --with-pgo and --with-lto is fine.
> 
> Agreed. Let's not make compilation take longer than necessary.
> 
> When doing production builds, people can still enable these
> optimizations as necessary.

Agreed as well. It's enough to make these options sufficiently accessible.

--

___
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

2016-04-13 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 13.04.2016 21:50, Stefan Krah wrote:
> 
> LTO is not stable on all platforms (according to doko), and people don't
> want to wait for PGO to build when they just run ./configure && make.
> 
> --with-pgo and --with-lto is fine.

Agreed. Let's not make compilation take longer than necessary.

When doing production builds, people can still enable these
optimizations as necessary.

--

___
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

2016-04-13 Thread STINNER Victor

STINNER Victor added the comment:

> LTO is not stable on all platforms (according to doko), and people don't want 
> to wait for PGO to build when they just run ./configure && make.

Can we have a whitelist of arch known to support PGO and/or LTO? Or maybe a 
blacklist?

Ubuntu already has this knownledge in their package, no?

--

___
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

2016-04-13 Thread Stefan Krah

Stefan Krah added the comment:

LTO is not stable on all platforms (according to doko), and people don't
want to wait for PGO to build when they just run ./configure && make.

--with-pgo and --with-lto is fine.

--

___
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

2016-04-13 Thread STINNER Victor

STINNER Victor added the comment:

+  --with-lto  Enable Link Time Optimization in PGO builds.
+  Disabled by default.

I don't understand why it's disabled by default. IMHO we must enable all the 
best optimizers options *by default*.

But I expect all optimizations to be disabled by --with-debug.

--
nosy: +haypo

___
Python tracker 

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



[issue26359] CPython build options for out-of-the box performance

2016-04-13 Thread STINNER Victor

STINNER Victor added the comment:

Sorry, I don't understand this issue. I don't think that we need 3 flavors: 
debug, devel and release. We already have debug (--with-pydebug) and release, 
and IMHO debug is what developers should use.

I like the idea of using the best optimizers options *by default* for the 
release mode. In practice, I suggest to enable PGO *by default*.

--

___
Python tracker 

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



[issue16399] argparse: append action with default list adds to list instead of overriding

2016-04-13 Thread Gabriel Devenyi

Gabriel Devenyi added the comment:

>From what I can tell a workaround for this still isn't documented.

--
nosy: +Gabriel Devenyi

___
Python tracker 

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



[issue26749] Update devguide to include Fedora's DNF

2016-04-13 Thread Luiz Poleto

Luiz Poleto added the comment:

The attached patch contains the instructions on how to use DNF to install the 
system headers.

--
keywords: +patch
Added file: http://bugs.python.org/file42457/issue26749.patch

___
Python tracker 

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



[issue26749] Update devguide to include Fedora's DNF

2016-04-13 Thread Luiz Poleto

New submission from Luiz Poleto:

Starting with Fedora 22, yum is no longer the default packaging tool, being 
replaced by the new DNF (Dandified Yum).

Section 1.1.3.1 of the devguide, Build dependencies, has instructions to 
install system headers using popular Linux distributions, including Fedora, 
however, it only covers using yum to do it.

This section should be updated to include the usage of the new DNF packaging 
tool to perform that task.

--
assignee: docs@python
components: Documentation
messages: 263350
nosy: docs@python, poleto
priority: normal
severity: normal
status: open
title: Update devguide to include Fedora's DNF
type: enhancement

___
Python tracker 

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



[issue26693] Exception ignored in: in _shutdown, assert tlock.locked()

2016-04-13 Thread skydoom

skydoom added the comment:

seems we also need to check whether _main_thread is daemon thread or not, so 
the proposed patch would look like:

def _shutdown():
   # add these checking first
   if( _main_thread.isDaemon() is False or _main_thread.is_alive() is False ):
   return

--

___
Python tracker 

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



[issue26748] enum.Enum is False-y

2016-04-13 Thread Ethan Furman

Ethan Furman added the comment:

EnumMeta /is/ a collection (at least in the same sense the dict class is a 
collection).  ;)

Fix is on it's way...

--

___
Python tracker 

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



[issue26748] enum.Enum is False-y

2016-04-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Just reading the code now, the reason is that EnumMeta pretends to be a 
collection (it defines a __len__ and an __iter__).

--

___
Python tracker 

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



[issue26748] enum.Enum is False-y

2016-04-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Yes, I didn't find a separate bug tracker for the enum34 backport, which is why 
I included that version here.

> for IntEnum the behavior is correct

Do you remember the argument? I agree that IntEnum *instances* may be falsy, 
but IntEnum classes I don't see why.

That said, if an IntEnum *class* has to be false-y, then there's no real point 
in fixing just Enum (you can pass an IntEnum instance to singledispatch() too).

--

___
Python tracker 

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



[issue26748] enum.Enum is False-y

2016-04-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, we posted at the same time :-) Yes, the class is false-y.

--

___
Python tracker 

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



[issue26748] enum.Enum is False-y

2016-04-13 Thread Guido van Rossum

Guido van Rossum added the comment:

Oh wait. The *class* is False-y? That's definitely a bug, just fix it.

--

___
Python tracker 

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



[issue26748] enum.Enum is False-y

2016-04-13 Thread Guido van Rossum

Guido van Rossum added the comment:

I guess it's marked 2.7 because of the enum34 backport? There's no enum in the 
2.7 stdlib.

I believe this was brought up before on one of the lists but I don't recall the 
outcome of the discussion, except that for IntEnum the behavior is correct.  I 
tend to agree that for plain Enum it's a problem, the question is whether we 
can fix it without breaking code that accidentally relies on this behavior.

--

___
Python tracker 

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



[issue26748] enum.Enum is False-y

2016-04-13 Thread Antoine Pitrou

New submission from Antoine Pitrou:

>>> import enum
>>> bool(enum.Enum)
False
>>> bool(enum.IntEnum)
False

This behaviour is relatively unexpected for classes, and can lead to subtle 
bugs such as the following:

https://bitbucket.org/ambv/singledispatch/issues/8/inconsistent-hierarchy-with-enum

--
components: Library (Lib)
messages: 263342
nosy: barry, eli.bendersky, ethan.furman, gvanrossum, pitrou
priority: normal
severity: normal
status: open
title: enum.Enum is False-y
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5

___
Python tracker 

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



[issue26745] Redundant code in _PyObject_GenericSetAttrWithDict

2016-04-13 Thread Josh Rosenberg

Josh Rosenberg added the comment:

LGTM. Had to check the definition of PyDescr_IsData to determine that checking 
the value from tp_descr_set for NULL was exactly what that macro does, but 
yeah, it looks like the first test was redundant, and f is never assigned 
outside that block, so the second block after the rest of the work is 
pointless; you'd never get there.

--
nosy: +josh.r

___
Python tracker 

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



[issue26647] ceval: use Wordcode, 16-bit bytecode

2016-04-13 Thread STINNER Victor

STINNER Victor added the comment:

I opened a thread on the python-dev mailing list to discuss wordcode:
https://mail.python.org/pipermail/python-dev/2016-April/144044.html

--

___
Python tracker 

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



[issue26647] ceval: use Wordcode, 16-bit bytecode

2016-04-13 Thread STINNER Victor

STINNER Victor added the comment:

I ran the Python benchmark suite on wpy6.patch.

* My platform: Linux-4.4.4-301.fc23.x86_64-x86_64-with-fedora-23-Twenty_Three
* My PC: CPU Intel i7-2600 (~2.9 GHz) with 12 GB of RAM
* Benchmark ran on isolated CPU: 
http://haypo-notes.readthedocs.org/microbenchmark.html
* Command line: ~/bin/taskset_isolated.py time python3 -u perf.py --rigorous 
"$ORIG_PYTHON" "$PATCHED_PYTHON" -b all 2>&1

It looks like we get more faster benchmarks than slower benchamrks. Faster is 
up to 11% faster, whereas the worst slowdown is only 4%. The overall results 
look good to me.

Slower:

* fannkuch: 1.04x slower
* pickle_dict: 1.04x slower
* telco: 1.03x slower
* django_v3: 1.02x slower
* simple_logging: 1.02x slower
* meteor_contest: 1.02x slower

Faster:

* unpack_sequence: 1.11x faster
* etree_parse: 1.06x faster
* call_method_slots: 1.06x faster
* etree_iterparse: 1.05x faster
* call_simple: 1.04x faster
* nbody: 1.04x faster
* float: 1.04x faster
* call_method_unknown: 1.03x faster
* call_method: 1.03x faster
* chaos: 1.03x faster
* mako_v2: 1.03x faster
* richards: 1.02x faster
* silent_logging1: 1.02x faster


Full Output:

Original python: ../wordcode/python
3.6.0a0 (default:ad5b079565ad, Apr 13 2016, 16:30:36) 
[GCC 5.3.1 20151207 (Red Hat 5.3.1-2)]

Patched python: ../wordcode/python
3.6.0a0 (default:c050d203e82b, Apr 13 2016, 16:30:24) 
[GCC 5.3.1 20151207 (Red Hat 5.3.1-2)]

INFO:root:Automatically selected timer: perf_counter
INFO:root:Skipping benchmark slowpickle; not compatible with Python 3.6
INFO:root:Skipping benchmark pybench; not compatible with Python 3.6
INFO:root:Skipping benchmark hg_startup; not compatible with Python 3.6
INFO:root:Skipping benchmark rietveld; not compatible with Python 3.6
INFO:root:Skipping benchmark slowspitfire; not compatible with Python 3.6
INFO:root:Skipping benchmark bzr_startup; not compatible with Python 3.6
INFO:root:Skipping benchmark html5lib_warmup; not compatible with Python 3.6
INFO:root:Skipping benchmark slowunpickle; not compatible with Python 3.6
INFO:root:Skipping benchmark html5lib; not compatible with Python 3.6
INFO:root:Skipping benchmark spambayes; not compatible with Python 3.6
[ 1/43] 2to3...
INFO:root:Running `../wordcode/python lib3/2to3/2to3 -f all lib/2to3`
INFO:root:Running `../wordcode/python lib3/2to3/2to3 -f all lib/2to3` 5 times
INFO:root:Running `../default/python lib3/2to3/2to3 -f all lib/2to3`
INFO:root:Running `../default/python lib3/2to3/2to3 -f all lib/2to3` 5 times
[ 2/43] call_method...
INFO:root:Running `../wordcode/python performance/bm_call_method.py -n 300 
--timer perf_counter`
INFO:root:Running `../default/python performance/bm_call_method.py -n 300 
--timer perf_counter`
mer. avril 13 16:36:47 CEST 2016
Original python: ../wordcode/python
3.6.0a0 (default:ad5b079565ad, Apr 13 2016, 16:30:36) 
[GCC 5.3.1 20151207 (Red Hat 5.3.1-2)]

Patched python: ../wordcode/python
3.6.0a0 (default:c050d203e82b, Apr 13 2016, 16:30:24) 
[GCC 5.3.1 20151207 (Red Hat 5.3.1-2)]

INFO:root:Automatically selected timer: perf_counter
INFO:root:Skipping benchmark html5lib; not compatible with Python 3.6
INFO:root:Skipping benchmark html5lib_warmup; not compatible with Python 3.6
INFO:root:Skipping benchmark slowpickle; not compatible with Python 3.6
INFO:root:Skipping benchmark slowunpickle; not compatible with Python 3.6
INFO:root:Skipping benchmark slowspitfire; not compatible with Python 3.6
INFO:root:Skipping benchmark rietveld; not compatible with Python 3.6
INFO:root:Skipping benchmark bzr_startup; not compatible with Python 3.6
INFO:root:Skipping benchmark spambayes; not compatible with Python 3.6
INFO:root:Skipping benchmark pybench; not compatible with Python 3.6
INFO:root:Skipping benchmark hg_startup; not compatible with Python 3.6
[ 1/43] 2to3...
INFO:root:Running `../wordcode/python lib3/2to3/2to3 -f all lib/2to3`
INFO:root:Running `../wordcode/python lib3/2to3/2to3 -f all lib/2to3` 5 times
INFO:root:Running `../default/python lib3/2to3/2to3 -f all lib/2to3`
INFO:root:Running `../default/python lib3/2to3/2to3 -f all lib/2to3` 5 times
[ 2/43] call_method...
INFO:root:Running `../wordcode/python performance/bm_call_method.py -n 300 
--timer perf_counter`
INFO:root:Running `../default/python performance/bm_call_method.py -n 300 
--timer perf_counter`
[ 3/43] call_method_slots...
INFO:root:Running `../wordcode/python performance/bm_call_method_slots.py -n 
300 --timer perf_counter`
INFO:root:Running `../default/python performance/bm_call_method_slots.py -n 300 
--timer perf_counter`
[ 4/43] call_method_unknown...
INFO:root:Running `../wordcode/python performance/bm_call_method_unknown.py -n 
300 --timer perf_counter`
INFO:root:Running `../default/python performance/bm_call_method_unknown.py -n 
300 --timer perf_counter`
[ 5/43] call_simple...
INFO:root:Running `../wordcode/python performance/bm_call_simple.py -n 300 
--timer perf_counter`
INFO:root:Running `../default/python performance/bm_call_simple.py 

[issue26747] types.InstanceType only for old style class only in 2.7

2016-04-13 Thread SilentGhost

Changes by SilentGhost :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
stage:  -> patch review

___
Python tracker 

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



[issue26747] types.InstanceType only for old style class only in 2.7

2016-04-13 Thread Nan Wu

New submission from Nan Wu:

>>> import types
>>> a = 1
>>> isinstance(a, types.InstanceType)
False
>>> class A:
... pass
... 
>>> a = A()
>>> isinstance(a, types.InstanceType)
True
>>> class A(object):
... pass
... 
>>> a = A()
>>> isinstance(a, types.InstanceType)
False

Looks like isinstance(instance, types.InstanceType) only return True for 
user-defined old-style class instance. If it's the case, I feel doc should 
clarify that like what types.ClassType did. If no, someone please close this 
request. Thanks.

--
files: doc_InstanceType_is_for_old_style_cls.patch
keywords: patch
messages: 263338
nosy: Nan Wu
priority: normal
severity: normal
status: open
title: types.InstanceType only for old style class only in 2.7
type: enhancement
versions: Python 2.7
Added file: 
http://bugs.python.org/file42456/doc_InstanceType_is_for_old_style_cls.patch

___
Python tracker 

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



[issue26647] ceval: use Wordcode, 16-bit bytecode

2016-04-13 Thread STINNER Victor

STINNER Victor added the comment:

> Updated wpy5.patch to use a more standard diff format (patch generated with 
> Mercurial, hg diff > patch).

Crap, I forgot Python/wordcode_helpers.h.

I updated a fixed wpy6.patch.

--
Added file: http://bugs.python.org/file42455/wpy6.patch

___
Python tracker 

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



[issue26647] ceval: use Wordcode, 16-bit bytecode

2016-04-13 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file42454/wpy5.patch

___
Python tracker 

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



[issue26647] ceval: use Wordcode, 16-bit bytecode

2016-04-13 Thread STINNER Victor

STINNER Victor added the comment:

Updated wpy5.patch to use a more standard diff format (patch generated with 
Mercurial, hg diff > patch).

--
Added file: http://bugs.python.org/file42454/wpy5.patch

___
Python tracker 

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



[issue26647] ceval: use Wordcode, 16-bit bytecode

2016-04-13 Thread Demur Rumed

Demur Rumed added the comment:

Made changes from code review, did a little extra on fixing up type 
consistency, not sure if this is exactly the patch format you wanted; I tried 
`git difftool --extcmd='diff -u' python/master` but it's listing the original 
files as being from /tmp

I've updated modulefinder with haypo's index patch except in the context of 
wordcode

--
Added file: http://bugs.python.org/file42453/wpy5.patch

___
Python tracker 

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



[issue26057] Avoid nonneeded use of PyUnicode_FromObject()

2016-04-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your review Martin.

--
assignee:  -> serhiy.storchaka
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



[issue26057] Avoid nonneeded use of PyUnicode_FromObject()

2016-04-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3f3b3d4881f6 by Serhiy Storchaka in branch 'default':
Issue #26057: Got rid of nonneeded use of PyUnicode_FromObject().
https://hg.python.org/cpython/rev/3f3b3d4881f6

--
nosy: +python-dev

___
Python tracker 

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



[issue26718] super.__init__ leaks memory if called multiple times

2016-04-13 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
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



[issue26718] super.__init__ leaks memory if called multiple times

2016-04-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 450f36750cb9 by Serhiy Storchaka in branch '3.5':
Issue #26718: super.__init__ no longer leaks memory if called multiple times.
https://hg.python.org/cpython/rev/450f36750cb9

New changeset 4680438f486f by Serhiy Storchaka in branch '2.7':
Issue #26718: super.__init__ no longer leaks memory if called multiple times.
https://hg.python.org/cpython/rev/4680438f486f

New changeset 55f4c1f8ca6a by Serhiy Storchaka in branch 'default':
Issue #26718: super.__init__ no longer leaks memory if called multiple times.
https://hg.python.org/cpython/rev/55f4c1f8ca6a

--
nosy: +python-dev

___
Python tracker 

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



[issue26673] Tkinter error when opening IDLE configuration menu

2016-04-13 Thread Petr Viktorin

Petr Viktorin added the comment:

Indeed, the size is 0 there:

{'family': 'DejaVu Sans Mono', 'size': 0, 'slant': 'roman', 'weight': 'normal', 
'overstrike': 0, 'underline': 0}

--

___
Python tracker 

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



[issue15984] Wrong documentation for PyUnicode_FromObject() and PyUnicode_FromEncodedObject()

2016-04-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM. Thank you Martin for this improvement.

--
assignee: docs@python -> martin.panter
stage: patch review -> commit review

___
Python tracker 

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



[issue26746] struct.pack(): trailing padding bytes on x64

2016-04-13 Thread Stefan Krah

Stefan Krah added the comment:

Thank you.  So technically, in the above NumPy example the format
string generated by NumPy would be considered incomplete if we assume
struct syntax:

>>> m = memoryview(x)
>>> m.format
'T{B:x:xxxL:y:B:z:}'


I find this "0L" thing a very odd notation. Taking care of this
manually requires a) knowledge of what the compiler does and b)
searching for the largest struct member.

--

___
Python tracker 

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



[issue26743] Unable to import random with python2.7 on power pc based machine

2016-04-13 Thread Mark Dickinson

Mark Dickinson added the comment:

The output of `struct.pack('

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



[issue26057] Avoid nonneeded use of PyUnicode_FromObject()

2016-04-13 Thread Martin Panter

Martin Panter added the comment:

Apart from one redundancy (see review), this looks good to me.

--

___
Python tracker 

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



[issue15984] Wrong documentation for PyUnicode_FromObject() and PyUnicode_FromEncodedObject()

2016-04-13 Thread Martin Panter

Martin Panter added the comment:

Here is a new version where I use the phrase “true Unicode object”.

--
Added file: http://bugs.python.org/file42452/from_object_v4.patch

___
Python tracker 

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



[issue26744] print() function hangs on MS-Windows 10

2016-04-13 Thread Ma Lin

Ma Lin added the comment:

I'm afraid not. If run it 1000 times, only about <5 times occurs, the others 
are quite fine.
I have installed faulthandler, let's wait the hunting.

--

___
Python tracker 

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



[issue26744] print() function hangs on MS-Windows 10

2016-04-13 Thread STINNER Victor

STINNER Victor added the comment:

> In addition, the printed strings are Simplified Chinese, my system's language 
> is it as well. Maybe it's a factor?

Ooh yes. The Windows Console sucks to display Unicode: see the very old 
issue #1602 which is not fixed yet and is 9 years old...

Try to replace your chinese message with a simple ASCII text like print("test") 
to check if it works around your issue.

Maybe IDLE and/or PowerShell have a better Unicode support, I don't know for 
Chinese.

Sorry, I know better Linux, I know that Linux handles well Unicode in terminals.

--

___
Python tracker 

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



[issue26746] struct.pack(): trailing padding bytes on x64

2016-04-13 Thread Martin Panter

Martin Panter added the comment:

This behaviour seems to be documented, although it is not very explicit, and a 
bit surprising to me. See the third note at the end of 
: 
“align the end . . . with a repeat count of zero”, and the example

>>> pack('llh0l', 1, 2, 3)
b'\x00\x00\x00\x01\x00\x00\x00\x02\x00\x03\x00\x00'

--
nosy: +martin.panter

___
Python tracker 

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



[issue3132] implement PEP 3118 struct changes

2016-04-13 Thread Stefan Krah

Changes by Stefan Krah :


--
versions: +Python 3.6 -Python 3.3

___
Python tracker 

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



[issue3132] implement PEP 3118 struct changes

2016-04-13 Thread Stefan Krah

Stefan Krah added the comment:

Here's a grammar that roughly describes the subset that NumPy supports.

As for implementing this in the struct module: There is a new data
description language on the horizon:

  http://datashape.readthedocs.org/en/latest/


It does not have all the low-level capabilities (e.g changing alignment
on the fly), but it is far more readable. Example:

PEP-3118:  "(2,3)10f0fZdT{10B:x:(2,3)d:y:Q:z:}B"
Datashape: "2 * 3 * (10 * float32, 0 * float32, complex128, {x: 10 * uint8, y: 
2 * 3 * float64, z: int64}, uint8)"


There are a lot of open questions still. Should "10f" be viewed as an
array[10] of float, i.e. equivalent to (10)f?

In the context of PEP-3118, I think so.

--
nosy: +skrah
Added file: http://bugs.python.org/file42451/grammar.y

___
Python tracker 

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



[issue26744] print() function hangs on MS-Windows 10

2016-04-13 Thread Ma Lin

Ma Lin added the comment:

>> It looks like a bug in your application. Can you provide a short script to 
>> reproduce the bug?

It's hard to believe it, the code has no way to behavior like that.
I think this is not reproducible, it's random hang.

As my subjective feelings, I suspect it's a Windows bug.

e.g., after an relative long time nooperation, I suddenly press a button in 
tkinter GUI, it simply delete a file like this:

try:
output = self.output.get().strip()
os.remove(output)
except:
pass
else:
print('已删除输出文件')

It usually hangs at the print() line.

Another scene is high IO, I download something at 8 MB/s, then I run my 
program, it should download a HTML page and then print() some information, some 
hangs happed in this scene.

In addition, the printed strings are Simplified Chinese, my system's language 
is it as well. Maybe it's a factor?

I'm inclined to guess is a Windows 10 (or only my system's) bug.

--

___
Python tracker 

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



[issue26744] print() function hangs on MS-Windows 10

2016-04-13 Thread STINNER Victor

STINNER Victor added the comment:

> To be honest, I'm a bit suprise that almost no one complain it, maybe it's my 
> system's fault? I don't know.

It looks like a bug in your application. Can you provide a short script to 
reproduce the bug?

--

___
Python tracker 

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



[issue26744] print() function hangs on MS-Windows 10

2016-04-13 Thread Ma Lin

Ma Lin added the comment:

ok, I will try faulthandler module.

>> Are you running your program in the Windows console (cmd.exe)? In IDLE? In 
>> PowerShell?

One runs in pure command line mode, cmd.exe.
The other is a simple tkinter GUI with a console for output message.

To be honest, I'm a bit suprise that almost no one complain it, maybe it's my 
system's fault? I don't know.

Just want to remind you try ENTER key next time.

--

___
Python tracker 

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



[issue26744] print() function hangs on MS-Windows 10

2016-04-13 Thread STINNER Victor

STINNER Victor added the comment:

> I have two programs, they occasionally infinite hang.

Can you please try the faulthandler module to try to get a traceback of all 
Python threads?

I suggest to use the watchdog with a short timeout (ex: 60 seconds):
https://docs.python.org/dev/library/faulthandler.html#faulthandler.dump_traceback_later

> 1, print() function cause the infinite hang.
> 2, If it hangs, simply press ENTER key, it goes on without any problem.

Are you running your program in the Windows console (cmd.exe)? In IDLE? In 
PowerShell?

--

___
Python tracker 

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



[issue26744] print() function hangs on MS-Windows 10

2016-04-13 Thread Ma Lin

Ma Lin added the comment:

After my MS-Windows 10 updated to 10586.218 this day, it occurs again.

It hung, the console cursor was flashing at the beginning of the current line.
I pressed ENTER key on the console window, then it printed the supposed content 
and went on.

I have read issue26624, if you encounter the issue again, try ENTER key, if it 
works maybe it's the same problem.

--
components: +Interpreter Core
nosy: +eryksun, haypo, jkloth

___
Python tracker 

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



[issue26746] struct.pack(): trailing padding bytes on x64

2016-04-13 Thread Stefan Krah

New submission from Stefan Krah:

On the x64 architecture gcc adds trailing padding bytes after the last
struct member.  NumPy does the same:

>>> import numpy as np
>>> 
>>> t = np.dtype([('x', 'u1'), ('y', 'u8'), ('z', 'u1')], align=True)
>>> x = np.array([(1, 2, 3)], dtype=t)
>>> x.tostring()
b'\x01\xf7\xba\xab\x03\x7f\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00'


The struct module in native mode does not:

>>> struct.pack("BQB", 1, 2, 3)
b'\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x03'


I'm not sure if this is intended -- or if full compatibility to
native compilers is even achievable in the general case.

--
components: Extension Modules
messages: 263315
nosy: mark.dickinson, skrah
priority: normal
severity: normal
status: open
title: struct.pack(): trailing padding bytes on x64
type: behavior
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



[issue1322] Deprecate platform.dist() and platform.linux_distribution() functions

2016-04-13 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

The idea is to have similar functionality implemented as a PyPI
package, which can be updated more often than the stdlib.

Unlike Windows and Mac OS X, the approach to finding out
the distribution version is changing too often on Linux (w/r to how
Python release cycles work). The problem is not complexity, it's
maintainability.

If you're confident that you can write the one and only implementation,
feel free to do so. Put it on PyPI and we can point people to it
once it has picked up a reasonable following we can point to it
in the documentation.

PS: I agree that the package name "ld" is not very intuitive. Perhaps
Nir could change it to something more easily recognizable, such as
"linux_distribution" :-)

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com

--

___
Python tracker 

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



[issue1322] Deprecate platform.dist() and platform.linux_distribution() functions

2016-04-13 Thread leycec

leycec added the comment:

Deprecating platform.linux_distribution() while retaining platform.win32_ver() 
and platform.mac_ver() is non-orthogonal, unjustifiable, and (arguably) 
discriminatory.

Platform version detection is no more a moving target under Linux than under 
Windows or OS X -- possibly less so, given the numerous significant revisions 
to platform.win32_ver() implementations over the dreary years. If Linux is 
arbitrarily unentitled to platform-specific lookup functions, then other 
platforms deserve the same.

Unlike both Windows and OS X, the overwhelming majority of Linux distributions 
provide a trivially parsable plaintext file publishing high-level platform 
metadata in "="-delimited shell variable assignment format: the 
systemd-mandated and freedesktop.org-maintained "/etc/os-release" file. Under 
edge-case Linux distributions ideologically rejecting this standard (e.g., 
Gentoo Linux), a subset of the named tuple returned by platform.uname() is 
trivially returnable.

Do not parse multiple possibly conflicting files, commands, or standards. Doing 
so is neither necessary nor desirable. If "/etc/os-release" exists, parse that; 
else, fallback to platform.uname(). Done. Fait accompli. Quite simple. No 
moving target exists.

A robust platform.linux_distribution() implementation adhering to this scheme 
is implementable in less than 50 lines of code -- possibly less than 20, 
assuming aggressive cleverness. How? If "/etc/os-release" exists, this file is 
guaranteed to be POSIX shell-compatible and hence Pythonically parsable via the 
stdlib shlex.shlex() function. (In brief: iteratively search for tokens 
containing "=", split these tokens on "=", ignore irrelevant variable names, 
and retain the remainder. That's it.) The fallback alternative is even briefer.

Removing core functionality invites third-party API explosion. This is the 
height of irresponsibility. Brace for heavyweight dependencies, end-user 
confusion, multiple competing non-standards, and poorly selected PyPi names 
conflicting with the long-standing GNU toolchain. (See nir0s' "ld", also 
referred to as "What was nir0s thinking?")

None of these are good things. Given the unremarkable simplicity of 
implementing this function correctly, this cul-de-sac of Cthulhian insanity 
needn't have happened in the first place.

It did. Now we languish.

--
nosy: +leycec

___
Python tracker 

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



[issue26699] locale.str docstring is incorrect: "Convert float to integer"

2016-04-13 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Thanks. Fixed in

https://hg.python.org/cpython/rev/2b35ef6a9853
https://hg.python.org/cpython/rev/ad5b079565ad
https://hg.python.org/cpython/rev/125d27d9cf9b

--
nosy: +orsenthil
resolution:  -> fixed
stage: needs patch -> 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



[issue25496] tarfile: Default value for compresslevel is not documented

2016-04-13 Thread Martin Panter

Martin Panter added the comment:

Thanks for the patch Hamza

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