[issue28898] Can't compile gdb with Python 3.6

2016-12-08 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Why do you think this change caused that breakage? That bot looks like it's 
been broken for days. This change should have no behavior change whatsoever for 
Python itself.

--

___
Python tracker 

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



[issue28916] Not matched behavior of modulo operator % with the description of the documentation

2016-12-08 Thread Martin Panter

Martin Panter added the comment:

Looks like a leftover relic from Python 2. In Python 3, the prefix is “0o”, not 
just “0”. This matches to change in Python 2 to 3 octal literal syntax. And 
there is no special handling of zero in 3:

>>> "%#o" % 0
'0o0'

--
nosy: +martin.panter
stage:  -> needs patch
versions: +Python 3.6, Python 3.7

___
Python tracker 

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



[issue28917] Docs: Add missing protocol to pickle

2016-12-08 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Hi, isn't it documented here? 
https://docs.python.org/3.7/library/pickle.html#pickle.Pickler

"If a negative number is specified, HIGHEST_PROTOCOL is selected."

--
nosy: +Mariatta

___
Python tracker 

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



[issue28902] 3.6.0rc1 installer fails to install / uninstall.

2016-12-08 Thread Steve Dower

Steve Dower added the comment:

Ah, did you change the default install directory to be the same as your 
previous install? Yeah, that's bad :) There's other registration information 
that we look at, so we don't even try and look at the existing files.

However, if you didn't change the directory, then that's a really bad bug on 
our side. But I think we'd be hearing many more issues if that was the problem.

--

___
Python tracker 

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



[issue28917] Docs: Add missing protocol to pickle

2016-12-08 Thread Anand Reddy Pandikunta

New submission from Anand Reddy Pandikunta:

In Python 2.7, it is documented. It is missing in Python 3 documentation.

--
assignee: docs@python
components: Documentation
files: docs_pickle_add_missing_protocol.patch
keywords: patch
messages: 282764
nosy: ChillarAnand, abz64, docs@python, r.david.murray
priority: normal
severity: normal
status: open
title: Docs: Add missing protocol to pickle
type: enhancement
versions: Python 3.7
Added file: 
http://bugs.python.org/file45810/docs_pickle_add_missing_protocol.patch

___
Python tracker 

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



[issue28912] collections.abc.OrderedMapping

2016-12-08 Thread Joshua Bronson

Joshua Bronson added the comment:

I only just found the "[Python-ideas] Adding collections.abc.Ordered" thread at 
https://mail.python.org/pipermail/python-ideas/2015-November/037146.html - 
sorry for not seeing it sooner. Looking forward to catching up on what I missed.

--

___
Python tracker 

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



[issue28916] Not matched behavior of modulo operator % with the description of the documentation

2016-12-08 Thread woo yoo

New submission from woo yoo:

Mismatch occurs within the "Notes" section,row 1.Here is the 
link:https://docs.python.org/3/library/stdtypes.html#old-string-formatting

The course of coding shows below:
>>>'%#07o' % 1223
Result value is '0o02307',which is not in line with the description.

Description is "The alternate form causes a leading zero ('0') to be inserted 
between left-hand padding and the formatting of the number if the leading 
character of the result is not already a zero."

--
assignee: docs@python
components: Documentation
messages: 282762
nosy: docs@python, woo yoo
priority: normal
severity: normal
status: open
title: Not matched behavior of modulo operator % with the description of the 
documentation
type: behavior
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



[issue28912] collections.abc.OrderedMapping

2016-12-08 Thread Joshua Bronson

Joshua Bronson added the comment:

Come to think of it, to be exact, rather than extending Reversible, 
OrderedMapping could extend a narrower interface, something like 
collections.abc.Ordered, along with extending Mapping. (Reversible implies 
Ordered, but Ordered does not imply Reversible: a singly-linked list is Ordered 
but not Reversible, for example.)

I guess we don't currently have Ordered because it wouldn't necessarily add any 
abstractmethods beyond what Iterable already provides. But it could provide a 
generic, concrete __eq__ implementation, something like:

class Ordered(Iterable):
def __eq__(self, other):
if not isinstance(other, Ordered):
return NotImplemented
return all(i == j for (i, j) in zip(self, other))


which is not something that any existing collections.abc Iterable currently 
provides.

Even if an Ordered interface that's totally empty were available in the 
standard library, then Iterables across diparate codebases could opt into 
extending it as a standard signal that they iterate over their elements in a 
well-defined order, and could participate in other polymorphic code. Currently 
we have no such standard signal, do we?

--

___
Python tracker 

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



[issue28091] Document PEP 525

2016-12-08 Thread Eric Appelt

Eric Appelt added the comment:

I think this needs considerable checking and polishing, but I am submitting 
this "Work In Progress" patch for the PEP525 and PEP530 documentation so that I 
can get some general feedback since I am new to this, and to ensure that if 
this is not generally what was needed or expected I don't delay the effort.

I tried to start where possible by using the wording in corresponding generator 
sections, so this may err on the side of redundant phrasing, which I can change.

I had some difficulty with the following points, and am not sure if they merit 
opening other tickets:

1. In PEP525 the documentation for aclose() is a bit terse and unclear to me. 
It appeared to suggest that you could catch GeneratorExit and yield, but I 
found this to result in a RuntimeError like a normal generator. I tried to 
document this as it actually behaves.

2. One thing that I noticed documented about normal generators is that they 
raise a ValueError if you try to run send() while another send() call is 
currently running. I verified this using threads. I looked into corresponding 
behavior for asynchronous generators, calling asend(), running the awaitable 
halfway through, and then calling asend() again to get a second awaitable 
before the first one finished. Asyncio seems to prevent more than one awaitable 
from a single async generator running at the same time, but I couldn't figure 
out how. Running some coroutines "by hand" calling asend() and send(), I was 
permitted to run multiple awaitables concurrently which produced odd results.

I did not attempt to document the behavior in (2) in the submitted patch.

--
keywords: +patch
Added file: http://bugs.python.org/file45809/pep525_pep530_docs_WIP.patch

___
Python tracker 

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



[issue28902] 3.6.0rc1 installer fails to install / uninstall.

2016-12-08 Thread Decorater

Decorater added the comment:

Ah I know what the problem is now. It is the fact that the 32 Bit Webinstaller 
does not check to see if a 64 bit version is installed at the folder that the 
32 bit version is set to to uninstall the 64 bit version 1st thereby it 
overwrites the data to the 36 bit install without removing the registry entries 
for the 64 bit install. Thereby why I cant uninstall, repair, or even reinstall 
the 64 bit version.

--

___
Python tracker 

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



[issue28835] Change in behavior when overriding warnings.showwarning and with catch_warnings(record=True)

2016-12-08 Thread Nick Coghlan

Nick Coghlan added the comment:

If the intended reference was to #28897, then yes, it was related: NumPy had 
introduced a workaround for the regression that existed in the beta releases 
(presumably thinking it was an intentional change that just hadn't been added 
to the porting guide yet), and this fix for the regression broke their 
workaround.

Reverting the workaround on the NumPy side restored compatibility :)

--

___
Python tracker 

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



[issue28914] selectmodule build fails

2016-12-08 Thread Wataru Matsumoto

Wataru Matsumoto added the comment:

I'm using Red Hat Enterprise.
cat /proc/version 
Linux version 2.6.18-238.9.1.el5 (mockbu...@x86-002.build.bos.redhat.com) (gcc 
version 4.1.2 20080704 (Red Hat 4.1.2-50)) #1 SMP Fri Mar 18 12:42:39 EDT 2011

--

___
Python tracker 

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



[issue23395] _thread.interrupt_main() errors if SIGINT handler in SIG_DFL, SIG_IGN

2016-12-08 Thread Wataru Matsumoto

Wataru Matsumoto added the comment:

Recently I've encountered the similar problem.
I found the case that SIGINT signal is ignored(set as SIG_IGN) due to the 
external reason.
If the python program starts background in bash script, bash set SIGINT as 
SIG_IGN.

test_interrupt.py
import _thread
_thread.interrupt_main()

run.sh
#!/bin/bash
python test_interrupt.py &
sleep 1s

./run.sh 
Traceback (most recent call last):
  File "test_interrupt.py", line 2, in 
_thread.interrupt_main()
RuntimeError: the SIGINT signal is ignored
(it was TypeError: 'int' object is not callable before the patch)

Python mapped default_int_handler to SIG_INT on SIG_DFL in PyInit__signal.
As the python developer can't control how the program is started, it may be 
better to setup default_int_handler regardless the handler type.

And initially SIG_INT is mapped to default_int_handler but once signal.signal 
is called, the mapping is lost even though the SIG_DFL is specified.
It may need to handle SIG_INT specially in signal_signal_impl as well to keep 
the consistent behavior.

--

___
Python tracker 

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



[issue22294] 2to3 consuming_calls: len, min, max, zip, map, reduce, filter, dict, xrange

2016-12-08 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue28874] test_logging fails and freezes

2016-12-08 Thread STINNER Victor

STINNER Victor added the comment:

What is your OS? A Linux on bare metal? Or a container? What are versions of 
Linux kernel, libc and C compiler? Or more generally the name and verison of 
your Linux distro?

There are many errors:

* test_fcntl failed
* test_import failed
* test_epoll failed

Can you please run only these tests in verbose mode, and attach the output?

Example:

./python -m test -v test_fcntl test_import test_epolls

--
nosy: +haypo

___
Python tracker 

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



[issue28898] Can't compile gdb with Python 3.6

2016-12-08 Thread STINNER Victor

STINNER Victor added the comment:

The OpenIndiana uses gcc and has the long long type. Extract of the ./configure 
script:
---
checking for gcc... gcc
(...)
checking size of long long... 8
---
http://buildbot.python.org/all/builders/AMD64%20OpenIndiana%203.x/builds/37/steps/configure/logs/stdio

--

___
Python tracker 

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



[issue28898] Can't compile gdb with Python 3.6

2016-12-08 Thread STINNER Victor

STINNER Victor added the comment:

Oh, the problem has introduced a crash on OpenIndiana:
---
Fatal Python error: Aborted

Current thread 0x0001 (most recent call first):
  File 
"/export/home/buildbot/64bits/3.x.cea-indiana-amd64/build/Lib/ctypes/__init__.py",
 line 273 in _reset_cache
...
---

http://buildbot.python.org/all/builders/AMD64%20OpenIndiana%203.x/builds/37/steps/test/logs/stdio

--

___
Python tracker 

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



[issue23395] _thread.interrupt_main() errors if SIGINT handler in SIG_DFL, SIG_IGN

2016-12-08 Thread Wataru Matsumoto

Changes by Wataru Matsumoto :


--
nosy: +sxsns243

___
Python tracker 

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



[issue28875] test fails and freezes

2016-12-08 Thread Whitequill Riclo

Whitequill Riclo added the comment:

It was an accident. I didn't know if I had mistakenly closed it the first
time.

On Mon, Dec 5, 2016 at 7:21 AM, Berker Peksag 
wrote:

>
> Berker Peksag added the comment:
>
> Please do not reopen this one. You already opened issue 28874.
>
> --
> nosy: +berker.peksag
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue28915] Modify PyObject_CallFunction() to use fast call internally

2016-12-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b771cf37714b by Victor Stinner in branch 'default':
Add _PyObject_FastCallVa() helper
https://hg.python.org/cpython/rev/b771cf37714b

New changeset 455169e87bb3 by Victor Stinner in branch 'default':
Add _PyObject_CallFunctionVa() helper
https://hg.python.org/cpython/rev/455169e87bb3

New changeset dd0d162593c5 by Victor Stinner in branch 'default':
modsupport: replace int with Py_ssize_t
https://hg.python.org/cpython/rev/dd0d162593c5

New changeset 69d5dcf31f4a by Victor Stinner in branch 'default':
modsupport: replace int with Py_ssize_t
https://hg.python.org/cpython/rev/69d5dcf31f4a

New changeset c1414b182232 by Victor Stinner in branch 'default':
Add _Py_VaBuildStack() function
https://hg.python.org/cpython/rev/c1414b182232

New changeset 69948a157507 by Victor Stinner in branch 'default':
_PyObject_CallFunctionVa() uses fast call
https://hg.python.org/cpython/rev/69948a157507

New changeset b9eb35435178 by Victor Stinner in branch 'default':
Don't parenthesis in _PyObject_CallMethodId() format
https://hg.python.org/cpython/rev/b9eb35435178

New changeset 67302e6caa29 by Victor Stinner in branch 'default':
Use _PyObject_CallMethodIdObjArgs()
https://hg.python.org/cpython/rev/67302e6caa29

New changeset 032cbdb596fe by Victor Stinner in branch 'default':
build_struct_time() uses Py_BuildValue()
https://hg.python.org/cpython/rev/032cbdb596fe

New changeset 49a7fdc0d40a by Victor Stinner in branch 'default':
time_strptime() uses PyObject_Call()
https://hg.python.org/cpython/rev/49a7fdc0d40a

New changeset 6e748eb79038 by Victor Stinner in branch 'default':
Add _PyObject_VaCallFunctionObjArgs() private function
https://hg.python.org/cpython/rev/6e748eb79038

New changeset adcd9131b7c6 by Victor Stinner in branch 'default':
Use _PyObject_FastCallVa() in type slots
https://hg.python.org/cpython/rev/adcd9131b7c6

--
nosy: +python-dev

___
Python tracker 

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



[issue28914] selectmodule build fails

2016-12-08 Thread STINNER Victor

STINNER Victor added the comment:

Probably a regression caused by the change ac24e5c2fd3e.

I'm curious: what is your Linux distribution? (Can't you get a more Linux 
kernel?)

--
nosy: +haypo

___
Python tracker 

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



[issue28915] Modify PyObject_CallFunction() to use fast call internally

2016-12-08 Thread STINNER Victor

STINNER Victor added the comment:

bench_slots.py: microbenchmark on __int__ and __getitem__ slots.

--
Added file: http://bugs.python.org/file45808/bench_slots.py

___
Python tracker 

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



[issue28915] Modify PyObject_CallFunction() to use fast call internally

2016-12-08 Thread STINNER Victor

New submission from STINNER Victor:

This issue tracks changes to support the "fast call" calling convention in 
functions:

* PyObject_CallFunctionObjArgs()
* PyObject_CallMethodObjArgs()
* _PyObject_CallMethodIdObjArgs()

A "stack" of Python objects is created to pass arguments to 
_PyObject_FastCall(). The goal is to avoid the creation of a temporary tuple to 
call functions.

The patch serie changes slots (typeobject.c), so calling Python slots from 
Python should avoid completely the creation of temporary tuples to pass 
parameters.


Microbenchmark on a simple class with an __int__() method, call int(o):

int(o): Median +- std dev: [ref] 239 ns +- 13 ns -> [patch] 219 ns +- 14 ns: 
1.10x faster (-9%)


Microbenchmark on a simple class with an __getitem__() method, call o[100]:

o[100]: Median +- std dev: [ref] 211 ns +- 11 ns -> [patch] 172 ns +- 11 ns: 
1.23x faster (-19%)


Comparison between Python 2.7, 3.5, 3.7 and 3.7+patch, 3.5 is used as the 
reference:

int(o)
==

Median +- std dev: [3.5] 271 ns +- 15 ns -> [3.7] 239 ns +- 13 ns: 1.13x faster 
(-12%)
Median +- std dev: [3.5] 271 ns +- 15 ns -> [patch] 219 ns +- 14 ns: 1.24x 
faster (-19%)
Median +- std dev: [3.5] 271 ns +- 15 ns -> [2.7] 401 ns +- 21 ns: 1.48x slower 
(+48%)

o[100]
==

Median +- std dev: [3.5] 206 ns +- 5 ns -> [3.7] 211 ns +- 11 ns: 1.02x slower 
(+2%)
Not significant!
Median +- std dev: [3.5] 206 ns +- 5 ns -> [patch] 172 ns +- 11 ns: 1.20x 
faster (-17%)
Median +- std dev: [3.5] 206 ns +- 5 ns -> [2.7] 254 ns +- 15 ns: 1.23x slower 
(+23%)

--
messages: 282748
nosy: haypo
priority: normal
severity: normal
status: open
title: Modify PyObject_CallFunction() to use fast call internally
type: performance
versions: Python 3.7

___
Python tracker 

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



[issue26267] UUID docs should say how to get "standard form"

2016-12-08 Thread Ammar Askar

Ammar Askar added the comment:

I've updated the patch to document the comparison operators in prose instead of 
with markup as requested.

--
Added file: http://bugs.python.org/file45807/uuiddocs.diff5

___
Python tracker 

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



[issue28914] selectmodule build fails

2016-12-08 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +berker.peksag

___
Python tracker 

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



[issue22294] 2to3 consuming_calls: len, min, max, zip, map, reduce, filter, dict, xrange

2016-12-08 Thread Roy Williams

Changes by Roy Williams :


--
nosy: +Roy Williams

___
Python tracker 

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



[issue28914] selectmodule build fails

2016-12-08 Thread Wataru Matsumoto

New submission from Wataru Matsumoto:

selectmodule build fails with the linux without epoll_create1(before kernel 
2.6.27).


building 'select' extension
gcc -pthread -fPIC -fno-strict-aliasing -Wsign-compare -g -O0 -Wall 
-Wstrict-prototypes -std=c99 -Wextra -Wno-unused-parameter 
-Wno-missing-field-initializers -I./Include -I. -I/usr/local/include 
-I/home/wmatsumo/download/cpython/Include -I/home/wmatsumo/download/cpython -c 
/home/wmatsumo/download/cpython/Modules/selectmodule.c -o 
build/temp.linux-x86_64-3.7-pydebug/home/wmatsumo/download/cpython/Modules/selectmodule.o
/home/wmatsumo/download/cpython/Modules/selectmodule.c: In function 
'pyepoll_new':
/home/wmatsumo/download/cpython/Modules/selectmodule.c:1306: error: 
'EPOLL_CLOEXEC' undeclared (first use in this function)
/home/wmatsumo/download/cpython/Modules/selectmodule.c:1306: error: (Each 
undeclared identifier is reported only once
/home/wmatsumo/download/cpython/Modules/selectmodule.c:1306: error: for each 
function it appears in.)

It seems due to the below change.
http://bugs.python.org/issue20100
It have to check HAVE_EPOLL_CREATE1 is defined before using EPOLL_CLOEXEC.

--
files: selectmodule.patch
keywords: patch
messages: 282746
nosy: sxsns243
priority: normal
severity: normal
status: open
title: selectmodule build fails
type: compile error
versions: Python 3.7
Added file: http://bugs.python.org/file45806/selectmodule.patch

___
Python tracker 

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



[issue28913] "Fatal Python error: Cannot recover from stack overflow." from RecursionError in Python 3.5

2016-12-08 Thread STINNER Victor

Changes by STINNER Victor :


--
title: "Fatal Python error: Cannot recover from stack overflow." from 
RecursionError -> "Fatal Python error: Cannot recover from stack overflow." 
from RecursionError in Python 3.5

___
Python tracker 

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



[issue28913] "Fatal Python error: Cannot recover from stack overflow." from RecursionError

2016-12-08 Thread Richard Eames

New submission from Richard Eames:

I've been porting a project to the latest version of Django, and due to one of 
the changes in the Django, caused a recursion error in my code. However, the 
error (under certain conditions) then causes the python interpreter to core 
dump. I'm not 100% sure what causes this to happen, but it does seem to be 
similar to https://bugs.python.org/issue6028

I've created a minimal django project: 
https://github.com/Naddiseo/python-core-dump

However, it does rely on some interaction between mysql, pymysql, and django to 
be reproduced, the latter two being 100% python code. I'm sorry that I could 
not reduce the test case further.

One of the interesting/weird things about this bug is that (on my machine at 
least) it requires exactly 15 entries in the `MIDDLEWARE` variable in 
"coredump/settings.py" in my test project, any more, or any less will cause the 
interpreter to issue a `RecursionError` as expected, but not to core dump. 

This appears to happen in 3.5, and not in 3.6 so perhaps whatever fix was 
applied to 3.6 can be backported to 3.5 so that it doesn't core dump?

--
components: Interpreter Core
messages: 282745
nosy: Richard Eames
priority: normal
severity: normal
status: open
title: "Fatal Python error: Cannot recover from stack overflow." from 
RecursionError
type: crash
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



[issue28912] collections.abc.OrderedMapping

2016-12-08 Thread Joshua Bronson

Joshua Bronson added the comment:

This patch improves the OrderedMapping.__eq__ implementation to be more generic 
in the case that ``other`` is an unordered Mapping of the same length as 
``self``.

--
Added file: http://bugs.python.org/file45805/jab-orderedmapping-2.patch

___
Python tracker 

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



[issue28147] Unbounded memory growth resizing split-table dicts

2016-12-08 Thread Ned Deily

Ned Deily added the comment:

I think these proposed patches need careful review but, even so, given the 
extent of the fix28147-py36-2.patch changes, I don't think they should go into 
3.6.0 at the last minute.  Unless somebody can convince me otherwise, I'm going 
to let this wait for 3.6.1.

--

___
Python tracker 

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



[issue28912] collections.abc.OrderedMapping

2016-12-08 Thread Joshua Bronson

New submission from Joshua Bronson:

Since code can be clearer than prose, I just sketched this idea out in the 
attached patch. Please take a look at it as a minimum demonstration of the 
concept.

Rationale:

The Python standard library provides collections.OrderedDict, along with 
several ABCs which OrderedDict extends, such as collections.abc.Mapping and (as 
of 3.6) collections.abc.Reversible, to enable better composability and 
interoperability.

Currently there is no collections.abc.OrderedMapping ABC, but I wonder if there 
should be. OrderedMapping could provide a concrete, generic implementation of 
__eq__, that performed an order-sensitive comparison when passed another 
OrderedMapping, while performing an order-insensitive comparison when passed an 
unordered Mapping. Then OrderedDict could derive from OrderedMapping, 
inheriting its generic __eq__ implementation, rather than implementing its own 
__eq__ method. Currently, OrderedDict's own __eq__ implementation does 
``isinstance(other, OrderedDict)`` to decide whether to perform an 
order-sensitive comparison, which thwarts interoperability. OrderedMapping 
could also derive from Reversible, signaling that classes that extend it 
implement __reversed__.

The interoperability gain here is not just theoretical. Several packages are 
published on PyPI which would be able to interoperate better if they could all 
extend a common OrderedMapping interface. Grant Jenks' 
sortedcontainers.SortedDict[1] and my own bidict.OrderedBidict[2] are two 
particularly popular examples.

Thanks for your consideration, and look forward to your feedback.

[1] http://www.grantjenks.com/docs/sortedcontainers/sorteddict.html
[2] https://bidict.readthedocs.io/en/dev/other-bidict-types.html#orderedbidict

--
components: Library (Lib)
files: jab-orderedmapping-1.patch
keywords: patch
messages: 282742
nosy: gvanrossum, jab, rhettinger
priority: normal
severity: normal
status: open
title: collections.abc.OrderedMapping
type: enhancement
Added file: http://bugs.python.org/file45804/jab-orderedmapping-1.patch

___
Python tracker 

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



[issue28867] NamedTemporaryFile does not generate a ResourceWarning for unclosed files (unlike TemporaryFile)

2016-12-08 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



[issue22343] Install bash activate script on Windows when using venv

2016-12-08 Thread Brandon VanVaerenbergh - NOAA Affiliate

Brandon VanVaerenbergh - NOAA Affiliate added the comment:

+1 just experienced this issue migrating from Python3.4 to Python3.5 on windows 
with bash (MINGW git bash) as primary shell

Temporarily resolved issue (on this workstation) by simply copying 
Python35\Lib\venv\scripts\posix\activate file, into folder: 
Python35\Lib\venv\scripts\nt\

then recreating venv

--
nosy: +Brandon VanVaerenbergh - NOAA Affiliate
versions: +Python 3.6, Python 3.7

___
Python tracker 

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



[issue28911] Clarify the behaviour of assert_called_once_with

2016-12-08 Thread Arne de Laat

New submission from Arne de Laat:

The name assert_called_once_with and the current method documentation can be 
interpreted to mean that it asserts that there is precisely one call matching 
the given signature, regardless of the total number of calls. However, the 
method first checks that there is precisely one call, and then checks if that 
call has a signature matching the provided signature.

Additionally, the assert_any_call method documentation references 
assert_called_once_with in a way that enforces the possible misinterpretation: 
"… assert_called_with and assert_called_once_with that only pass if the call is 
the most recent one". This may lead to the interpretation that there must be 
only one call with the given signature and  that it must be the most recent 
one, it must in fact be the only one.

In the mock examples documentation there is an important sentence that 
clarifies the actual functionality: "you can use the assert_called_once_with 
method that also asserts that the call_count is one".

The example provided in the method documentation also does not satisfactorily 
address the ambiguity, because it only calls the mock with one call signature. 
By changing the call signature of the second call (and in the assert) in the 
example the purpose of the method becomes clearer.

--
assignee: docs@python
components: Documentation, Tests
files: assert_once_with_doc.patch
keywords: patch
messages: 282740
nosy: 153957, docs@python
priority: normal
severity: normal
status: open
title: Clarify the behaviour of assert_called_once_with
type: enhancement
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45803/assert_once_with_doc.patch

___
Python tracker 

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



[issue28910] Async generator does not raise RuntimeError if finalizer not set

2016-12-08 Thread Yury Selivanov

Yury Selivanov added the comment:

fix: 
https://github.com/python/peps/commit/3e23210fe3aebefb269436e16246f63e1f006291

--

___
Python tracker 

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



[issue28910] Async generator does not raise RuntimeError if finalizer not set

2016-12-08 Thread Yury Selivanov

Yury Selivanov added the comment:

> I'm not sure if this is a bug, or this is intentional and the finalizer 
> mechanism should be optional. If it is the latter should PEP525 get updated?

This is intentional, PEP 525 is slightly outdated.  I'll update it right now.  
Thanks for reporting this!

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



[issue28910] Async generator does not raise RuntimeError if finalizer not set

2016-12-08 Thread Eric Appelt

New submission from Eric Appelt:

While testing my understanding in order to document PEP525 asynchronous 
generators in the Language Reference (issue 28091) I noticed that the 
implemented behavior deviates from PEP525, specifically the PEP states that:

"When an asynchronous generator is iterated for the first time, it stores a 
reference to the current finalizer. If there is none, a RuntimeError is raised. 
This provides a strong guarantee that every asynchronous generator object will 
always have a finalizer installed by the correct event loop."

I created an asynchronous generator to try to run calling __anext__ 
interactively without an event loop to check the behavior, and was surprised 
when I didn't get a RuntimeError even though I had not called 
sys.set_asyncgen_hooks() to set a finalizer function.

I looked at the function async_gen_init_hooks defined in Objects/genobject.c 
and it appears that if the thread state async_gen_finalizer is NULL, then it 
just returns zero and allows the calling function to continue.

I'm not sure if this is a bug, or this is intentional and the finalizer 
mechanism should be optional. If it is the latter should PEP525 get updated?

--
components: Interpreter Core
messages: 282737
nosy: Eric Appelt, yselivanov
priority: normal
severity: normal
status: open
title: Async generator does not raise RuntimeError if finalizer not set
type: behavior
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue28906] Can't inherit sockets with multiprocessing on Windows

2016-12-08 Thread Eryk Sun

Changes by Eryk Sun :


--
stage:  -> resolved

___
Python tracker 

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



[issue28906] Can't inherit sockets with multiprocessing on Windows

2016-12-08 Thread Preston Landers

Preston Landers added the comment:

Wow, good call. That does work for me. Wish I had thought to try it. I assume 
you want me to go ahead and close the issue. Sorry for the noise, but this 
really helps!

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



[issue28908] pydoc getdocloc() is broken

2016-12-08 Thread R. David Murray

R. David Murray added the comment:

It is possible that we only care about this for release builds.  I don't think 
maintain a hard-coded, hand-coded list is a good idea, regardless.  There might 
be some way to generate it at build time, though.

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



[issue28909] Adding LTTng-UST tracing support

2016-12-08 Thread Zachary Ware

Changes by Zachary Ware :


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue28835] Change in behavior when overriding warnings.showwarning and with catch_warnings(record=True)

2016-12-08 Thread Martin Panter

Martin Panter added the comment:

Brett, what was the other bug? The bug number you posted is for this bug.

--

___
Python tracker 

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



[issue28909] Adding LTTng-UST tracing support

2016-12-08 Thread Francis Deslauriers

New submission from Francis Deslauriers:

This patch extends the tracing infrastructure to support LTTng UserSpace
Tracer. Using LTTng-UST, users would have access to a low overhead tracing 
done entirely from userspace.

Depending on the tracing configure option used (none, --with-dtrace or
--with-lttngust) macros will be expanded to probes and tracepoints of the
desired tracer if any. Only the needed instrumentation will be added to the
binary. This technique is used to different degrees by other projects like 
Qemu[1] and Node.js[2].

I attached a patch adding this feature. I tested the changes and the 
instrumentation on LTTng-UST and SystemTap on Ubuntu 16.04. I would 
appreciate if someone could test those changes on macOS and other
platforms supporting USDT probes.

[1]https://github.com/qemu/qemu/blob/master/configure#L4303
[2]https://github.com/nodejs/node/blob/master/configure#L811

--
files: 0001-Add-LTTng-UST-probe-and-tracepoints.patch
keywords: patch
messages: 282733
nosy: Francis Deslauriers
priority: normal
severity: normal
status: open
title: Adding LTTng-UST tracing support
type: enhancement
versions: Python 3.7
Added file: 
http://bugs.python.org/file45802/0001-Add-LTTng-UST-probe-and-tracepoints.patch

___
Python tracker 

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



[issue28908] pydoc getdocloc() is broken

2016-12-08 Thread Neil Schemenauer

Neil Schemenauer added the comment:

Attached is a first pass at the idea of just keeping a list of standard modules 
that have docs.  I generated the list with:

$ (cd Doc/library; ls *.rst | sed 's/.rst//')

Probably that should be incorporated into the Doc/Makefile somehow.

Perhaps instead of generating a text file, we should generate a Python module 
that contains a set literal, e.g. Lib/pydoc_data/libs.py.  That would have the 
advantage of working for frozen distributions or stdlib as Zip files.

--
Added file: http://bugs.python.org/file45801/pydoc_getdocloc.txt

___
Python tracker 

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



[issue25711] Rewrite zipimport from scratch

2016-12-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is preliminary translation of zipimport to Python. It is not frozen and 
imports other modules. I tried to keep the implementation close to C 
implementation. As a consequence, some raised exceptions look arbitrary.

--
keywords: +patch
stage:  -> patch review
type:  -> enhancement
versions: +Python 3.7 -Python 3.6
Added file: http://bugs.python.org/file45800/zipimport.patch

___
Python tracker 

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



[issue28906] Can't inherit sockets with multiprocessing on Windows

2016-12-08 Thread Eryk Sun

Changes by Eryk Sun :


--
components: +Windows
nosy: +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



[issue28906] Can't inherit sockets with multiprocessing on Windows

2016-12-08 Thread Eryk Sun

Eryk Sun added the comment:

You should be able to directly pass the socket to the child process. 
multiprocessing registers a reduction for this. On Windows it uses the 
DupSocket class from multiprocessing.resource_sharer:

class DupSocket(object):
'''Picklable wrapper for a socket.'''
def __init__(self, sock):
new_sock = sock.dup()
def send(conn, pid):
share = new_sock.share(pid)
conn.send_bytes(share)
self._id = _resource_sharer.register(send, new_sock.close)

def detach(self):
'''Get the socket.  This should only be called once.'''
with _resource_sharer.get_connection(self._id) as conn:
share = conn.recv_bytes()
return socket.fromshare(share)

This calls the Windows socket share() method [1], which calls 
WSADuplicateSocket [2]. In the child, socket.fromshare() passes the protocol 
info buffer to the socket constructor, which passes it to WSASocket [3].

[1]: https://docs.python.org/3/library/socket.html#socket.socket.share
[2]: https://msdn.microsoft.com/en-us/library/ms741565
[3]: https://msdn.microsoft.com/en-us/library/ms742212

--
nosy: +eryksun

___
Python tracker 

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



[issue28908] pydoc getdocloc() is broken

2016-12-08 Thread Neil Schemenauer

New submission from Neil Schemenauer:

The getdocloc() method in pydoc.py is supposed to return the doc location for 
modules.  It uses a 'basedir' parameter that is supposed to point to the 
location of the standard library modules.

That logic is broken for a number of different scenarios, I think.  One is if 
you build Python in a sub-directory, not in the root of the source tree.  
Another I think is if you are using a Zip file for the std lib.

Fixing this properly is not so easy.  One solution would be to explictly mark 
modules that have docs available.  E.g. create a __pydoc global variable or 
similar that the 'pydoc' module to inspect.  That would have to be done on 
every module that has documentation.

Another idea is at build time, crawl through Doc/library and generate a list of 
modules that have docs.  That's a bit tricky because that generation needs to 
work on all platforms that Python is built on.

A third idea is to manually add the list to the pydoc.py module.  When new 
documentation is created under Doc/library, that list would have to be updated.

--
components: Library (Lib)
messages: 282729
nosy: nascheme
priority: normal
severity: normal
stage: needs patch
status: open
title: pydoc getdocloc() is broken
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue28907] test_pydoc fails if build is in sub-directory

2016-12-08 Thread Neil Schemenauer

New submission from Neil Schemenauer:

test_pydoc is failing for me for 3.6rc1.  I build in a sub-directory, e.g. 
Python-3.6.0rc1/build-opt.  The root of the issue is that pydoc getdocloc() is 
broken.  It cannot build 'basedir' as it does and assume that is the location 
of standard modules.  Fixing that is tricky though, I will open a separate 
issue for that.

For this issue, I think the test_mixed_case_module_names_are_lower_cased() 
function needs to be fixed to handle that case that get_pydoc_link() returns 
None.  I.e. it thinks that the module is not a standard module and so returns 
no link.

Attached is a patch.  It is trivial and I think should go into 3.6.

--
assignee: r.david.murray
components: Tests
files: test_pydoc_fix.txt
messages: 282728
nosy: nascheme, r.david.murray
priority: high
severity: normal
stage: patch review
status: open
title: test_pydoc fails if build is in sub-directory
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file45799/test_pydoc_fix.txt

___
Python tracker 

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



[issue28425] Python3 ignores __init__.py that are links to /dev/null

2016-12-08 Thread Douglas Greiman

Douglas Greiman added the comment:

Is there a reasonable place to document that __init__.py (and probably source 
files in general) must be a "regular file" by the Unix definition, and not a 
device file, socket, etc?

--

___
Python tracker 

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



[issue28905] re.sub appears not to check count optional argument for integerness

2016-12-08 Thread R. David Murray

R. David Murray added the comment:

See issue 28082.

--
nosy: +r.david.murray
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> re: convert re flags to (much friendlier) IntFlag constants

___
Python tracker 

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



[issue28835] Change in behavior when overriding warnings.showwarning and with catch_warnings(record=True)

2016-12-08 Thread Brett Cannon

Brett Cannon added the comment:

I just happened to look at that bug before seeing this bug and both mentioned 
recording issues so I thought I would mention there was a chance of a 
connection.

--

___
Python tracker 

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



[issue28896] Embeddable zip allows Windows registry to override module location

2016-12-08 Thread Alexey Izbyshev

Alexey Izbyshev added the comment:

Thanks to Steve and everyone for quick and decisive action!

--

___
Python tracker 

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



[issue28906] Can't inherit sockets with multiprocessing on Windows

2016-12-08 Thread Preston Landers

New submission from Preston Landers:

I'm porting a Python 2.6 based application to Python 3.6. This app uses a 
customized version of the "flup" package to do FastCGI services on Windows 
using the multiprocessing package. This requires a few sockets to be inherited 
across processes - the main FastCGI protocol socket plus a control socket.

In Python 2.6, the `socket.from_fd` function was not available on Windows. 
However I patched Python's socketmodule.c to provide that function using 
DuplicateHandle. In Python 2.6's version of multiprocessing it spawned a 
process with CreateProcess and bInheritHandles=True. This worked well for me.

Now I'm trying to get this working after moving from Python 2.6 to 3.6 
(currently using 3.6.0b4). Fortunately, the socket module now has a working 
`socket.from_fd` on Windows so I no longer have to patch that. Unfortunately 
for me, though, the multiprocessing module now calls CreateProcess with 
bInheritHandles=False. This causes my scenario to fail.

Here's a short test script which illustrates this problem:
https://gist.github.com/Preston-Landers/712fee10fb557cf0b5592b57561a7c08

If you run with an unpatched multiprocessing, it will fail with an error like:

OSError: [WinError 10038] An operation was attempted on something that is not a 
socket

If you patch multiprocessing to set bInheritHandles=True this now works. 
(Change is in popen_spawn_win32.py where it does _winapi.CreateProcess.)

I'm sure there's a good reason for that change in multiprocessing, whether for 
security or for unrelated/undesired file handles being passed.
https://www.python.org/dev/peps/pep-0446/#inheritance-of-file-descriptors-on-windows

However it does break my scenario and I don't see a way to tell multiprocessing 
to allow certain handles to be inherited. The docs for multiprocessing say "In 
particular, unnecessary file descriptors and handles from the parent process 
will not be inherited." It would be nice to have a way to tell it that my 
sockets are "necessary." You would think that calling 
socket.set_inheritable(True) would do it. In fact you must do that, but you 
must also pass bInheritHandles=True to CreateProcess for it to actually work. 
There doesn't seem to be a way to pass through an argument to multiprocessing 
to tell it to set this flag.

I do realize I could be going about this completely wrong, though. But right 
now it looks like my immediate options are:

a) Go ahead and patch my copy of popen_spawn_win32.py to allow inherited 
handles despite other possible risks.

b) Try to rewrite things to not use multiprocessing at all and directly spawn 
my processes instead. That's not attractive because multiprocessing otherwise 
does what I need to do.

Are there any other options I'm missing? Maybe some way to duplicate the socket 
on the other end without relying on CreateProcess with bInheritHandles=True?

Otherwise, I guess I'm asking for an option to be made available in 
multiprocessing to allow handles to be inherited on Windows.

--
components: Library (Lib)
messages: 282723
nosy: planders
priority: normal
severity: normal
status: open
title: Can't inherit sockets with multiprocessing on Windows
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



[issue28905] re.sub appears not to check count optional argument for integerness

2016-12-08 Thread Danny Yoo

Danny Yoo added the comment:

Alternatively, change the representation of flag values from integers to some 
class extension that supports the common bitwise operators.

As a very rough sketch:

>>> class FlagInt(int):
... def __or__(self, other):
... return FlagInt(int(self) | int(other))
... 
>>> f1 = FlagInt(1)
>>> f2 = FlagInt(2)
>>> f1 | f2
3
>>> isinstance(3, FlagInt)
False
>>> isinstance(f1 | f2, FlagInt)
True


That way, flag arguments can be determined at runtime to have derived from the 
proper flag values.

This kind of approach may have some backwards-incompatibility, unfortunately, 
since other folks have been hardcoding integers rather than use the flag 
constants.  Other concerns might include serialization, in case someone tries 
to save a FlagInt somewhere and pull it out at some other time.

--

___
Python tracker 

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



[issue28905] re.sub appears not to check count optional argument for integerness

2016-12-08 Thread Danny Yoo

Danny Yoo added the comment:

Ugh.  I suddenly realize that this is complicated by the fact that flag values 
are themselves represented as integers, and Python's type system isn't rich 
enough to label flag values as a distinct type for the purposes.

It may be worthwhile to add a warning in the documentation about this, as it is 
an easy mistake to make.

--

___
Python tracker 

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



[issue28905] re.sub appears not to check count optional argument for integerness

2016-12-08 Thread Danny Yoo

New submission from Danny Yoo:

This comes from diagnosing a beginner's question on Python-tutor.

https://mail.python.org/pipermail/tutor/2016-December/110066.html

It appears that re.sub is not checking whether the count argument is integer or 
not, and silently accepts a nonsensical argument.  For example:


>>> import re
>>> s = "AAAcBBB\nAAAdBBB"
>>> print(re.sub(r'^AAA', "aaa", s, re.MULTILINE))
aaacBBB
AAAdBBB


Of course, the user intended to pass re.MULTILINE to flags, not to count, but 
the fact that this isn't raising a TypeError is error-prone.

--
components: Library (Lib)
messages: 282719
nosy: Danny Yoo
priority: normal
severity: normal
status: open
title: re.sub appears not to check count optional argument for integerness
type: behavior
versions: Python 3.4

___
Python tracker 

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



[issue28896] Embeddable zip allows Windows registry to override module location

2016-12-08 Thread Steve Dower

Steve Dower added the comment:

I assumed silence meant everyone was happy with the wording, so I extended it 
to whatsnew and NEWS and pushed.

Ned - the changeset above should be good for you to cherrypick.

I'll leave this issue open to cover actually removing the finder from 
sys.meta_path in 3.7 and potentially 3.6.1.

--
assignee:  -> steve.dower
priority: normal -> release blocker
stage:  -> commit review
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



[issue28896] Embeddable zip allows Windows registry to override module location

2016-12-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 25df9671663b by Steve Dower in branch '3.6':
Issue #28896: Deprecate WindowsRegistryFinder
https://hg.python.org/cpython/rev/25df9671663b

New changeset 5376b3a168c8 by Steve Dower in branch 'default':
Issue #28896: Deprecate WindowsRegistryFinder
https://hg.python.org/cpython/rev/5376b3a168c8

--
nosy: +python-dev

___
Python tracker 

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



[issue28901] Windows: document that site is not imported by default by embeddable distribution

2016-12-08 Thread Steve Dower

Steve Dower added the comment:

If you go to the 3.6 version of that doc page and also read the section on 
finding modules, you'll see that the presence of a "python._pth" file causes -S 
(skip importing site) to be implied unless the ._pth file includes "import 
site":

https://docs.python.org/3.6/using/windows.html#finding-modules

You'll then notice that the embeddable distro includes a ._pth file by default 
(though you don't have to distribute that with your app, just as you may want 
to omit the exe files). That could certainly be called out more clearly in the 
section on the embeddable distro, though so far it hasn't come up with anyone 
who's using it for its proper purpose (that I'm aware of).

--

___
Python tracker 

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



[issue28770] Update python-gdb.py for fastcalls

2016-12-08 Thread STINNER Victor

STINNER Victor added the comment:

I fixed the issue in Python 3.6 (future 3.6.1).

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



[issue28770] Update python-gdb.py for fastcalls

2016-12-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f41d02d7da37 by Victor Stinner in branch '3.6':
Issue #28770: Update python-gdb.py for fastcalls
https://hg.python.org/cpython/rev/f41d02d7da37

--

___
Python tracker 

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



[issue28838] Using consistent naming for arguments of "call" functions (C API)

2016-12-08 Thread STINNER Victor

STINNER Victor added the comment:

cleanup-2.patch: Rebase cleanup.patch.

This patch is the last part of my work to cleanup Include/abstract.h to make it 
more consistent with other header files.

--
Added file: http://bugs.python.org/file45798/cleanup-2.patch

___
Python tracker 

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



[issue28898] Can't compile gdb with Python 3.6

2016-12-08 Thread STINNER Victor

STINNER Victor added the comment:

The pushed change 4745d801cae2 LGTM for a cherry-pick in 3.6.0.

--
nosy: +haypo

___
Python tracker 

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



[issue28904] add more format conversion flags eg. "len" and "id"

2016-12-08 Thread Berker Peksag

Changes by Berker Peksag :


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

___
Python tracker 

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



[issue28901] Windows: document that site is not imported by default by embeddable distribution

2016-12-08 Thread Zachary Ware

Zachary Ware added the comment:

Each of those items is added to builtins by site.py, which I believe is not 
imported by default by the embeddable distribution.  I didn't immediately find 
that fact mentioned in the docs, though.

Also note that the embeddable distribution isn't really meant for regular 
usage, it's meant for embedding :).  While this is definitely worth some 
clarification in the docs, it's not a high-priority issue.

+Ethan Smith from #28903.

--
nosy: +Ethan Smith
stage:  -> needs patch
title: Embedded Release interactive mode documentation -> Windows: document 
that site is not imported by default by embeddable distribution

___
Python tracker 

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



[issue28903] Windows Embeddable Python exit not defined

2016-12-08 Thread Zachary Ware

Zachary Ware added the comment:

This is a duplicate of #28901.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Embedded Release interactive mode documentation

___
Python tracker 

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



[issue28904] add more format conversion flags eg. "len" and "id"

2016-12-08 Thread Samuel Colvin

Samuel Colvin added the comment:

I see, I hadn't appreciated fstrings where entirely different and more powerful 
than format(), I'll close this.

For anyone else coming to this, with fstrings in >=3.6 you can do:

In [4]: value = [1,2, 3]

In [5]: f'The value is {value}.'
Out[5]: 'The value is [1, 2, 3].'

In [6]: f'The value is {len(value)}.'
Out[6]: 'The value is 3.'

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



[issue28904] add more format conversion flags eg. "len" and "id"

2016-12-08 Thread R. David Murray

R. David Murray added the comment:

Thanks for the idea, but I think we're going to see a shift away from format 
calls and toward fstrings, so I don't think this is worth doing.  See 
https://www.python.org/dev/peps/pep-0498/#id45; the ! expressions are only 
supported by fstrings only for consistency with format, not because they are 
particularly useful with fstrings.

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



[issue28904] add more format conversion flags eg. "len" and "id"

2016-12-08 Thread Samuel Colvin

Samuel Colvin added the comment:

I know contributing to python is currently a pain (bring on github!) but I'd be 
happy to attempt a patch if others agree this would be useful.

--

___
Python tracker 

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



[issue28904] add more format conversion flags eg. "len" and "id"

2016-12-08 Thread Samuel Colvin

New submission from Samuel Colvin:

(The "Components" selection might be wrong, I wasn't sure what to use)

As https://docs.python.org/3.6/library/string.html

> Three conversion flags are currently supported: '!s' which calls str() on the 
> value, '!r' which calls repr() and '!a' which calls ascii().

It would be great if further conversation flags were added for more built-in 
methods. In particular:
* '!l' for len()
* '!i' for id()

(There might be others but these are the two I would find most useful.)

format() is now very powerful, but it's very common for strings, lists, dicts, 
sets etc. to want to include their length in strings. This is currently ugly.

This enhancement will be even more sought after with string literals in python 
3.6.

Example of when this would be very useful:

v = {'type': 'whatever, 'items': ['foo', 'bar', 'spam']}
'{type}{items!l}'.format(**v)

Would also be very useful with getattr, and getitem usage.

--
components: Library (Lib)
messages: 282707
nosy: Samuel Colvin
priority: normal
severity: normal
status: open
title: add more format conversion flags eg. "len" and "id"
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue28902] 3.6.0rc1 installer fails to install / uninstall.

2016-12-08 Thread Steve Dower

Steve Dower added the comment:

If you run the installer through the Programs and Features dialog to modify or 
uninstall it should definitely find the current installation (as the 
registration it looks for is the same registration that makes it appear in that 
dialog). Because there are different installers, unfortunately they can't 
always detect each other despite laying down the same version of Python. I too 
would like them to get better at this, but it's not at all simple.

We can't go wiping install information arbitrarily or it will corrupt user 
machines.

For the missing file error, you should have a whole lot of log files in your 
%TEMP% directory. Could you zip them up and attach them here so I can take a 
look at what went wrong?

--

___
Python tracker 

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



[issue26941] android: test_threading hangs on armv7

2016-12-08 Thread Xavier de Gaye

Changes by Xavier de Gaye :


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



[issue28147] Unbounded memory growth resizing split-table dicts

2016-12-08 Thread Jason Madden

Changes by Jason Madden :


--
nosy: +jmadden

___
Python tracker 

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



[issue26941] android: test_threading hangs on armv7

2016-12-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b64ba5604e48 by Xavier de Gaye in branch '3.6':
Issue #26941: Fix test_threading that hangs on the Android armv7 qemu emulator.
https://hg.python.org/cpython/rev/b64ba5604e48

New changeset 8688a664995c by Xavier de Gaye in branch 'default':
Issue #26941: Merge 3.6.
https://hg.python.org/cpython/rev/8688a664995c

--
nosy: +python-dev

___
Python tracker 

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



[issue26940] android: test_importlib hangs on armv7

2016-12-08 Thread Xavier de Gaye

Changes by Xavier de Gaye :


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



[issue26939] android: test_functools hangs on armv7

2016-12-08 Thread Xavier de Gaye

Changes by Xavier de Gaye :


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



[issue28331] "CPython implementation detail:" removed when content translated

2016-12-08 Thread INADA Naoki

Changes by INADA Naoki :


--
nosy: +Julien.Palard, JulienPalard

___
Python tracker 

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



[issue26940] android: test_importlib hangs on armv7

2016-12-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1bb2f4b8440e by Xavier de Gaye in branch '3.6':
Issue #26940: Fix test_importlib that hangs on the Android armv7 qemu emulator.
https://hg.python.org/cpython/rev/1bb2f4b8440e

New changeset e401c5a95758 by Xavier de Gaye in branch 'default':
Issue #26940: Merge 3.6.
https://hg.python.org/cpython/rev/e401c5a95758

--
nosy: +python-dev

___
Python tracker 

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



[issue26939] android: test_functools hangs on armv7

2016-12-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fd1718badb67 by Xavier de Gaye in branch '3.6':
Issue #26939: Add the support.setswitchinterval() function to fix
https://hg.python.org/cpython/rev/fd1718badb67

New changeset c5d7e46926ac by Xavier de Gaye in branch 'default':
Issue #26939: Merge 3.6.
https://hg.python.org/cpython/rev/c5d7e46926ac

--
nosy: +python-dev

___
Python tracker 

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



[issue28147] Unbounded memory growth resizing split-table dicts

2016-12-08 Thread INADA Naoki

INADA Naoki added the comment:

http://bugs.python.org/issue28894 was duplicate of this issue.

Since real world program suffered by this, I'm +1 to fix this by 3.6.0

--

___
Python tracker 

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



[issue21978] Support index access on OrderedDict views (e.g. o.keys()[7])

2016-12-08 Thread INADA Naoki

INADA Naoki added the comment:

While dict is ordered, it doesn't support O(1) random access by index.

--
nosy: +inada.naoki

___
Python tracker 

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



[issue28897] Python 3.6.0rc1 breaks NumPy tests.

2016-12-08 Thread STINNER Victor

STINNER Victor added the comment:

Charles: "OK, you fixed what broke us before. If I revert our fixes
the problem goes away. So, thanks I guess ;) You can close this."

Cool, happy to read that the issue was fixed :-)

If you missed it, the whole mess were backward compatibility when I
extended the warnings API (only internally currently) to implement a
new feature:
https://docs.python.org/dev/whatsnew/3.6.html#warnings

ResourceWarning are now displayed with a traceback where the object
was allocated when tracemalloc is enabled.

--

___
Python tracker 

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



[issue28147] Unbounded memory growth resizing split-table dicts

2016-12-08 Thread INADA Naoki

Changes by INADA Naoki :


Added file: http://bugs.python.org/file45797/fix28147-py36-2.patch

___
Python tracker 

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



[issue28147] Unbounded memory growth resizing split-table dicts

2016-12-08 Thread INADA Naoki

INADA Naoki added the comment:

Here is patch for Python 3.6.

--
Added file: http://bugs.python.org/file45796/fix28147-py36.patch

___
Python tracker 

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



[issue28190] Detect curses headers correctly for cross-compiling

2016-12-08 Thread Matthias Klose

Matthias Klose added the comment:

the upstream ncurses has the ncursesw subdirinclude name, so you apparently can 
assume that this directory name is fixed *iff* it exists, however the ncursesw 
installation can be found in /include instead.  Can your changes cope 
with that?

second issue is that you apparently don't do the changes for term.h (and 
possibly for other headers in other places as well, I only looked at the diff), 
so you mix ncursesw and ncurses headers. So you have to make these changes in 
all other places as well.

Third issue is that you can't make these changes for third party extensions, if 
there are any relying on the ncurses/ncursesw distinction.

fyi, "all" ncursesw headers are:

/usr/include/ncursesw/curses.h
/usr/include/ncursesw/cursesapp.h
/usr/include/ncursesw/cursesf.h
/usr/include/ncursesw/cursesm.h
/usr/include/ncursesw/cursesp.h
/usr/include/ncursesw/cursesw.h
/usr/include/ncursesw/cursslk.h
/usr/include/ncursesw/eti.h
/usr/include/ncursesw/etip.h
/usr/include/ncursesw/form.h
/usr/include/ncursesw/menu.h
/usr/include/ncursesw/nc_tparm.h
/usr/include/ncursesw/ncurses_dll.h
/usr/include/ncursesw/panel.h
/usr/include/ncursesw/term.h
/usr/include/ncursesw/term_entry.h
/usr/include/ncursesw/termcap.h
/usr/include/ncursesw/tic.h
/usr/include/ncursesw/unctrl.h

--

___
Python tracker 

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



[issue28903] Windows Embeddable Python exit not defined

2016-12-08 Thread Ethan Smith

New submission from Ethan Smith:

Hearing about the RC1 today, I downloaded the x64 Windows embeddable zip. I 
opened a Command Prompt window and ran python.exe to try it out.

I was quite surprised when I ran:
>>>exit()
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'exit' is not defined

I read through the notes on the embedded Python releases, but I did not see 
anything that would lead me to believe that exit should not defined.
 
I also downloaded the distribution for 3.5.2, and did not have the same issue, 
which leads me to believe this is unintended behavior.

If this behavior is intended, I do apologize for raising this issue.

OS: Windows 10 x64.

--
components: Windows
messages: 282697
nosy: Ethan Smith, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Windows Embeddable Python exit not defined
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