[issue31905] IPv4Networkcontains raises exception on None

2017-10-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I concur. IPvNetwork is not a general purposed collection. And even genera 
purposed collections can have restrictions on the arguments of "in". E.g.:

>>> [] in {}
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unhashable type: 'list'

Similar issue already was raised (maybe not for IPvNetwork, but for other class 
supporting the "in" operator) and was closed with the same arguments.

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



[issue31905] IPv4Networkcontains raises exception on None

2017-10-31 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution: fixed -> not a bug

___
Python tracker 

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



[issue31907] Clarify error message when attempting to call function via str.format()

2017-10-31 Thread Eric V. Smith

Eric V. Smith  added the comment:

How would you distinguish this from the case where an actually missing 
attribute was given?

>>> "{0.ctimex}".format(d)
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'datetime.datetime' object has no attribute 'ctimex'

I guess it would be possible to change the parser to only look for valid chars 
in an identifier and give an error if there were "extra" chars found, but I'm 
not sure it's worth the hassle. The error message seems clear enough to me. 
Also, I wouldn't want to change this to not be an AttributeError (for backward 
compatibility), and I'm not sure an AttributeError with a different message 
would be good.

Of course, this works with f-strings:

>>> f"{d.ctime()}"
'Tue Oct 31 00:00:00 2017'

And I just realized that your code actually is valid, with a custom 
__getattr__. And while I wouldn't recommend doing this, I also wouldn't want to 
break it. For all I know, people have written custom evaluators in __getattr__:

>>> class C:
... def __getattr__(self, name):
... if name == 'ctime()':
... return 'okay'
... raise AttributeError('not found')
...

>>> '{0.x}'.format(C())
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 5, in __getattr__
AttributeError: not found

>>> '{0.ctime()}'.format(C())
'okay'

I'm changing versions because this would be a new feature, since it breaks 
valid code.

--
assignee:  -> eric.smith
nosy: +eric.smith
status: open -> pending
versions:  -Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.8

___
Python tracker 

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



[issue31901] atexit callbacks only called for current subinterpreter

2017-10-31 Thread Nick Coghlan

Nick Coghlan  added the comment:

Hmm, I don't think calling Py_Finalize in any interpreter other than the main 
one is actually defined at all, so I'm inclined to just make it an error, 
rather than trying to figure out how it should work. It would then be up to the 
embedding application to make sure it switched back to the main interpreter 
before calling Py_Finalize.

(We don't have this concern with Py_Initialize, since that *creates* the main 
interpreter)

--
nosy: +eric.snow, grahamd

___
Python tracker 

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



[issue31901] atexit callbacks only called for current subinterpreter

2017-10-31 Thread Nick Coghlan

Nick Coghlan  added the comment:

For the main interpreter, Py_Finalize should be destroying all other 
subinterpreters as one of the first things it does, so if we're *not* currently 
doing that, it would make sense to fix it as part of Eric's subinterpreters PEP.

--

___
Python tracker 

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



[issue30057] signal.signal should check tripped signals

2017-10-31 Thread STINNER Victor

Change by STINNER Victor :


--
nosy: +pitrou

___
Python tracker 

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



[issue31901] atexit callbacks only called for current subinterpreter

2017-10-31 Thread Petr Viktorin

Petr Viktorin  added the comment:

I don't have a reason to think Py_Finalize is not *destroying* the other 
subinterpreters. But it's not calling their atexit callbacks.

(Is there any reason Py_Finalize couldn't switch to the main interpreter 
itself? Assuming it's even necessary.)

--

___
Python tracker 

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



[issue31901] atexit callbacks only called for current subinterpreter

2017-10-31 Thread Nick Coghlan

Nick Coghlan  added the comment:

I guess we allow an unhandled SystemExit in a child thread to propagate to (and 
hence terminate) the main thread, so allowing a Py_Finalize call in a 
subinterpreter to terminate the main interpreter would be comparable to that.

My main rationale for *requiring* that the main interpreter be active (or be 
made active) when shutting down is to reduce the number of scenarios we need to 
test (right now we only test Py_Initialize/Py_Finalize cycles with a single 
interpreter, and officially allowing finalization from arbitrary interpreters 
expands that test matrix a fair bit).

--

___
Python tracker 

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



[issue31629] Running test_curses on FreeBSD changes signal handlers

2017-10-31 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 19f68301a1295a9c30d9f28b8f1479cdcccd75aa by Victor Stinner in 
branch 'master':
bpo-31629: Add support.SaveSignals (#4183)
https://github.com/python/cpython/commit/19f68301a1295a9c30d9f28b8f1479cdcccd75aa


--

___
Python tracker 

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



[issue31629] Running test_curses on FreeBSD changes signal handlers

2017-10-31 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4157

___
Python tracker 

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



[issue31629] Running test_curses on FreeBSD changes signal handlers

2017-10-31 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4158

___
Python tracker 

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



[issue31629] Running test_curses on FreeBSD changes signal handlers

2017-10-31 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 1d481822a6295e6739da2d5cca0fdbede51fda22 by Victor Stinner in 
branch '2.7':
bpo-31629: Add support.SaveSignals (#4183) (#4188)
https://github.com/python/cpython/commit/1d481822a6295e6739da2d5cca0fdbede51fda22


--

___
Python tracker 

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



[issue31629] Running test_curses on FreeBSD changes signal handlers

2017-10-31 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 41efc402f154e48e95dde2993901648edcb24069 by Victor Stinner in 
branch '3.6':
bpo-31629: Add support.SaveSignals (#4183) (#4187)
https://github.com/python/cpython/commit/41efc402f154e48e95dde2993901648edcb24069


--

___
Python tracker 

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



[issue31629] Running test_curses on FreeBSD changes signal handlers

2017-10-31 Thread STINNER Victor

STINNER Victor  added the comment:

Thanks Serhiy Storchaka for the bug report and Pablo Galindo Salgado for the 
analysis!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 2.7, Python 3.6

___
Python tracker 

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



[issue31898] Add `recommended-packages.txt` to `venv` documentation

2017-10-31 Thread Nick Coghlan

Nick Coghlan  added the comment:

As part of this, a new subsection would be added to 
https://docs.python.org/devguide/stdlibchanges.html to document the process for 
adding new packages to the recommended packages list: propose them for standard 
library inclusion, and while "No" is still the most likely outcome, being added 
to the recommended packages list would be a potential middle ground for 
"Approved in principle, but the actual logistics of doing so probably don't 
work".

--

___
Python tracker 

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



[issue31852] Crashes with lines of the form "async \"

2017-10-31 Thread STINNER Victor

STINNER Victor  added the comment:

> Would it also be the case for 'await' ?

"async" requires to maintain a "async_def" state. It seems like await doesn't 
need a state for itself, but rely on the "async_def" state which has been fixed.

Extract of Parser/tokenizer.c:

/* Current token length is 5. */
if (tok->async_def) {
/* We're inside an 'async def' function. */
if (memcmp(tok->start, "async", 5) == 0) {
return ASYNC;
}
if (memcmp(tok->start, "await", 5) == 0) {
return AWAIT;
}
}

--

___
Python tracker 

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



[issue31907] Clarify error message when attempting to call function via str.format()

2017-10-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I have wrote a patch that change the parser to only accept valid identifiers. 
But now I have the same doubts and want first to discuss this [1]. This change 
can break the existing code as Eric's example shows.

[1] https://mail.python.org/pipermail/python-dev/2017-October/150052.html

--
nosy: +serhiy.storchaka
status: pending -> open

___
Python tracker 

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



[issue31898] Add a `recommended-packages.txt` file

2017-10-31 Thread Nick Coghlan

Nick Coghlan  added the comment:

Thinking about it further, this list is actually going to be version 
independent, suggest it may actually belong somewhere outside the main 
documentation.

The Developer's Guide may be a reasonable stopgap measure until there's a 
better option available (e.g. if I ever get around to turning 
https://github.com/python/redistributor-guide/ into something more than a 
nearly empty repo)

--
title: Add `recommended-packages.txt` to `venv` documentation -> Add a 
`recommended-packages.txt` file

___
Python tracker 

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



[issue31891] Make curses compiling on NetBSD 7.1 and tests passing

2017-10-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset baac01e629d90f63dfde6b5cc433f4bc65c5feeb by Serhiy Storchaka in 
branch 'master':
bpo-31891: Fix building the curses module on NetBSD. (#4165)
https://github.com/python/cpython/commit/baac01e629d90f63dfde6b5cc433f4bc65c5feeb


--

___
Python tracker 

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



[issue31891] Make curses compiling on NetBSD 7.1 and tests passing

2017-10-31 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4159

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-10-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset b9052a0f91d2e83bbc27267247a5920c82b242a3 by Serhiy Storchaka in 
branch 'master':
bpo-31893: Fixed select.kqueue(). (#4166)
https://github.com/python/cpython/commit/b9052a0f91d2e83bbc27267247a5920c82b242a3


--

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-10-31 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4160

___
Python tracker 

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



[issue31626] Writing in freed memory in _PyMem_DebugRawRealloc() after shrinking a memory block

2017-10-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset b484d5606ca76f9bbd0f5de7a6ef753400213e94 by Serhiy Storchaka in 
branch 'master':
bpo-31626: Fixed a bug in debug memory allocator. (#3844)
https://github.com/python/cpython/commit/b484d5606ca76f9bbd0f5de7a6ef753400213e94


--

___
Python tracker 

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



[issue31897] Unexpected exceptions in plistlib.loads

2017-10-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset db91e0fe2417f075693a194a492b1699829871e7 by Serhiy Storchaka in 
branch 'master':
bpo-31897: Convert unexpected errors when read bogus binary plists into 
InvalidFileException. (#4171)
https://github.com/python/cpython/commit/db91e0fe2417f075693a194a492b1699829871e7


--

___
Python tracker 

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



[issue31626] Writing in freed memory in _PyMem_DebugRawRealloc() after shrinking a memory block

2017-10-31 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4161

___
Python tracker 

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



[issue31897] Unexpected exceptions in plistlib.loads

2017-10-31 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4162

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-10-31 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests: +4163

___
Python tracker 

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



[issue31891] Make curses compiling on NetBSD 7.1 and tests passing

2017-10-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 5db32085e7e4d6be9a34d0a64ecf477eca224f15 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.6':
bpo-31891: Fix building the curses module on NetBSD. (GH-4165) (#4189)
https://github.com/python/cpython/commit/5db32085e7e4d6be9a34d0a64ecf477eca224f15


--

___
Python tracker 

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



[issue31891] Make curses compiling on NetBSD 7.1 and tests passing

2017-10-31 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests: +4164

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-10-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset f9a639b97c760f40d03c7655053c89752850 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.6':
bpo-31893: Fixed select.kqueue(). (GH-4166) (#4190)
https://github.com/python/cpython/commit/f9a639b97c760f40d03c7655053c89752850


--

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-10-31 Thread STINNER Victor

STINNER Victor  added the comment:

The commit b9052a0f91d2e83bbc27267247a5920c82b242a3 broke compilation on 
FreeBSD:

building 'select' extension
cc -pthread -fPIC -Wno-unused-result -Wsign-compare -g -O0 -Wall 
-Wstrict-prototypes -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter 
-Wno-missing-field-initializers -Werror=implicit-function-declaration 
-I./Include -I. -I/usr/local/include 
-I/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Include 
-I/usr/home/buildbot/python/3.x.koobs-freebsd10/build -c 
/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Modules/selectmodule.c -o 
build/temp.freebsd-10.3-STABLE-amd64-3.7-pydebug/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Modules/selectmodule.o
/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Modules/selectmodule.c:1889:63:
 error: expected ';' at end of declaration
FILTER_FMT_UNIT FLAGS_FMT_UNIT FFLAGS_FMT_UNIT DATA_FMT_UNIT
  ^
  ;
1 error generated.
*** WARNING: renaming "_asyncio" since importing it failed: No module named 
'select'

http://buildbot.python.org/all/#/builders/87/builds/95/steps/3/logs/stdio

--
nosy: +haypo

___
Python tracker 

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



[issue31454] Include "import as" in tutorial

2017-10-31 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4165

___
Python tracker 

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



[issue31626] Writing in freed memory in _PyMem_DebugRawRealloc() after shrinking a memory block

2017-10-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset ece5659565e083baaee4d185ce181a98aaee7f96 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.6':
bpo-31626: Fixed a bug in debug memory allocator. (GH-3844) (#4191)
https://github.com/python/cpython/commit/ece5659565e083baaee4d185ce181a98aaee7f96


--

___
Python tracker 

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



[issue31897] Unexpected exceptions in plistlib.loads

2017-10-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 6969d368c43d4c97e5f7b7b22904305ec68f79ba by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.6':
bpo-31897: Convert unexpected errors when read bogus binary plists into 
InvalidFileException. (GH-4171) (#4192)
https://github.com/python/cpython/commit/6969d368c43d4c97e5f7b7b22904305ec68f79ba


--

___
Python tracker 

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



[issue31901] atexit callbacks only called for current subinterpreter

2017-10-31 Thread Petr Viktorin

Petr Viktorin  added the comment:

I'm not sure where the concept of "main subinterpreter" comes in, with respect 
to this issue.

I thnik the issue of atexit callbacks could be solved by something like keeping 
info about each callback's subinterpreter, and switching subinterpreters before 
running each one. I can see the locking needed for that being quite hairy, but 
independent of which thread calls all this.

--

___
Python tracker 

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



[issue31891] Make curses compiling on NetBSD 7.1 and tests passing

2017-10-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset e0fc1af67acb5684ae780128fbdb3c5419af51db by Serhiy Storchaka in 
branch '2.7':
[2.7] bpo-31891: Fix building the curses module on NetBSD. (GH-4165). (#4194)
https://github.com/python/cpython/commit/e0fc1af67acb5684ae780128fbdb3c5419af51db


--

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-10-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 8cbf4e10646c3f5b8f0d274c2d7dea5bb6305f57 by Serhiy Storchaka in 
branch '2.7':
[2.7] bpo-31893: Fixed select.kqueue(). (GH-4166) (#4193)
https://github.com/python/cpython/commit/8cbf4e10646c3f5b8f0d274c2d7dea5bb6305f57


--

___
Python tracker 

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



[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-10-31 Thread STINNER Victor

STINNER Victor  added the comment:

Nathaniel: "(...) and numpy won't necessarily use this API anyway."

Can you elaborate why numpy wouldn't use this new API? I designed it with numpy 
in mind :-)

Using PyMem_AlignedAlloc() instead of using directly 
posix_memalign()/_aligned_alloc() provides the debug features for free:

* tracemalloc is able to trace memory allocations
* detect buffer underflow
* detect buffer overflow
* detect API misuse like PyMem_Free(PyMem_AlignedAlloc()) -- it doesn't detect 
free(PyMem_AlignedAlloc()) which is plain wrong on Windows (but this one should 
crash immediately ;-))

Other advantages:

* PyMem_AlignedAlloc(alignment, 0) is well defined: it never returns NULL
* PyMem_AlignedAlloc(alignment, size) checks on alignment value are the same on 
all operating systems

Moreover, Python takes care of the portability for you :-)

--

___
Python tracker 

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



[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-10-31 Thread STINNER Victor

STINNER Victor  added the comment:

Nathaniel Smith: "Given the complexities here, and that the Track/Untrack 
functions are public now, I do wonder if the actual aligned allocation routines 
should just be an internal API (i.e., not exposed in Python.h)."

I don't see why we would hide PyMem_AlignedAlloc() but requires to implement 
aligned_alloc in PyMem_SetAllocators().

The plan is also to slowly use PyMem_AlignedAlloc() internally for performance.

Can you elaborate the "complexities"? Do you mean that the proposed 
PyMem_AlignedAlloc() API is more complex than calling directly posix_memalign()?

PyMem_AlignedAlloc() is designed for performance. For best performances, CPUs 
require memory to be aligned on convenient values like powers of 2 ;-) I also 
understand that alignment must be a multiple of sizeof(void*) because CPU work 
on "CPU words". On a 64-bit CPU, a word is 8 bytes. If the memory is aligned on 
4 bytes, it may have to fetch two words, you loose the advantage of memory 
alignment.

I understand that PyMem_AlignedAlloc() requirements come from the CPU 
arhcitecture, it's not an arbitrary limitation just for the fun ;-)

--

___
Python tracker 

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



[issue31844] HTMLParser: undocumented not implemented method

2017-10-31 Thread William Ayd

William Ayd  added the comment:

Would we be open to setting the meta class of the ParserBase to ABCMeta and 
setting error as an abstract method? That at the very least would make the 
expectation clearer for subclasses. 

I haven’t contributed to Python before but am open to this as a first attempt 
if the direction makes sense.

--
nosy: +William Ayd

___
Python tracker 

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



[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-10-31 Thread STINNER Victor

STINNER Victor  added the comment:

Stefan Krah: "we care about the C11 restriction? (...) "size - number of bytes 
to allocate. An integral multiple of alignment" (...) posix_memalign and 
_aligned_malloc don't care about the multiple."

I prefer to ignore this restriction at this point.

I wouldn't be surprised if posix_memalign() and _aligned_malloc() already align 
the size for us internally.

We can add the restriction later, if needed.

--

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-10-31 Thread STINNER Victor

STINNER Victor  added the comment:

Oh, the commit also broke the "x86 Tiger 3.x buildbot:

http://buildbot.python.org/all/#/builders/30/builds/93

==
FAIL: test_create_event (test.test_kqueue.TestKQueue)
--
Traceback (most recent call last):
  File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_kqueue.py", 
line 71, in test_create_event
self.assertEqual(ev.data, 5)
AssertionError: 25769803781 != 5

--

___
Python tracker 

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



[issue31844] HTMLParser: undocumented not implemented method

2017-10-31 Thread William Ayd

William Ayd  added the comment:

And assuming that subclass requirement is intentional we could add an optional 
keyword argument to the HTMLParser that indicates what to do with errors, much 
like how encoding issues are handled within codecs. For backwards compatibility 
it can default to ignore, but fail and warn could be two alternate approaches 
that the error method could account for

--

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-10-31 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests: +4166

___
Python tracker 

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



[issue31880] subprocess process interaction with IDLEX GUI causes pygnuplot silent failures

2017-10-31 Thread John Brearley

John Brearley  added the comment:

Additonal testing shows that the subprocess.run command will reliably interact 
directly with gnuplot, either from the IDLEX GUI or the Python terminal window.

import subprocess
def run_cmd(cmd):
   print("run_cmd cmd:", cmd)
   # MUST explicitly ask for stdout, stderr. timeout is in seconds
   p1 = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, 
timeout=20)
   # print("run_cmd p1:", p1, type(p1))
   print("run_cmd p1.stdout:", p1.stdout, type(p1.stdout), 
p1.stdout.decode("utf-8"))
   print("run_cmd p1.stderr:", p1.stderr, type(p1.stderr), 
p1.stderr.decode("utf-8"))
   print("run_cmd p1.returncode:", p1.returncode, type(p1.returncode))

cmd = "gnuplot.exe "+self+"_candles.gnu"
run_cmd(cmd)

--

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-10-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Oh, I forgot that Mac OS X also in the BSD family.

Thank you Victor for signaling errors.

--

___
Python tracker 

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



[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-10-31 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

> Can you elaborate why numpy wouldn't use this new API? I designed it with 
> numpy in mind :-)

The reasons I had in mind are:

1) numpy hasn't actually come to a decision about whether to use aligned 
allocation at all, or under what circumstances.

2) if we do use it, we'll probably need our own implementation anyway to 
support old pythons.

3) also it's not clear what the best approach will look like, given that we 
care a lot about using calloc when possible, and have reason to prefer using 
regular freeing functions whenever possible.

I wasn't making a criticism of your API; "it's not you, it's us" :-). But this 
is a complicated and subtle area that's not really part of CPython's core 
competency, and coming at a time when people are fretting about how to shrink 
the C APIs surface area. E.g. I can think of more interesting ways for the PyPy 
folks to spend their time than implementing an aligned_alloc wrapper...

--

___
Python tracker 

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



[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-10-31 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Le 31/10/2017 à 15:55, Nathaniel Smith a écrit :
> 
> 1) numpy hasn't actually come to a decision about whether to use aligned 
> allocation at all, or under what circumstances.

This isn't the Numpy bug tracker, but I can't help but mention that if
Numpy grew a facility for users to override the memory allocators it
invokes to allocate array data, Numpy may not have to come to a decision
about this at all... ;-) And it would also help specialized
accelerators, which may want to direct Numpy arrays to e.g. memory
that's cheaply shared with the GPU.

(see https://github.com/numpy/numpy/pull/5470)

> I wasn't making a criticism of your API; "it's not you, it's us" :-). But 
> this is a complicated and subtle area that's not really part of CPython's 
> core competency, and coming at a time when people are fretting about how to 
> shrink the C APIs surface area. E.g. I can think of more interesting ways for 
> the PyPy folks to spend their time than implementing an aligned_alloc 
> wrapper...

The same argument can be made for any part of the stdlib or core
language that PyPy has to reproduce.  Besides, I don't think
implementing an aligned_alloc wrapper is very difficult.  The hard part
is getting an agreement over the exposed APIs, and that's CPython's job,
not PyPy ;-)

--

___
Python tracker 

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



[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-10-31 Thread Stefan Krah

Stefan Krah  added the comment:

On Tue, Oct 31, 2017 at 02:55:04PM +, Nathaniel Smith wrote:
> 3) also it's not clear what the best approach will look like, given that we 
> care a lot about using calloc when possible, and have reason to prefer using 
> regular freeing functions whenever possible.

I actually have the same problems. But since no fast (kernel-zeroed)
aligned_calloc() exists, I must use memset() anyway.

So an emulated aligned_calloc() should probably not go into CPython
since it doesn't provide any performance advantages.

--

___
Python tracker 

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



[issue20064] PyObject_Malloc is not documented

2017-10-31 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4167

___
Python tracker 

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



[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-10-31 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4168

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-10-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 2298fad5ff907dd48ea0fb5c71fa22334ef28c6b by Serhiy Storchaka in 
branch 'master':
bpo-31893: Fix errors in b9052a0f91d2e83bbc27267247a5920c82b242a3. (#4196)
https://github.com/python/cpython/commit/2298fad5ff907dd48ea0fb5c71fa22334ef28c6b


--

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-10-31 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4169

___
Python tracker 

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



[issue20064] PyObject_Malloc is not documented

2017-10-31 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4170

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-10-31 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4171

___
Python tracker 

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



[issue20064] PyObject_Malloc is not documented

2017-10-31 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset ec2cbdd1dff2c51788136480b2085e77506ebf34 by Victor Stinner in 
branch 'master':
bpo-20064: Document PyObject_Malloc() (#4199)
https://github.com/python/cpython/commit/ec2cbdd1dff2c51788136480b2085e77506ebf34


--

___
Python tracker 

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



[issue20064] PyObject_Malloc is not documented

2017-10-31 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4172

___
Python tracker 

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



[issue31880] subprocess process interaction with IDLEX GUI causes pygnuplot silent failures

2017-10-31 Thread John Brearley

John Brearley  added the comment:

The owner of PyGnuplot figured out that for Python 3.4+ that a flush on stdin 
is needed. IDLEX GUI now runs example.py and my own test code correctly.

proc.stdin.flush()  # send the command in python 3.4+

This leaves the interesting behavior of IDLEX GUI. What is it doing differently 
re stdin from the command line terminal behavior? There is probably something 
to be learned here, if someone wants to dig into it.

--

___
Python tracker 

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



[issue20064] PyObject_Malloc is not documented

2017-10-31 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 8543ce8ffd57d770b57fe653e0ab7fada1a4c343 by Victor Stinner (Miss 
Islington (bot)) in branch '3.6':
bpo-20064: Document PyObject_Malloc() (GH-4199) (#4203)
https://github.com/python/cpython/commit/8543ce8ffd57d770b57fe653e0ab7fada1a4c343


--

___
Python tracker 

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



[issue20064] PyObject_Malloc is not documented

2017-10-31 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4173

___
Python tracker 

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



[issue20064] PyObject_Malloc is not documented

2017-10-31 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests:  -4170

___
Python tracker 

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



[issue31910] test_socket.test_create_connection() failed with EADDRNOTAVAIL (err 99)

2017-10-31 Thread STINNER Victor

New submission from STINNER Victor :

On my PR 4200 which is unrelated to networking, the following test failed once.

FAIL: test_create_connection (test.test_socket.NetworkConnectionNoServer)
--
Traceback (most recent call last):
  File "/home/travis/build/python/cpython/Lib/test/test_socket.py", line 4537, 
in test_create_connection
self.assertIn(cm.exception.errno, expected_errnos)
AssertionError: 99 not found in [111, 101]


With error codes:

* 99: EADDRNOTAVAIL: Cannot assign requested address
* 111: ECONNREFUSED: Connection refused
* 101: ENETUNREACH: Network is unreachable

Maybe we shold include EADDRNOTAVAIL in the expected error codes?

--
components: Tests
messages: 305316
nosy: haypo, martin.panter, serhiy.storchaka
priority: normal
severity: normal
status: open
title: test_socket.test_create_connection() failed with EADDRNOTAVAIL (err 99)
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



[issue20064] PyObject_Malloc is not documented

2017-10-31 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 52ba7b447f41dad2754ddbc50ed97413b557bbe1 by Victor Stinner in 
branch '2.7':
bpo-20064: Document PyObject_Malloc() (#4204)
https://github.com/python/cpython/commit/52ba7b447f41dad2754ddbc50ed97413b557bbe1


--

___
Python tracker 

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



[issue20064] PyObject_Malloc is not documented

2017-10-31 Thread STINNER Victor

STINNER Victor  added the comment:

It took a while, but PyObject_Malloc() & cie are now documented :-)

I even backported and *adapted* the doc to Python 2.7 ;-)

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.6, Python 3.7 -Python 3.4, Python 3.5

___
Python tracker 

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



[issue31911] Use malloc_usable_size() is pymalloc for realloc

2017-10-31 Thread STINNER Victor

New submission from STINNER Victor :

Objects/obmalloc.c contains an interesting comment:

if (!address_in_range(p, pool)) {
/* pymalloc is not managing this block.

   If nbytes <= SMALL_REQUEST_THRESHOLD, it's tempting to try to take
   over this block.  However, if we do, we need to copy the valid data
   from the C-managed block to one of our blocks, and there's no
   portable way to know how much of the memory space starting at p is
   valid.

   As bug 1185883 pointed out the hard way, it's possible that the
   C-managed block is "at the end" of allocated VM space, so that a
   memory fault can occur if we try to copy nbytes bytes starting at p.
   Instead we punt: let C continue to manage this block. */
return 0;
}

See also bpo-1185883.

We don't have to guess, it's possible to get the size of a memory block 
allocated by malloc() with:

* malloc_usable_size(ptr): available at least on Linux
* _msize(ptr): Windows

Maybe we could add a "msize" field to PyMemAllocatorEx? See also bpo-18835 whic 
adds PyMem_AlignedAlloc() and so already modify (and rename PyMemAllocatorEx).

See also bpo-31626, but I'm not sure that it would help for 
_PyMem_DebugRawRealloc().

--
components: Interpreter Core
messages: 305319
nosy: haypo, serhiy.storchaka, skrah
priority: normal
severity: normal
status: open
title: Use malloc_usable_size() is pymalloc for realloc
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



[issue31912] PyMem_Malloc() should guarantee alignof(max_align_t)

2017-10-31 Thread Stefan Krah

New submission from Stefan Krah :

This is related to #27987 and #20064 and perhaps the pymalloc patch
from #18835.

I think PyMem_Malloc() should guarantee alignof(max_align_t).

It actually did before the "#define PYMEM_FUNCS PYOBJ_FUNCS" optimization,
so we have a sort of regression here.

--
components: Interpreter Core
messages: 305320
nosy: skrah
priority: normal
severity: normal
stage: needs patch
status: open
title: PyMem_Malloc() should guarantee alignof(max_align_t)
type: behavior
versions: Python 3.4, Python 3.5, 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



[issue31912] PyMem_Malloc() should guarantee alignof(max_align_t)

2017-10-31 Thread Stefan Krah

Change by Stefan Krah :


--
nosy: +haypo

___
Python tracker 

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



[issue31909] Missing definition of HAVE_SYSCALL_GETRANDOM

2017-10-31 Thread Ilya Kulakov

Ilya Kulakov  added the comment:

Not a bug in Python.

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



[issue31912] PyMem_Malloc() should guarantee alignof(max_align_t)

2017-10-31 Thread STINNER Victor

STINNER Victor  added the comment:

> I think PyMem_Malloc() should guarantee alignof(max_align_t).

Do you mean the C++ std::max_align_t? Does C99 have something like that?

The Linux malloc() manual page says:

"The malloc() and calloc() functions return a pointer to  the  allocated 
memory,  which  is  suitably  aligned for any built-in type."

But I don't know the list of C built-in types.

--

___
Python tracker 

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



[issue31913] forkserver could warn if several threads are running

2017-10-31 Thread Antoine Pitrou

New submission from Antoine Pitrou :

I'm not sure this is worth handling, but I had an interaction with a user who 
had weird deadlock problems in a glibc function (getaddrinfo) in worker 
processes launched with the forkserver method.

The explanation turned out to be that a sitecustomize.py did some stuff that 
eventually launched a helper thread, and that made the forkserver process's 
forking fundamentally unsafe (fork() is guaranteed to be safe if there's only 
one thread running in the parent process).

It would be easy to check that threading.enumerate() returns only one thread, 
and otherwise warn the user about it.  Note this only handles Python threads 
and not C threads invisible to Python... (a more complete solution would 
involve psutil :-)).

--
components: Library (Lib)
messages: 305323
nosy: davin, gregory.p.smith, pitrou
priority: low
severity: normal
status: open
title: forkserver could warn if several threads are running
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



[issue31912] PyMem_Malloc() should guarantee alignof(max_align_t)

2017-10-31 Thread Stefan Krah

Stefan Krah  added the comment:

> Do you mean the C++ std::max_align_t? Does C99 have something like that?
> 
> The Linux malloc() manual page says:
> 
> "The malloc() and calloc() functions return a pointer to  the  allocated 
> memory,  which  is  suitably  aligned for any built-in type."

C11 has max_align_t, but also for C99 "any builtin type" means 16 byte alignment
for long double on x64, so malloc() and calloc() are required to align 16 bytes
with -std=c99 (and earlier).

max_align_t is just a shorthand to express the concept.

--

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-10-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 84e252b79eed94bc9e9175f82191322c89e489ad by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.6':
bpo-31893: Fix errors in b9052a0f91d2e83bbc27267247a5920c82b242a3. (GH-4196) 
(#4201)
https://github.com/python/cpython/commit/84e252b79eed94bc9e9175f82191322c89e489ad


--

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-10-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset e7531e54bf195b8d3ed35b4138901c82f7ed794c by Serhiy Storchaka 
(Miss Islington (bot)) in branch '2.7':
bpo-31893: Fix errors in b9052a0f91d2e83bbc27267247a5920c82b242a3. (GH-4196) 
(#4202)
https://github.com/python/cpython/commit/e7531e54bf195b8d3ed35b4138901c82f7ed794c


--

___
Python tracker 

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



[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-10-31 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

> But since no fast (kernel-zeroed) aligned_calloc() exists, I must use 
> memset() anyway. 

For large allocations, you'll probably be better off implementing your own 
aligned allocator on top of calloc than implementing your own calloc on top of 
an aligned allocator. (It's O(1) overhead versus O(n).) And once you're doing 
that you might want to use the same code for regular allocations too, so that 
you don't need to keep track of whether each memory block used aligned_calloc 
or aligned_malloc and can treat them the same... Depends on your exact 
circumstances.

--

___
Python tracker 

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



[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-10-31 Thread Mark Dickinson

Mark Dickinson  added the comment:

> Seems the first result is calculated at compile time

Makes sense. Last time I looked, gcc uses MPFR for the compile-time calls, so 
I'd expect those to be correctly rounded.

--

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-10-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Tests on all buildbots are passed.

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



[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-10-31 Thread Stefan Krah

Stefan Krah  added the comment:

So the big mystery is still:

   https://mail.python.org/pipermail/python-dev/2017-October/149880.html


Could be a Linux router with some alternative libc ...

--

___
Python tracker 

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



[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-10-31 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 9ed83c40855b57c10988f76770a4eb825e034cd8 by Victor Stinner in 
branch 'master':
bpo-18835: Cleanup pymalloc (#4200)
https://github.com/python/cpython/commit/9ed83c40855b57c10988f76770a4eb825e034cd8


--

___
Python tracker 

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



[issue31626] Writing in freed memory in _PyMem_DebugRawRealloc() after shrinking a memory block

2017-10-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I have removed the incorrect code in master and 3.6, this unblocks testing 
debug build on OpenBSD. I don't think it is worth to backport this change to 
3.5 and 3.4, since the bug affects only debug build.

Here is a patch which perhaps is an alternative to PR 4119, but without 
disturbing the heap allocator. It erases just few bytes at the begin and at the 
end of the allocated block (including the header and the trailer), and saves 
erased bytes in small local buffer. It does this even if the block is not 
reallocated in-place. Hence calling free() on reallocated block will be 
detected. Reading from the reallocated block will get erased bytes at the start 
and the end, this is likely will cause to loud failure too. I have tested in on 
OpenBSD.

But I'm not sure that it is worth to apply this patch. Left it on to you Victor.

--
versions:  -Python 3.4, Python 3.5
Added file: https://bugs.python.org/file47249/debug-realloc.diff

___
Python tracker 

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



[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-10-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

>From 4 considered results the tests are failed on gcc 4.2.1, 4.7.2, 4.8.5, but 
>are passes on gcc 7.2.0. I suppose this is gcc or libc bug fixed in recent 
>versions.

--

___
Python tracker 

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



[issue31626] Writing in freed memory in _PyMem_DebugRawRealloc() after shrinking a memory block

2017-10-31 Thread Larry Hastings

Larry Hastings  added the comment:

> Most, if not all, calls to _PyMem_DebugRawRealloc() are protected by
> the GIL. If there is a single thread using the memory block,
> I think that it's perfectly fine to write after it's deallocated.

I don't quite follow where the write-after-free is happening, but: C's free() 
function is *not* protected by the GIL.  So if you're running in a 
multithreaded program where other threads aren't blocked by the GIL, one of 
these other threads could very easily allocate this freshly-freed memory.  And 
if you wrote to it after the memory was allocated to this other thread, 
congrats, your program is no longer correct.

--

___
Python tracker 

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



[issue31626] Writing in freed memory in _PyMem_DebugRawRealloc() after shrinking a memory block

2017-10-31 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
priority: critical -> normal

___
Python tracker 

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



[issue31630] math.tan has poor accuracy near pi/2 on OpenBSD and NetBSD

2017-10-31 Thread Stefan Krah

Stefan Krah  added the comment:

On Tue, Oct 31, 2017 at 07:32:00PM +, Serhiy Storchaka wrote:
> >>From 4 considered results the tests are failed on gcc 4.2.1, 4.7.2, 4.8.5, 
> >>but are passes on gcc 7.2.0. I suppose this is gcc or libc bug fixed in 
> >>recent versions.

4.7.3 passes here with -m32.

--

___
Python tracker 

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



[issue31910] test_socket.test_create_connection() failed with EADDRNOTAVAIL (err 99)

2017-10-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I'm not a networking but it seems reasonable. If I understand correctly, 
EADDRNOTAVAIL can be raised on the Travis CI when a large number of network 
connections are created simultaneously by other CI tests.

Or maybe just repeat the test if EADDRNOTAVAIL is raised?

--

___
Python tracker 

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



[issue31844] HTMLParser: undocumented not implemented method

2017-10-31 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
components: +Library (Lib)
nosy: +ezio.melotti
type:  -> behavior

___
Python tracker 

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



[issue31891] Make curses compiling on NetBSD 7.1 and tests passing

2017-10-31 Thread Serhiy Storchaka

Change 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



[issue31914] Document Pool.(star)map return type

2017-10-31 Thread Дилян Палаузов

New submission from Дилян Палаузов :

https://docs.python.org/3/library/multiprocessing.html#multiprocessing.pool.Pool.starmap
 says:

starmap(func, iterable[, chunksize])
Like map() except that the elements of the iterable are expected to be 
iterables that are unpacked as arguments.

Hence an iterable of [(1,2), (3, 4)] results in [func(1,2), func(3,4)].



If it was like map() then it would have returned an iterator.  Please clarify, 
that Pool.map and Pool.starmap return list.

--
assignee: docs@python
components: Documentation
messages: 305337
nosy: dilyan.palauzov, docs@python
priority: normal
severity: normal
status: open
title: Document Pool.(star)map return type
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



[issue31914] Document Pool.(star)map return type

2017-10-31 Thread Дилян Палаузов

Дилян Палаузов  added the comment:

Pool.starmap is not like map from the standard library, as the hyperlinking on 
the word map() suggests, but like Pool.map().  The latter talks about the 
chunksize parameter, but the former and Pool.starmap don't.

--

___
Python tracker 

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



[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-10-31 Thread Stefan Krah

Stefan Krah  added the comment:

> For large allocations, you'll probably be better off implementing your own 
> aligned allocator on top of calloc than implementing your own calloc on top 
> of an aligned allocator. (It's O(1) overhead versus O(n).) And once you're 
> doing that you might want to use the same code for regular allocations too, 
> so that you don't need to keep track of whether each memory block used 
> aligned_calloc or aligned_malloc and can treat them the same... Depends on 
> your exact circumstances.

Yes, but if the whole array is initialized with actual values, then
the memset() overhead is not very large (something like 16% here).

If uninitialized (or very sparse), the overhead is of course gigantic.

What is more, in some crude tests the posix_memalign() performance isn't
that great compared to malloc()/calloc().

C11 aligned_alloc() is also quite a bit faster than posix_memalign() here.

I think you're right that a hand-rolled solution on top of calloc() is
best for my use case.

--

___
Python tracker 

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



[issue23551] IDLE to provide menu link to PIP gui.

2017-10-31 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

For this idea to be revived, someone should write a PEP and open a new issue.

--

___
Python tracker 

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



[issue31908] trace module cli does not write cover files

2017-10-31 Thread Michael Selik

Michael Selik  added the comment:

The problem appears to be a mistake in commit 
f026dae130bf6f9015c4b212f16852ba4a3f3dec

https://github.com/python/cpython/commit/f026dae130bf6f9015c4b212f16852ba4a3f3dec

This made the writing of cover files conditional on ``show_missing`` which is 
the option to mark lines which weren't executed with several angle brackets 
">".

https://github.com/python/cpython/blob/3.5/Lib/trace.py#L326

mike on mac in ~/
$ python -m trace --count foo.py
hello

mike on mac in ~/
$ ls *.cover
ls: *.cover: No such file or directory

mike on mac in ~/
$ python -m trace --count -m foo.py
hello

mike on mac in ~/
$ ls *.cover
-rw-r--r--  1 mike  staff22B Oct 31 15:40 foo.cover

--

___
Python tracker 

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



[issue27051] Create PIP gui

2017-10-31 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

___
Python tracker 

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



[issue23551] IDLE to provide menu link to PIP gui.

2017-10-31 Thread Ivan Levkivskyi

Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

___
Python tracker 

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



[issue14574] SocketServer doesn't handle client disconnects properly

2017-10-31 Thread Matej Cepl

Matej Cepl  added the comment:

The last patch (clear_buffer_on_error.patch) has still not been applied 
(looking at 2.7 and master branches).

--
nosy: +mcepl

___
Python tracker 

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



[issue31908] trace module cli does not write cover files

2017-10-31 Thread Michael Selik

Michael Selik  added the comment:

While writing a patch for this, I noticed the ``lnotab`` parameter seems nearly 
unused. It's a dict, but is only used for its keys.

https://github.com/python/cpython/blob/master/Lib/trace.py#L333

Further, the choice to count unreached lines only when ``show_missing`` was set 
seems inconsistent.

https://github.com/python/cpython/blob/master/Lib/trace.py#L335

https://github.com/python/cpython/blob/master/Lib/trace.py#L280

--

___
Python tracker 

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



[issue18835] Add PyMem_AlignedAlloc()

2017-10-31 Thread STINNER Victor

Change by STINNER Victor :


--
title: Add aligned memory variants to the suite of PyMem functions/macros -> 
Add PyMem_AlignedAlloc()

___
Python tracker 

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



[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2017-10-31 Thread STINNER Victor

STINNER Victor  added the comment:

I merged my PR 4199 (Document PyObject_Malloc()) and PR 4200 (Cleanup pymalloc) 
to prepare PR 4089.

PR 4089 should now be completed and well tested.

The real question is now if we need PyMem_AlignedAlloc()?

Stefan Krah and Nathaniel Smith are interested by aligned memory allocations, 
but both wrote that they don't plan to use PyMem_AlignedAlloc() if I understood 
correctly. What's the point of adding PyMem_AlignedAlloc() in that case?

--

___
Python tracker 

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



[issue18835] Add PyMem_AlignedAlloc()

2017-10-31 Thread STINNER Victor

STINNER Victor  added the comment:

msg196194: Antoine Pitrou: "Note that the current small object allocator, if 
not disabled, *should* already return you aligned memory, by construction (each 
allocation size has dedicated pools from which memory blocks are carved)."

In my current implementation of _PyObject_AlignedAlloc(), I only call 
pymalloc_alloc() for alignment <= pymalloc ALIGNMENT. Maybe we can do better?

--

___
Python tracker 

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



[issue31915] (list).insert() not working

2017-10-31 Thread Chance Parsons

Change by Chance Parsons :


--
files: Times Tables.py
nosy: Chance Parsons
priority: normal
severity: normal
status: open
title: (list).insert() not working
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47250/Times Tables.py

___
Python tracker 

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



[issue31908] trace module cli does not write cover files

2017-10-31 Thread Michael Selik

Change by Michael Selik :


--
keywords: +patch
pull_requests: +4174
stage:  -> patch review

___
Python tracker 

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



  1   2   >