[issue27538] Segfault on error in code object checking

2016-07-17 Thread Ammar Askar

Ammar Askar added the comment:

Can recreate on both py2.7 and py3.6

Constructor for CodeType in py3.6 is slightly different:

exec(code(0, 0, 2, 3, 0, b"lol lolol", (), (), (), "", "", 0, b""))

--
nosy: +ammar2
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



[issue27539] negative Fraction ** negative int not normalized

2016-07-17 Thread Vedran Čačić

New submission from Vedran Čačić:

I already wrote http://bugs.python.org/msg270548, but can't seem to reopen the 
issue, so I think the best thing is to report the bug separately.

So, in issue http://bugs.python.org/issue21136, performance enhancement 
https://hg.python.org/cpython/rev/91d7fadac271/ enabled a shortcut for some 
operations (__pow__ among them) to avoid reducing the result to lowest terms if 
it can be concluded it's already reduced.

However, the logic has a corner case that was handled incorrectly. If a 
negative Fraction is raised to a negative integer, the result is a Fraction 
with a negative denominator, which is not normalized and in fact breaks many 
other operations (which rightly assume their operands to be normalized).

>>> import fractions
>>> fractions.Fraction(-1, 2) ** -1
Fraction(2, -1)
>>> _ == -2
False

Of course, the easy fix would be to change line 52 of fractions.py to 
_normalize=True - but that would reintroduce the slowness talked about in 
http://bugs.python.org/issue21136#msg215409. Alternative fix is to branch 
depending on the sign of the base, which might be messy if we intend to be 
completely general -- for example, in finite quotient rings, fractions don't 
have well-defined signs.

[BTW I'm not quite sure why the code in fractions.py is so general, with many 
weird cases trying to support every imaginable construction - maybe someone 
really wanted such a level of generality. I don't, so I'd be fine with this 
working only on ordinary int/int Fractions.]

--
components: Library (Lib)
messages: 270616
nosy: Vedran.Čačić
priority: normal
severity: normal
status: open
title: negative Fraction ** negative int not normalized
type: behavior
versions: Python 3.5, Python 3.6

___
Python tracker 

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



[issue27469] Unicode filename gets crippled on Windows when drag and drop

2016-07-17 Thread Eryk Sun

Eryk Sun added the comment:

Thanks, Steve. I manually added this shell extension as the drop handler for 
Python.File. It's working with non-ANSI filenames, e.g. "αβψδ εφγη ιξκλ μνοπ 
ρστθ ωχυζ.txt" in a Western locale. Also, I was able to drop 939 files from the 
System32 directory, with a total command-line length of 32766 characters. 

However, I ran into heap corruption that crashed Explorer when dropping files 
from "C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\um". I used 
gflags to enable the page heap for Explorer and tracked the problem down to 
FilenameListCchLength[W|A]. It wasn't allocating space for the double quotes 
for paths with spaces in them. So I made the following changes:

FilenameListCchLengthW:

length += oneLength + (wcschr(pszSource, L' ') ? 3 : 1);

FilenameListCchLengthA:

length += oneLength + (strchr(pszSource, ' ') ? 3 : 1);

After this I was able to drop 421 files from the above-mentioned Include 
directory, with a total command-line length of 32737 characters.

--

___
Python tracker 

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



[issue27538] Segfault on error in code object checking

2016-07-17 Thread pablo sacristan

pablo sacristan added the comment:

I can also reproduce on 3.5 and on 3.4.
Thank you.

--
versions: +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



[issue27539] negative Fraction ** negative int not normalized

2016-07-17 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +mark.dickinson, rhettinger

___
Python tracker 

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



[issue17711] Persistent id in pickle with protocol version 0

2016-07-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f6a41552a312 by Serhiy Storchaka in branch '3.5':
Issue #17711: Fixed unpickling by the persistent ID with protocol 0.
https://hg.python.org/cpython/rev/f6a41552a312

New changeset df8857c6f3eb by Serhiy Storchaka in branch 'default':
Issue #17711: Fixed unpickling by the persistent ID with protocol 0.
https://hg.python.org/cpython/rev/df8857c6f3eb

--
nosy: +python-dev

___
Python tracker 

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



[issue21708] Deprecate nonstandard behavior of a dumbdbm database

2016-07-17 Thread Serhiy Storchaka

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



[issue27540] msvcrt.ungetwch() calls _ungetch()

2016-07-17 Thread Armin Rigo

New submission from Armin Rigo:

In Python 2.7, PC/msvcrtmodule.c, the function msvcrt_ungetwch() calls 
_ungetch() instead of _ungetwch() as was probably intended.

--
components: Extension Modules
messages: 270620
nosy: arigo
priority: normal
severity: normal
status: open
title: msvcrt.ungetwch() calls _ungetch()
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



[issue27541] Repr of collection's subclasses

2016-07-17 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

The repr of subclasses of some collection classes contains a name of the 
subclass:

>>> class S(set): pass
... 
>>> S([1, 2, 3])
S({1, 2, 3})
>>> import collections
>>> class OD(collections.OrderedDict): pass
... 
>>> OD({1: 2})
OD([(1, 2)])
>>> class C(collections.Counter): pass
... 
>>> C('senselessness')
C({'s': 6, 'e': 4, 'n': 2, 'l': 1})

But the repr of subclasses of some collection classes contains a name of the 
base class:

>>> class BA(bytearray): pass
... 
>>> BA([1, 2, 3])
bytearray(b'\x01\x02\x03')
>>> class D(collections.deque): pass
... 
>>> D([1, 2, 3])
deque([1, 2, 3])
>>> class DD(collections.defaultdict): pass
... 
>>> DD(int, {1: 2})
defaultdict(, {1: 2})

Shouldn't a name of the subclass always be used?

--
components: Extension Modules, Interpreter Core
messages: 270621
nosy: rhettinger, serhiy.storchaka, xiang.zhang
priority: normal
severity: normal
status: open
title: Repr of collection's subclasses
type: enhancement
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



[issue27507] bytearray.extend lacks overflow check when increasing buffer

2016-07-17 Thread Antti Haapala

Antti Haapala added the comment:

Ah indeed, this is a bytearray and it is indeed possible to theoretically 
allocate PY_SSIZE_T_MAX bytes, if on an architecture that does segmented memory.

As for 

if (addition > PY_SSIZE_T_MAX - len - 1) {

it is very clear to *us* but it is not quite self-documenting on why to do it 
this way to someone who doesn't know undefined behaviours in C (hint: next to 
no one knows, judging from the amount of complaints that the GCC "bug" 
received), instead of say

if (INT_ADD_OVERFLOW(len, addition))

Where the INT_ADD_OVERFLOW would have a comment above explaining why it has to 
be done that way. But more discussion about it at 
https://bugs.python.org/issue1621

--

___
Python tracker 

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



[issue27541] Repr of collection's subclasses

2016-07-17 Thread Xiang Zhang

Xiang Zhang added the comment:

How about other built-in classes? If repr does matter, maybe str, int, dict 
should also respect this rule?

--

___
Python tracker 

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



[issue27419] Bugs in PyImport_ImportModuleLevelObject

2016-07-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c88ec1bb67d0 by Serhiy Storchaka in branch '3.5':
Issue #27419: Standard __import__() no longer look up "__import__" in globals
https://hg.python.org/cpython/rev/c88ec1bb67d0

New changeset d87f99e297d5 by Serhiy Storchaka in branch 'default':
Issue #27419: Standard __import__() no longer look up "__import__" in globals
https://hg.python.org/cpython/rev/d87f99e297d5

--
nosy: +python-dev

___
Python tracker 

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



[issue27541] Repr of collection's subclasses

2016-07-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This can break third-party code. For example the code that explicitly makes the 
repr containing a subclass name:

class MyStr(str):
def __repr__(self):
return 'MyStr(%s)' % str.__repr__(self)

I think the chance of breaking third-party code for bytearray or deque is 
smaller, since the repr is not literal.

--

___
Python tracker 

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



[issue23908] Check path arguments of os functions for null character

2016-07-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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

___
Python tracker 

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



[issue26984] int() can return not exact int instance

2016-07-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Could you please make a review Mark?

--

___
Python tracker 

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



[issue23782] Leak in _PyTraceback_Add

2016-07-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue27541] Repr of collection's subclasses

2016-07-17 Thread Xiang Zhang

Xiang Zhang added the comment:

Yes. So if we are not going to change other built-in types, maybe we'd better 
not change bytearray either. My opinion is that don't change built-in classes, 
even bytearray. If users would like a more reasonable repr, they can provide a 
custom __repr__ as your example. But make such changes to classes in 
collections sounds like a good idea to me.

--

___
Python tracker 

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



[issue23148] Missing the charset parameter in as_encoded_word()

2016-07-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset efd4ffa88173 by Serhiy Storchaka in branch '3.5':
Issues #23147, #23148: Presumably fixed bugs in folding UnstructuredTokenList.
https://hg.python.org/cpython/rev/efd4ffa88173

New changeset 33593fcdf8b0 by Serhiy Storchaka in branch 'default':
Issues #23147, #23148: Presumably fixed bugs in folding UnstructuredTokenList.
https://hg.python.org/cpython/rev/33593fcdf8b0

--
nosy: +python-dev

___
Python tracker 

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



[issue23147] Possible error in _header_value_parser.py

2016-07-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset efd4ffa88173 by Serhiy Storchaka in branch '3.5':
Issues #23147, #23148: Presumably fixed bugs in folding UnstructuredTokenList.
https://hg.python.org/cpython/rev/efd4ffa88173

New changeset 33593fcdf8b0 by Serhiy Storchaka in branch 'default':
Issues #23147, #23148: Presumably fixed bugs in folding UnstructuredTokenList.
https://hg.python.org/cpython/rev/33593fcdf8b0

--
nosy: +python-dev

___
Python tracker 

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



[issue27419] Bugs in PyImport_ImportModuleLevelObject

2016-07-17 Thread Berker Peksag

Berker Peksag added the comment:

I'm getting a segfault after d87f99e297d5 (SubinterpreterTest.test_subinterps).

$ ./python -m test test_capi
Run tests sequentially
0:00:00 [1/1] test_capi
Fatal Python error: Segmentation fault

Current thread 0x7fd5e401d700 (most recent call first):
  File "/home/berker/projects/cpython/default/Lib/test/support/__init__.py", 
line 2440 in run_in_subinterp
  File "/home/berker/projects/cpython/default/Lib/test/test_capi.py", line 337 
in test_subinterps
  File "/home/berker/projects/cpython/default/Lib/unittest/case.py", line 600 
in run
  File "/home/berker/projects/cpython/default/Lib/unittest/case.py", line 648 
in __call__
  File "/home/berker/projects/cpython/default/Lib/unittest/suite.py", line 122 
in run
  File "/home/berker/projects/cpython/default/Lib/unittest/suite.py", line 84 
in __call__
  File "/home/berker/projects/cpython/default/Lib/unittest/suite.py", line 122 
in run
  File "/home/berker/projects/cpython/default/Lib/unittest/suite.py", line 84 
in __call__
  File "/home/berker/projects/cpython/default/Lib/unittest/suite.py", line 122 
in run
  File "/home/berker/projects/cpython/default/Lib/unittest/suite.py", line 84 
in __call__
  File "/home/berker/projects/cpython/default/Lib/test/support/__init__.py", 
line 1704 in run
  File "/home/berker/projects/cpython/default/Lib/test/support/__init__.py", 
line 1805 in _run_suite
  File "/home/berker/projects/cpython/default/Lib/test/support/__init__.py", 
line 1839 in run_unittest
  File "/home/berker/projects/cpython/default/Lib/test/libregrtest/runtest.py", 
line 179 in test_runner
  File "/home/berker/projects/cpython/default/Lib/test/libregrtest/runtest.py", 
line 180 in runtest_inner
  File "/home/berker/projects/cpython/default/Lib/test/libregrtest/runtest.py", 
line 144 in runtest
  File "/home/berker/projects/cpython/default/Lib/test/libregrtest/main.py", 
line 334 in run_tests_sequential
  File "/home/berker/projects/cpython/default/Lib/test/libregrtest/main.py", 
line 406 in run_tests
  File "/home/berker/projects/cpython/default/Lib/test/libregrtest/main.py", 
line 466 in _main
  File "/home/berker/projects/cpython/default/Lib/test/libregrtest/main.py", 
line 446 in main
  File "/home/berker/projects/cpython/default/Lib/test/libregrtest/main.py", 
line 508 in main
  File "/home/berker/projects/cpython/default/Lib/test/__main__.py", line 2 in 

  File "/home/berker/projects/cpython/default/Lib/runpy.py", line 85 in 
_run_code
  File "/home/berker/projects/cpython/default/Lib/runpy.py", line 184 in 
_run_module_as_main
Segmentation fault (core dumped)

See also 
http://buildbot.python.org/all/builders/s390x%20RHEL%203.x/builds/1387/steps/test/logs/stdio
 for the same failure on buildbots.

--
nosy: +berker.peksag

___
Python tracker 

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



[issue27419] Bugs in PyImport_ImportModuleLevelObject

2016-07-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4c07faa33915 by Serhiy Storchaka in branch '3.5':
Issue #27419: Added temporary workaround for subinterpreters.
https://hg.python.org/cpython/rev/4c07faa33915

New changeset 5540234ca517 by Serhiy Storchaka in branch 'default':
Issue #27419: Added temporary workaround for subinterpreters.
https://hg.python.org/cpython/rev/5540234ca517

--

___
Python tracker 

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



[issue27419] Bugs in PyImport_ImportModuleLevelObject

2016-07-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Added temporary workaround to make buildbots working. The bug is partially 
reappeared in __import__ in subinterpreter. I think this is better than 
reverting all patches.

--

___
Python tracker 

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



[issue27542] Segfault in gcmodule.c:360 visit_decref

2016-07-17 Thread Julien

New submission from Julien:

Was running `python -m pip install ansible` when I got a "segmentation fault".

bt is:

(gdb) bt
#0  0x004a7ec4 in visit_decref () at ../Modules/gcmodule.c:360
#1  0x004a7fa9 in dict_traverse () at ../Objects/dictobject.c:2144
#2  0x004a6f88 in subtract_refs () at ../Modules/gcmodule.c:385
#3  collect.lto_priv () at ../Modules/gcmodule.c:925
#4  0x00500d2e in PyGC_Collect () at ../Modules/gcmodule.c:1440
#5  0x00500184 in Py_Finalize () at ../Python/pythonrun.c:448
#6  0x00525148 in Py_Exit (sts=0) at ../Python/pythonrun.c:1783
#7  0x00522553 in handle_system_exit () at ../Python/pythonrun.c:1151
#8  0x00521e46 in PyErr_PrintEx () at ../Python/pythonrun.c:1161
#9  0x00520dc9 in RunModule.lto_priv.1258 () at ../Modules/main.c:194
#10 0x0049de26 in Py_Main () at ../Modules/main.c:587
#11 0x7fddb03e25f0 in __libc_start_main (main=0x49d710 , argc=6, 
argv=0x7ffdfcb8cfe8, init=, fini=, 
rtld_fini=, 
stack_end=0x7ffdfcb8cfd8) at libc-start.c:291
#12 0x0049d639 in _start ()

Problem looks obvious:
(gdb) p (((PyObject*)(op))->ob_type)
$86202 = (struct _typeobject *) 0x0

But `subtract_refs()` from `Modules/gcmodule.c:385` is iterating a very long 
chained list, and I'm not sure it's of any help iterating over it.

Can provide core dump if of any help.

Python version: Python 2.7.12
PIP version: pip 8.1.2 from /usr/lib/python2.7/dist-packages (python 2.7)

Looks reproductible:

```
$ python -m pip install --user ansible
Collecting ansible
Collecting jinja2 (from ansible)
  Using cached Jinja2-2.8-py2.py3-none-any.whl
Collecting setuptools (from ansible)
  Using cached setuptools-24.0.3-py2.py3-none-any.whl
Collecting PyYAML (from ansible)
Collecting pycrypto>=2.6 (from ansible)
Collecting paramiko (from ansible)
  Using cached paramiko-2.0.1-py2.py3-none-any.whl
Collecting MarkupSafe (from jinja2->ansible)
Collecting cryptography>=1.1 (from paramiko->ansible)
Collecting pyasn1>=0.1.7 (from paramiko->ansible)
  Using cached pyasn1-0.1.9-py2.py3-none-any.whl
Collecting enum34 (from cryptography>=1.1->paramiko->ansible)
  Using cached enum34-1.1.6-py2-none-any.whl
Collecting idna>=2.0 (from cryptography>=1.1->paramiko->ansible)
  Using cached idna-2.1-py2.py3-none-any.whl
Collecting cffi>=1.4.1 (from cryptography>=1.1->paramiko->ansible)
  Using cached cffi-1.7.0-cp27-cp27mu-manylinux1_x86_64.whl
Collecting ipaddress (from cryptography>=1.1->paramiko->ansible)
  Using cached ipaddress-1.0.16-py27-none-any.whl
Collecting six>=1.4.1 (from cryptography>=1.1->paramiko->ansible)
  Using cached six-1.10.0-py2.py3-none-any.whl
Collecting pycparser (from cffi>=1.4.1->cryptography>=1.1->paramiko->ansible)
Installing collected packages: MarkupSafe, jinja2, setuptools, PyYAML, 
pycrypto, enum34, idna, pycparser, cffi, ipaddress, six, pyasn1, cryptography, 
paramiko, ansible
Successfully installed MarkupSafe-0.23 PyYAML-3.11 ansible-2.1.0.0 cffi-1.7.0 
cryptography-1.4 enum34-1.1.6 idna-2.1 ipaddress-1.0.16 jinja2-2.8 
paramiko-2.0.1 pyasn1-0.1.9 pycparser-2.14 pycrypto-2.6.1 setuptools-24.0.3 
six-1.10.0
Segmentation fault (core dumped)
```

I tried installing only a few packages to see if one in particular causes the 
bug and yes, cffi may be the one:

```
$ python -m pip install --user cffi
Collecting cffi
  Using cached cffi-1.7.0-cp27-cp27mu-manylinux1_x86_64.whl
Collecting pycparser (from cffi)
Installing collected packages: pycparser, cffi
Successfully installed cffi-1.7.0 pycparser-2.14
Segmentation fault (core dumped)
```

But not pycparser alone:

```
$ python -m pip install --user pycparser
Collecting pycparser
Installing collected packages: pycparser
Successfully installed pycparser-2.14
```

--
components: Interpreter Core
messages: 270633
nosy: sizeof
priority: normal
severity: normal
status: open
title: Segfault in gcmodule.c:360 visit_decref
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



[issue26974] Crash in Decimal.from_float

2016-07-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f8cb955efd6a by Stefan Krah in branch '3.5':
Issue #26974: Fix segfault in the presence of absurd subclassing. Proactively
https://hg.python.org/cpython/rev/f8cb955efd6a

--
nosy: +python-dev

___
Python tracker 

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



[issue26974] Crash in Decimal.from_float

2016-07-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Couldn't keeping references in static variables cause problems in 
subinterpreters?

--

___
Python tracker 

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



[issue27531] Documentation for assert_not_called() has wrong signature

2016-07-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b43f61118793 by Berker Peksag in branch '3.5':
Issue #27531: Update signature of Mock.assert_not_called method
https://hg.python.org/cpython/rev/b43f61118793

New changeset f4541c56c353 by Berker Peksag in branch 'default':
Issue #27531: Merge from 3.5
https://hg.python.org/cpython/rev/f4541c56c353

--
nosy: +python-dev

___
Python tracker 

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



[issue27531] Documentation for assert_not_called() has wrong signature

2016-07-17 Thread Berker Peksag

Berker Peksag added the comment:

Good catch, thanks Michael!

--
nosy: +berker.peksag
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue26974] Crash in Decimal.from_float

2016-07-17 Thread Stefan Krah

Stefan Krah added the comment:

These are builtin static types. Even with non-builtin static types, the address 
of the type should always be the same. C-extensions aren't reloaded.

--

___
Python tracker 

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



[issue27487] -m switch regression in Python 3.5.2 (under rare circumstances)

2016-07-17 Thread Nick Coghlan

Nick Coghlan added the comment:

Running pre-imported top level packages like "runpy" or "site" with "-m" is 
supported behaviour, so that shouldn't emit a warning. ("python -m site" in 
particular is a debugging tool used to print out the default sys.path 
configuration)

Otherwise, the warning mostly looks good to me, except I'd suggest either 
dropping the word "any" from "any parent packages", or else replacing it with 
the word "all" (since the key point to be conveyed is that by the time the 
module starts executing and this check is made, all the parent packages have 
already been imported, thus triggering their side effects, if any).

--

___
Python tracker 

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



[issue26974] Crash in Decimal.from_float

2016-07-17 Thread Stefan Krah

Stefan Krah added the comment:

Also, IMO the whole capsule mechanism would be broken if function pointers in 
dynamic libs could just be invalidated due to reloading.

--

___
Python tracker 

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



[issue27541] Repr of collection's subclasses

2016-07-17 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger

___
Python tracker 

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



[issue26974] Crash in Decimal.from_float

2016-07-17 Thread Stefan Krah

Stefan Krah added the comment:

I'm leaving this open in case anyone wants to do something about the Python 
version. I tend to agree with Raymond:

It is impractical to "fix" all such constructs in the Python version, unless 
one consistently uses a style like:

   float.as_integer_ratio(float.__abs__(-1.5))

--
resolution:  -> fixed
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



[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-07-17 Thread Martin Teichmann

Martin Teichmann added the comment:

Currently, a class is created as follows: the compiler turns the class 
statement into a call to __build_class__. This runs the class body. If 
__class__ or super() is used within a method of the class, an empty PyCell is 
created, to be filled later with the class once its done.

The class body returns this cell. Then the metaclass is called to create the 
actual class, and finally the cell is set to whatever the metaclass returns.

This has the disadvantage that in the metaclasses __new__ and __init__, 
__class__ and super() are not set. This is a pity, especially because the two 
parameter version of super() doesn't work either, as the class is not yet bound 
to a name.

The attached patch lets the compiler add said cell as __classcell__ to the 
classes namespace, where it will later be taken out by type.__new__ in order to 
be properly filled.

This resembles the approach used for __qualname__, with the difference that 
__qualname__ is already added at the beginning of the classes body, such that 
it is visible to the user.

This way __class__ will be properly set immediately after it is created, thus 
all methods are immediately usable, already in a metaclasses __new__ or 
__init__.

This changes the behavior if a metaclass returns another class. currently, 
__build_class__ will try to set the __class__ in the methods of the class body 
to whatever __new__ returns, which might be completely unrelated to the classes 
body.

--
keywords: +patch
Added file: http://bugs.python.org/file43765/pep487.patch

___
Python tracker 

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



[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-07-17 Thread Martin Teichmann

Changes by Martin Teichmann :


Removed file: http://bugs.python.org/file38604/patch

___
Python tracker 

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



[issue27533] release GIL in nt._isdir

2016-07-17 Thread R. David Murray

R. David Murray added the comment:

Correct, 2.7 is not in security fix only mode (yet), but new features (anything 
that changes an API) or bug fixes that we wouldn't put in a maintenance release 
(things that would break existing programs) are not allowed.  A special 
exception has been made for 2.7 for performance enhancements; we wouldn't 
normally do those in a maintenance release unless they were significant.

But as Steve says, it depends on a core developer being interested in applying 
the fix/backport.  Which we may have, we'll wait and see :)

--
nosy: +r.david.murray

___
Python tracker 

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



[issue27535] Memory leaks when opening tons of files

2016-07-17 Thread R. David Murray

R. David Murray added the comment:

I recommend rejecting this.  Properly closing flies is the correct programming 
habit, which is why the ResourceWarning exists.  The Pillow example seems to 
just indicate that people using Pillow need to pay attention to the 
ResourceWarning and close the files they open with pillow.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue27525] Wrong OS header on file created by gzip module

2016-07-17 Thread R. David Murray

Changes by R. David Murray :


--
resolution:  -> rejected
stage:  -> resolved

___
Python tracker 

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



[issue27538] Segfault on error in code object checking

2016-07-17 Thread R. David Murray

R. David Murray added the comment:

I don't think this is a bug.  You can construct whatever code object you like; 
it is your responsibility at that point to make sure it is correct.  This is an 
example of why we call Python a "consenting adults" language.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue27541] Repr of collection's subclasses

2016-07-17 Thread R. David Murray

R. David Murray added the comment:

It certainly seems that collections should be consistent about this.  The 
question of builtin types is a different issue, and I agree that it is probably 
way more trouble than it is worth to change them, especially since, for 
example, repr(str) is often used just to get the quote marks in contexts where 
you *don't* want the subclass name.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue27535] Memory leaks when opening tons of files

2016-07-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thus, the problem is that even ignored warnings are saved. If there is a simple 
fix of this problem we can fix it. But if there is no simple and 
straightforward way, it may be not worth to complicate the code for such case. 
I'll look at the code.

--
assignee:  -> serhiy.storchaka
priority: normal -> low
versions: +Python 3.6 -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



[issue27540] msvcrt.ungetwch() calls _ungetch()

2016-07-17 Thread Eryk Sun

Eryk Sun added the comment:

Parsing the argument is also broken:

static PyObject *
msvcrt_ungetwch(PyObject *self, PyObject *args)
{
Py_UNICODE ch;

if (!PyArg_ParseTuple(args, "u:ungetwch", &ch))
return NULL;

if (_ungetch(ch) == EOF)
return PyErr_SetFromErrno(PyExc_IOError);
Py_INCREF(Py_None);
return Py_None;
}

Format "u" is a `Py_UNICODE *`. There's no "C" format code in 2.x, so it will 
first have to check that the string length is exactly 1 and then use index 0.

--
components: +Windows
nosy: +eryksun, paul.moore, steve.dower, tim.golden, zach.ware
stage:  -> needs patch

___
Python tracker 

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



[issue27538] Segfault on error in code object checking

2016-07-17 Thread Ned Deily

Ned Deily added the comment:

I agree with RDM. CPython makes no guarantee that you can't crash the 
interpreter if you really try to.  "Consenting adult" means we don't impose 
performance penalties on everyone just to protect some users from their own 
attempts to exploit edge cases.

--
nosy: +ned.deily
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



[issue27541] Repr of collection's subclasses

2016-07-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It looks to me that the repr of a collection contains a dynamic name if it is 
implemented in Python and hardcoded base name if it is implemented in C 
(OrderedDict originally was implemented in Python). Maybe just because tp_name 
contains full qualified name, and extracting a bare class name needs few lines 
of code.

There is similar issue with the io module classes: issue21861.

Since this problem is already solved for OrderedDict, I think it is easy to use 
this solution in other classes. Maybe factoring out the following code into 
helper function.

const char *classname;

classname = strrchr(Py_TYPE(self)->tp_name, '.');
if (classname == NULL)
classname = Py_TYPE(self)->tp_name;
else
classname++;

--

___
Python tracker 

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



[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-07-17 Thread Martin Teichmann

Changes by Martin Teichmann :


Removed file: http://bugs.python.org/file43765/pep487.patch

___
Python tracker 

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



[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-07-17 Thread Martin Teichmann

Changes by Martin Teichmann :


Added file: http://bugs.python.org/file43766/pep487.patch

___
Python tracker 

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



[issue27538] Segfault on error in code object checking

2016-07-17 Thread Ned Deily

Ned Deily added the comment:

Let me add that, in principle, no one is opposed to making Python more 
fault-tolerant, certainly if there are demonstrable cases where the behavior 
can be exploited to deny services to others.  Cases like this, where it would 
seem that exploiters could only deny service to themselves, are much less 
interesting.  If someone were to submit a patch with tests and with 
benchmarking to show that the fix has minimal performance implications, a core 
developer might be inclined to review it.  But that seems like a lot of work 
for little gain when there are far more important problems that need attention. 
 Hence "consenting adults".

--
resolution: not a bug -> wont fix

___
Python tracker 

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



[issue26662] configure/Makefile doesn't check if "python" command works, needed to build Objects/typeslots.inc

2016-07-17 Thread Xavier de Gaye

Xavier de Gaye added the comment:

This patch follows the first mechanism listed by Martin. The change in 
configure.ac fixes the problem described by Victor, it does not generate an 
empty Objects/typeslots.inc file when python is not found that would cause the 
cryptic " : invalid slot offset" errors on subsequent 
builds.

The change in Objects/typeslots.py is not strictly necessary to fix the problem 
but prevents typeslots.py to create an invalid typeslots.inc file through the 
previous stdout redirection mechanism when, for example, typeslots.py is 
modified inadvertently with a change that is not python2 compatible and 
typeslots.py is run by python2 and fails.

--
nosy: +xdegaye
stage:  -> patch review
versions: +Python 3.5
Added file: http://bugs.python.org/file43767/py_for_gen_26662.patch

___
Python tracker 

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



[issue26662] configure/Makefile doesn't check if "python" command works, needed to build Objects/typeslots.inc

2016-07-17 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Forgot to say that with the patch and no python in $PATH, the following error 
message is output:
$ touch Include/typeslots.h
$ make
Cannot generate Objects/typeslots.inc, python not found !
Re-run configure with python in PATH.
make: *** [Makefile:908: Objects/typeslots.inc] Error 1

--

___
Python tracker 

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



[issue27538] Segfault on error in code object checking

2016-07-17 Thread pablo sacristan

pablo sacristan added the comment:

I do agree it is not a very big problem, but it is still a problem. If a python 
program took user input (maybe HTTP server) took user input (POST values) and 
construct a code object with that input. It would be possible to crash it and 
that can be bad for the web application. Even though it is not the most 
important Python problem, it is still a problem which can cause moderate 
problems, and it can be exploited remotely if the HTTP server did what I said 
before. One vulnerable HTTP server is one too many ;)
Hope it helps :)

--
resolution: wont fix -> remind
status: closed -> open

___
Python tracker 

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



[issue27538] Segfault on error in code object checking

2016-07-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If you construct a code object with user input without a checking, the segfault 
is the least of your problems. The user can inject a code that formats your 
hard disk or steals your passwords. It is impossible to write general checker 
that accepts all legitimate bytecode, but rejects malicious bytecode.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27538] Segfault on error in code object checking

2016-07-17 Thread Ned Deily

Changes by Ned Deily :


--
resolution: remind -> wont fix
status: open -> closed

___
Python tracker 

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



[issue27538] Segfault on error in code object checking

2016-07-17 Thread pablo sacristan

pablo sacristan added the comment:

Yes, but it is possible to blacklist some bytecode (it may be possible to 
blacklist all or almost all malicious bytecode) and even more if the attacker 
just wants to crash the target then the segfault would be an easy crash. It is 
still an attack scenario that is possible.
Hope it helps :)

--

___
Python tracker 

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



[issue27542] Segfault in gcmodule.c:360 visit_decref

2016-07-17 Thread Ned Deily

Ned Deily added the comment:

Try installing cffi from source rather than using the pre-compiled wheel:


python -m pip uninstall cffi
python -m pip install -v --no-use-wheel --user cffi

If that works, there could be an incompatibility between the Python 2.7.12 you 
are using and the C extensions in the wheel.  What platform are you on and what 
is the source of the Python 2.7?

--
nosy: +ned.deily

___
Python tracker 

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



[issue27543] from module import function creates package reference to the module

2016-07-17 Thread Marc

New submission from Marc:

Hello,

I've found an issue in python 2.7 and 3.4 and I don't if this is a bug or a 
feature that acts strange to me.

The import of a module or method from a module creates a reference in the 
package to that module only the first time, which could lead to unexpected 
behavior.

Description:
In following code there's one line marked with 'this line fixes the code to 
what I expected'
1. Without that line package.a.test() results in 'from module a'
2. With the line package.a.test() results in 'from module b'

Situation 1 is unexpected because I did not create the reference to 'module a', 
python did that with the statement 'from package.a import test' and this will 
happen from any place in the code that loads 'module a' for the first time. The 
documentation says that this reference will not be created. 

Kind regards,

Marc

# FILES USED
#
# test.py
# package
#   __init__.py
#   a.py
#   b.py
# -
# Content of a.py:


def test():
print('from module a')

# -
# Content of a.py:


def test():
print('from module b')

# -
# Content of __init__.py

#import a # <--- this line fixes the code to what I expected
import b as a
from a import test

# -
# Content of test.py

import package

print(dir(package))
package.a.test()

--
components: Interpreter Core
messages: 270658
nosy: m.nijland
priority: normal
severity: normal
status: open
title: from module import function creates package reference to the module
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



[issue27542] Segfault in gcmodule.c:360 visit_decref

2016-07-17 Thread Julien

Julien added the comment:

@Ned

Despite the segfault, cffi installs well, the segfault occurs during a garbage 
collect, very late, inside Py_Exit according to the backtrace, so it has no 
impact.

> What platform are you on and what is the source of the Python 2.7

Debian stretch, python (and sources) 2.7.12-1 from Debian testing packages, pip 
8.1.2 from Debian packages too, version 8.1.2-2.

--

___
Python tracker 

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



[issue27542] Segfault in gcmodule.c:360 visit_decref

2016-07-17 Thread Ned Deily

Ned Deily added the comment:

It would still be interesting to know whether you see the same behavior with 
building from source.  If a cffi extension module is invoked during the install 
process, it might screw things up.  Otherwise, unless you can reproduce the 
problem with a vanilla Python 2.7.12 built from scratch, you'll probably have 
to pursue this with the Debian folks.

--

___
Python tracker 

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



[issue27542] Segfault in gcmodule.c:360 visit_decref

2016-07-17 Thread Julien

Julien added the comment:

@ned Oh ok. I just tried, with `--no-use-wheel`: no segfault.

--

___
Python tracker 

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



[issue27542] Segfault in gcmodule.c:360 visit_decref

2016-07-17 Thread Stefan Krah

Stefan Krah added the comment:

Which makes me think that --no-use-wheel should be the default in pip ...

As a Linux user I'm *very* uneasy about this whole binary wheel thing.

--
nosy: +skrah

___
Python tracker 

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



[issue27543] from module import function creates package reference to the module

2016-07-17 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +brett.cannon, eric.snow, ncoghlan

___
Python tracker 

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



[issue27542] Segfault in gcmodule.c:360 visit_decref

2016-07-17 Thread Ned Deily

Ned Deily added the comment:

Thanks for trying!  Perhaps the first thing to do is to check with the cffi 
project; perhaps Armin will recognize something.  I'm going to mark this issue 
as "closed" but feel free to re-open it if a problem with Python turns up.

--
resolution:  -> third party
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



[issue27542] Segfault in gcmodule.c:360 visit_decref

2016-07-17 Thread Julien

Julien added the comment:

CFFI issue, like for the record: 
https://bitbucket.org/cffi/cffi/issues/272/segfault-while-installing-via-pip

--

___
Python tracker 

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



[issue27540] msvcrt.ungetwch() calls _ungetch()

2016-07-17 Thread Armin Rigo

Armin Rigo added the comment:

Uh, you're right.  Then I can also add that putwch() strangely checks for 
unicode strings of length != 0 instead of == 1, despite what it says it its 
error message.  These functions appear not to be tested or even (in case of 
ungetwch()) used by anyone.

--

___
Python tracker 

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



[issue27535] Memory leaks when opening tons of files

2016-07-17 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I would like to see this fixed.  It is rather unfortunate that a tool designed 
to help find possible resource leaks is itself a certain resource leak.

--
nosy: +rhettinger

___
Python tracker 

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



[issue26662] configure/Makefile doesn't check if "python" command works, needed to build Objects/typeslots.inc

2016-07-17 Thread Martin Panter

Martin Panter added the comment:

The PYTHON_FOR_GEN scheme seems reasonable to me, as is changing the way 
typeslots script is run.

I do wonder about the advice in the message. If I ran into the problem, I would 
probably either override PYTHON_FOR_GEN when running Make, or try something 
like “make touch” instead. But that’t not a big deal.

--

___
Python tracker 

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



[issue27543] from module import function creates package reference to the module

2016-07-17 Thread Brett Cannon

Brett Cannon added the comment:

I'm not at a computer where I can verify what you're seeing, Marc,but I should 
mention that at least for Python 3 your imports are wrong as you should be 
doing relative imports, e.g. `from . import b as a`, otherwise the imports 
won't work unless you're accidentally executing Python from within the 
directory of the package.

--

___
Python tracker 

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



[issue27377] Add smarter socket.fromfd()

2016-07-17 Thread Martin Panter

Martin Panter added the comment:

The Windows problem, error 10022 = WSAEINVAL from getsockname(), seems to be 
documented at 
:
 “The socket has not been bound”.

Regarding the SCTP problem, raising an error seems like an OS bug to  me. 
However, according to POSIX 
, 
we cannot rely on getsockname() indicating any particular address family if the 
socket is unbound.

So on some platforms, it seems like it will only work with bound sockets, or 
you have to use less-standard options like SO_PROTOCOL_INFO or SO_DOMAIN. 
Although SO_DOMAIN won’t help on Free BSD. The simplest solution may be to 
document and test that it only works with bound sockets.

For the problem with SO_PROTOCOL being unsupported at run-time, I think it 
would be better to anticipate EINVAL now, rather than wait for someone to 
complain. But it is not a big deal.

--

___
Python tracker 

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



[issue19142] Cross-compile fails trying to execute foreign pgen on build host

2016-07-17 Thread Martin Panter

Changes by Martin Panter :


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

___
Python tracker 

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



[issue27490] ARM cross-compile: pgen built without $(CFLAGS) as $(LIBRARY) dependency

2016-07-17 Thread Martin Panter

Martin Panter added the comment:

I am happy to repurpose this bug to improve how code generators like pgen work 
if you want. Or open a separate report if you think that is best.

My problem with the proposal involving PGEN_DEPS0 is that it relies on makefile 
syntax intended for changing filename suffixes, and it is hard to understand. I 
wonder if it is better to solve the problem with e.g. documentation and 
manually overriding it with ‘make PGEN_DEP="" ’.

--

___
Python tracker 

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



[issue27543] from module import function creates package reference to the module

2016-07-17 Thread R. David Murray

R. David Murray added the comment:

The same example can be constructed for python3 by modifying the imports.

I think what is happening here is that if a has not yet been imported, then 
when 'from .a import test' is done, the import machinery loads a and then 
defines 'a' in the local namespace, overriding the previous 'import package.b 
as a'.  On the other hand, if a has already been imported, the import machinery 
finds 'a' in sys.modules and skips the import-and-set-name-in-local-namespace 
step.

IMO the bug is that 'a' gets set at all when 'from a import test' is done, but 
the fact that it does so has a long history.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue27544] Document checking dict types

2016-07-17 Thread hannah

New submission from hannah:

While there is documentation that dict.keys(), dict.values(), and dict.items() 
are now view 
objects(https://docs.python.org/3/library/stdtypes.html#dict-views), there's no 
mention dictviews, dict_keys, dict_values, and dict_items not being built-ins. 
This is confusing because type(dict.keys()) returns dict_keys, 
type(dict.values()) returns dict_values, etc., and the documentation uses 
`dictview` as the object signature, and so it's unclear how to do object 
introspection on dictview objects. 

The #python-dev channel suggested that the canonical way to do the object 
introspection is to use the collections.abc.mapview types; the documentation 
for dicts should reflect this (and that dictview and the rest are not 
__builtin__ types/in the python namspace).

--
assignee: docs@python
components: Documentation
messages: 270672
nosy: docs@python, story645
priority: normal
severity: normal
status: open
title: Document checking dict types
type: enhancement
versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue27544] documentiona of dict view types

2016-07-17 Thread hannah

Changes by hannah :


--
title: Document checking dict types -> documentiona of dict view types

___
Python tracker 

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



[issue8238] Proxy handling very slow

2016-07-17 Thread Martin Panter

Martin Panter added the comment:

If this is still a problem, you should narrow down what is causing the 
slowdown. If you interrupt it, what is the stack trace?

My best guess is perhaps there is a bypass hostname setting and a slow or 
failing DNS lookup. A call to urllib.proxy_bypass() was added in 2.6.4 for 
Issue 6894, and in 2.6.5 the Windows registry implementation called 
gethostname() and gethostbyname(). Perhaps this is fixed by Issue 1648102.

--
components: +Windows -None
nosy: +martin.panter, paul.moore, steve.dower, tim.golden, zach.ware
status: open -> pending
superseder:  -> proxy_bypass in urllib handling of  macro
title: Proxy handling -> Proxy handling very slow

___
Python tracker 

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



[issue27544] documentiona of dict view types

2016-07-17 Thread Emanuel Barry

Emanuel Barry added the comment:

"The #python-dev channel" being me in this context ;) Patch attached.

--
keywords: +patch
nosy: +ebarry
stage:  -> patch review
Added file: http://bugs.python.org/file43768/dict_view_doc_1.patch

___
Python tracker 

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



[issue27544] Document the ABCs for instance/subclass checks of dict view types

2016-07-17 Thread Emanuel Barry

Changes by Emanuel Barry :


--
title: documentiona of dict view types -> Document the ABCs for 
instance/subclass checks of dict view types

___
Python tracker 

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



[issue23722] During metaclass.__init__, super() of the constructed class does not work

2016-07-17 Thread Guido van Rossum

Guido van Rossum added the comment:

I don't think this requires adding it to the PEP, and I think doing this is 
fine. (But I can't review the code.)

--
nosy: +gvanrossum

___
Python tracker 

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



[issue27543] from module import function creates package reference to the module

2016-07-17 Thread Brett Cannon

Brett Cannon added the comment:

So the problem is that you doing `from .a import test` and not `from . import 
a; test = a.test`. Whenever you do `from X import Y`, import actually imports 
X. Since X wasn't in sys.modules, it performs a proper import which means it 
sets the attribute on the package accordingly. But had Y been what you were 
after, then import simply looks for the Y attribute on the package instead of 
doing a full import.

IOW everything is working as expected (and I still wish people weren't allowed 
to import objects out of modules directly).

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

___
Python tracker 

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



[issue27545] missing pyshellext.vcxproj prevents puilding 3.6

2016-07-17 Thread Decorater

New submission from Decorater:

I have a issue with building 3.6 now since I got the last hg update it seems 
the github repo is broken too. This does need a fix.

--
components: Build
messages: 270677
nosy: Decorater
priority: normal
severity: normal
status: open
title: missing pyshellext.vcxproj prevents puilding 3.6
type: compile error
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



[issue27545] missing pyshellext.vcxproj prevents puilding 3.6

2016-07-17 Thread Xiang Zhang

Xiang Zhang added the comment:

Could you post the error message and your platform? I just tried and everything 
went fine.

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue27545] missing pyshellext.vcxproj prevents puilding 3.6

2016-07-17 Thread Decorater

Decorater added the comment:

I am using Win32 and x64 configurations and this is the error:
E:\Users\Elsword\Desktop\DecoraterBot\Async\DecoraterBot-indev\python36-indev\c
python\PCbuild\pcbuild.proj(78,5): error MSB3202: The project file "pyshellext.
vcxproj" was not found.

--

___
Python tracker 

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



[issue27545] missing pyshellext.vcxproj prevents puilding 3.6

2016-07-17 Thread Decorater

Decorater added the comment:

Also I am using the windows target OS on it as well.

--

___
Python tracker 

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



[issue27545] missing pyshellext.vcxproj prevents puilding 3.6

2016-07-17 Thread Eryk Sun

Eryk Sun added the comment:

Steve committed part of the update for the new shell extension DLL in changeset 
6b0023810108. I didn't notice because I have the patch from issue 27469 
imported in order to build and test pyshellext.dll.

--
components: +Windows
nosy: +eryksun, paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue27545] missing pyshellext.vcxproj prevents puilding 3.6

2016-07-17 Thread Steve Dower

Steve Dower added the comment:

Whoops, that wasn't supposed to slip in. I'll fix :)

--
assignee:  -> steve.dower
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



[issue27545] missing pyshellext.vcxproj prevents puilding 3.6

2016-07-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d044e03fbed6 by Steve Dower in branch '3.5':
Closes #27545: Remove pyshellext.vcxproj from pcbuild.proj
https://hg.python.org/cpython/rev/d044e03fbed6

New changeset f7a161e48af8 by Steve Dower in branch 'default':
Closes #27545: Remove pyshellext.vcxproj from pcbuild.proj
https://hg.python.org/cpython/rev/f7a161e48af8

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



[issue27533] release GIL in nt._isdir

2016-07-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ebf9a4c933e9 by Steve Dower in branch '3.5':
Issue #27533: Release GIL in nt._isdir
https://hg.python.org/cpython/rev/ebf9a4c933e9

New changeset 8823c660820e by Steve Dower in branch 'default':
Issue #27533: Release GIL in nt._isdir
https://hg.python.org/cpython/rev/8823c660820e

--
nosy: +python-dev

___
Python tracker 

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



[issue27533] release GIL in nt._isdir

2016-07-17 Thread Steve Dower

Changes by Steve Dower :


--
assignee:  -> steve.dower
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



[issue27469] Unicode filename gets crippled on Windows when drag and drop

2016-07-17 Thread Steve Dower

Steve Dower added the comment:

Thanks, I've merged that change into my patch.

I doubt anyone else is going to build and test this, but just in case I'll let 
it set for a couple of days before merging. Perhaps someone will at least look 
at the code.

--

___
Python tracker 

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



[issue27417] Call CoInitializeEx on startup

2016-07-17 Thread Steve Dower

Steve Dower added the comment:

Mark's argument is strong, so I'm withdrawing this proposal.

Thanks for the discussion and comments, everyone!

--
resolution:  -> rejected
status: open -> closed

___
Python tracker 

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



[issue27407] prepare_ssl.py missing in PCBuild folder

2016-07-17 Thread Steve Dower

Steve Dower added the comment:

Giving this to Zach to resolve/close as he feels appropriate.

--
assignee:  -> zach.ware

___
Python tracker 

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



[issue27546] Integrate tkinter and asyncio (and async)

2016-07-17 Thread Terry J. Reedy

New submission from Terry J. Reedy:

The last week of last February, there was a discussion of this topic on 
python-ideas as part of "How the heck does async/await work in Python 3.5".  I 
would like to re-start the discussion along with rescuing the two big chunks of 
code that were posted.

Guido, you said "it would be very useful to have an asyncio loop integrated 
with Tkinter".  Were you thinking of something added to either the asyncio or 
tkinter modules? What would be the minimum that you think would be worth 
adding?  What would a mininal test look like?

There are, of course, multiple strategies.  Maxime posted the code I copied 
into the attached tkselector.py.  No example usage was given.  I cannot run it 
on Windows because it uses a unix-only function.

Maxime, for us to use this, you need to sign the contributor agreement, which 
can be done via the net.  See https://www.python.org/psf/contrib/

As soon as I submit this, I will also upload my tkloop.py.  It defines a 
TkEventLoop class that adds root.update in the run_forever method.  It then 
uses the class for working example of a asyncio callback modifying a tk widget 
at times intervals.  As I note in the doc string, there is an issue with 
asyncio's _run_once() blocking forever.  I recently noticed that 
idlelib.run.main does something similar, running a loop that gets user input 
with 1/20 second timeout and calling tkapp.eval('update') whenever there is 
none.

Motivations:

1. Mix gui events (key, mouse, and others) with i/o events.

2. Use gui events with the new async syntax.  My simple example, in the 
callback typical of tkinter apps, has widgets, callback, and dynamics defined 
in different places.  I would like to be able to write the app in a more 
'natural' style, using loops: something like

async def display_date(interval, end_time, loop=ai.get_event_loop()):
label = tk.Label(root)
label.pack()
async for tick in timer(interval, end_time, loop):
 label['text'] = datetime.datetime.now()

Some python-tkinter beginners try to do something like this, except that for 
time delays they use while and time.sleep.  There have been many Stackoverflow 
questions about the resulting failures.  I would like to find out if 

I presume that converting my example to something like the above, using 
TkEventLoop, could be done easily enough by someone who knows how.

For only supporting tk events, it would be better to have a tkinter 
implementation of the needed subset of asyncio.events.AbstractEventLoop. The 
run and call methods are needed, the io methods not, but I am not sure where to 
draw the line in between.  The implementation of a few methods should be fairly 
easy: run_forever is mainloop, close is destroy; run_until_complete will be 
harder.

--
files: tkselector.py
messages: 270688
nosy: Maxime S, gvanrossum, serhiy.storchaka, terry.reedy, yselivanov
priority: normal
severity: normal
stage: test needed
status: open
title: Integrate tkinter and asyncio (and async)
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file43769/tkselector.py

___
Python tracker 

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



[issue27546] Integrate tkinter and asyncio (and async)

2016-07-17 Thread Terry J. Reedy

Changes by Terry J. Reedy :


Added file: http://bugs.python.org/file43770/tkloop.py

___
Python tracker 

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



[issue27469] Unicode filename gets crippled on Windows when drag and drop

2016-07-17 Thread Decorater

Decorater added the comment:

Oh and when the shell extension is done could you make a custom icon for pyd's 
and have the desciption of "Python C Compiled DLL" to easy selcting them when 
you have no icons for any *.lib, *.exp and *.pdb's Would ease up comping pyd 
files as well.

On further note it seems that python (when told to read from python36.zip seems 
to not read any pyd's that are in the zip as well) I would like for it to be 
able too if someone wants to embed PyNacl with _sodium.cp36-win32.pyd or 
_sodium.cp36-win_amd64.pyd files in it.

(Also readign pyd's in the zips could also simplify things like a ImportError 
on stuff that is actually there.

--
nosy: +Decorater

___
Python tracker 

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



[issue27469] Unicode filename gets crippled on Windows when drag and drop

2016-07-17 Thread Steve Dower

Steve Dower added the comment:

A custom icon for .pyd files doesn't require a shell extension - it only really 
requires the icon.

I don't want to use the same as .pyc, since that has the implication that it 
can be deleted safely, or .py, since that can be double-clicked. So we'd need 
something new.

The rest of the request requires exposing new public APIs in Windows so that we 
can load executables from arbitrary memory locations. That's not something I 
can fix here :)

--

___
Python tracker 

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



[issue27309] Visual Styles support to tk/tkinter file and message dialogs

2016-07-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7ffb7f3c345d by Steve Dower in branch '3.5':
Issue #27309: Enables proper Windows styles in python[w].exe manifest.
https://hg.python.org/cpython/rev/7ffb7f3c345d

New changeset da735eb8b7a2 by Steve Dower in branch 'default':
Issue #27309: Enables proper Windows styles in python[w].exe manifest.
https://hg.python.org/cpython/rev/da735eb8b7a2

--
nosy: +python-dev

___
Python tracker 

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



[issue27309] Visual Styles support to tk/tkinter file and message dialogs

2016-07-17 Thread Steve Dower

Steve Dower added the comment:

Updated the manifest to include the correct common controls DLL, which ensures 
the correct style is used for native dialogs.

I applied this to Python 3.5 and 3.6, since it's not a behavioural change and 
should not break any code, and arguably since it's been the recommended default 
for all apps targeting XP or later it's a bug that we weren't already doing it.

--
assignee:  -> steve.dower
resolution:  -> fixed
stage: test needed -> resolved
status: open -> closed
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



[issue27546] Integrate tkinter and asyncio (and async)

2016-07-17 Thread Guido van Rossum

Guido van Rossum added the comment:

I expect it should eventually be added to tkinter. But I also think it
might be worthwhile to first develop it as a 3rd party package on
PyPI, to see if it can actually be done well enough to put it in the
stdlib.

I guess a demo app should be part of the project; the demo should show
that some independently developed asyncio code (perhaps derived from
examples/crawl.py in the asyncio repo) can run while also maintaining
a UI built using Tkinter responsive. Ideally there would also be a
demonstration of how the UI and the crawl code interact. And no
threads.

--

___
Python tracker 

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



[issue26624] Windows hangs in call to CRT setlocale()

2016-07-17 Thread Decorater

Decorater added the comment:

Cant someone just copy these dlls from Windows 10 itself if they have it 
installed?

ucrtbase:  10.0.14295.1000  (03/19/2016)
ucrtbased: 10.0.10586.15(11/20/2015)
vcruntime140d: 14.0.23506.0 (11/05/2015)

I have windows 10 on another partition btw so I could manually update mine to 
fix this stuff on my windows 7. thank god for 64 bit OSes.

--
nosy: +Decorater

___
Python tracker 

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



[issue26624] Windows hangs in call to CRT setlocale()

2016-07-17 Thread Steve Dower

Steve Dower added the comment:

You should get these files by installing the latest Windows 10 SDK (regardless 
of your OS - the SDK version relates to the latest it can target, not the 
latest it can be used on).

For some reason, they decided it shouldn't be "automatic" to update the SDK 
when you're updating other parts of the compiler toolset. I'll bring it up next 
time I chat to those guys at work.

--

___
Python tracker 

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



[issue27469] Unicode filename gets crippled on Windows when drag and drop

2016-07-17 Thread Eryk Sun

Eryk Sun added the comment:

Steve, will you be uploading a new patch? The current patch doesn't include 
"pyshellext.vcxproj" in the build, since that was accidentally committed and 
then removed. 

When you call ShellExecute, I suggest passing NULL for lpOperation, to use the 
default verb. If no default is defined the shell uses "open" anyway.

Decorater, there's a memory importer for extension modules in py2exe, based on 
Joachim Bauch's MemoryModule.c:

https://sourceforge.net/p/py2exe/svn/HEAD/tree/trunk/py2exe-3/source

--

___
Python tracker 

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



[issue27469] Unicode filename gets crippled on Windows when drag and drop

2016-07-17 Thread Steve Dower

Steve Dower added the comment:

Sure, added a new patch with all of your suggestions. I also added 
pyshellext.vcxproj to pcbuild.sln.

(And my final word on the magic used to load DLLs from memory is that I'm not 
willing to maintain that code within CPython itself, so it won't be going into 
the core unless someone steps up with a 10+ year promise to look after it.)

--
stage:  -> patch review
Added file: http://bugs.python.org/file43771/27469_2.patch

___
Python tracker 

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



[issue27469] Unicode filename gets crippled on Windows when drag and drop

2016-07-17 Thread Decorater

Decorater added the comment:

I actually like py2exe's memory loader.

--

___
Python tracker 

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



  1   2   >