[issue31660] sys.executable different in os.execv'd python3.6 virtualenv session in python2 vs python3

2017-10-01 Thread Stephen Moore
New submission from Stephen Moore : Hi, I've come across a problem whereby if you do an os.execv to a python3.6 virtualenv python inside python2.7 vs python3.6 then the resulting python session has a different sys.executable. Where if you os.execv from python2.7 the

[issue31659] ssl module should not use textwrap for wrapping PEM format.

2017-10-01 Thread INADA Naoki
INADA Naoki added the comment: For the record, this is part of `import requests`. `import ssl` took 11 ms and `textwrap` weights 2.4 ms of it. - ipaddress 2048 us (self 2048 us) - textwrap 2402 us (self 2402 us)

[issue31659] ssl module should not use textwrap for wrapping PEM format.

2017-10-01 Thread INADA Naoki
Change by INADA Naoki : -- keywords: +patch pull_requests: +3829 stage: -> patch review ___ Python tracker ___

[issue31659] ssl module should not use textwrap for wrapping PEM format.

2017-10-01 Thread INADA Naoki
Change by INADA Naoki : -- components: +Library (Lib) versions: +Python 3.7 ___ Python tracker ___

[issue31659] ssl module should not use textwrap for wrapping PEM format.

2017-10-01 Thread INADA Naoki
New submission from INADA Naoki : Current DER_cert_to_PEM_cert() uses textwrap like this: def DER_cert_to_PEM_cert(der_cert_bytes): """Takes a certificate in binary DER format and returns the PEM version of it as a string.""" f =

[issue27484] Some Examples in Format String Syntax are incorrect or poorly worded

2017-10-01 Thread Rufus V. Smith
Rufus V. Smith added the comment: I happened to run across this in my old email inbox. It's embarrassing to realize how wrong I was in submitting the report. Reading it with fresh eyes, your original makes sense. I don't know what I was thinking. > On Jul 11, 2016, at

[issue21983] segfault in ctypes.cast

2017-10-01 Thread Mark Lawrence
Change by Mark Lawrence : -- nosy: -BreamoreBoy ___ Python tracker ___ ___

[issue31589] Links for French documentation pdf is broken

2017-10-01 Thread Julien Palard
Julien Palard added the comment: One difference I see in the logs of sucessfully building the faq.tex and failing to build it is: Package hyperref Warning: Token not allowed in a PDF string (Unicode): Looks like if I remove all non-ascii characters from titles, it

[issue31589] Links for French documentation pdf is broken

2017-10-01 Thread Julien Palard
Julien Palard added the comment: After an upgrade of my venv, the error is now: Latexmk: applying rule 'pdflatex'... Rule 'pdflatex': File changes, etc: Changed files, or newly in use since previous run(s): 'faq.aux' 'faq.out' 'faq.toc' Latexmk:

[issue31589] Links for French documentation pdf is broken

2017-10-01 Thread Ezio Melotti
Ezio Melotti added the comment: FWIW most of the errors I met while trying to build the pdfs of the main docs were caused by the presence of non-latin1 characters. French should be limited to the latin1 range and the error you pasted doesn't seem to be related,

[issue27494] 2to3 parser failure caused by a comma after a generator expression

2017-10-01 Thread Jakub Stasiak
Jakub Stasiak added the comment: By "forbid" do you mean "forbid in Python" (as in change Python syntax)? I like the idea but that seems like a more serious change and 2to3 arguably needs to handle code targeting older Python versions anyway. --

[issue31589] Links for French documentation pdf is broken

2017-10-01 Thread Julien Palard
Change by Julien Palard : -- nosy: +linkid ___ Python tracker ___ ___

[issue31654] ctypes should support atomic operations

2017-10-01 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le 01/10/2017 à 23:33, Daniel Colascione a écrit : > > Huh? Both are very generic. "Specialized" as in "I didn't expect anyone would want to do such a thing in pure Python". > SCM_RIGHTS is "specialized" > and not supported on all systems,

[issue31589] Links for French documentation pdf is broken

2017-10-01 Thread Julien Palard
Julien Palard added the comment: Problem happen during pdflatex, I tried a local build and got: ! Package hyperref Error: Wrong DVI mode driver option `dvipdfmx', (hyperref)because pdfTeX or LuaTeX is running in PDF mode. See the hyperref package

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

2017-10-01 Thread Tim Peters
Tim Peters added the comment: Ah! So it looks like OpenBSD took its math functions from Sun's fdlibm. I believe wxMaxima does too. That would certainly explain why they give the same answer ;-) So who's right? Using "bigfloats" in wxMaxima and feeding its bigfloat tan()

[issue31654] ctypes should support atomic operations

2017-10-01 Thread Daniel Colascione
Daniel Colascione added the comment: On Sun, Oct 1, 2017 at 2:01 PM, Antoine Pitrou wrote: > Perhaps other core developers will disagree with me and agree to include > (i.e. review, maintain) this functionality. I simply am not convinced > it

[issue31654] ctypes should support atomic operations

2017-10-01 Thread Daniel Colascione
Daniel Colascione added the comment: On Sun, Oct 1, 2017 at 2:01 PM, Antoine Pitrou wrote: > > Antoine Pitrou added the comment: > > Le 01/10/2017 à 21:51, Daniel Colascione a écrit : > > > >> That does sound specialized to me :-)

[issue31654] ctypes should support atomic operations

2017-10-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is not clear to me what API is needed, but I agree with Antoine that ctypes doesn't look the appropriate place for it. Maybe in multiprocessing or subprocess, or in low-level module providing primitives for multiprocessing or

[issue31622] Make threading.get_ident() return an opaque type

2017-10-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Currently, Python exposes "thread identifiers" as unsigned long values across > multiple modules: It happened not so long ago. In 3.6 and earlier "thread identifiers" are signed integers. See issue6532, it was massive change.

[issue31656] Bitwise operations for bytes-type

2017-10-01 Thread Martin Panter
Martin Panter added the comment: There’s already a bug open for this: Issue 19251. Only equal-length strings should be supported. -- nosy: +martin.panter ___ Python tracker

[issue31654] ctypes should support atomic operations

2017-10-01 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le 01/10/2017 à 21:51, Daniel Colascione a écrit : > >> That does sound specialized to me :-) Can you give an example of such a >> C API? > > The Linux futex protocol, as described in man futex(7), comes to mind. > Maybe you want to manipulate

[issue31658] xml.sax.parse won't accept path objects

2017-10-01 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +pitrou ___ Python tracker ___ ___

[issue31658] xml.sax.parse won't accept path objects

2017-10-01 Thread Craig Holmquist
New submission from Craig Holmquist : >>> import xml.sax >>> import pathlib [...] >>> xml.sax.parse(pathlib.Path('path/to/file'), handler) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.6/xml/sax/__init__.py", line 33, in parse

[issue31654] ctypes should support atomic operations

2017-10-01 Thread Daniel Colascione
Daniel Colascione added the comment: On Sun, Oct 1, 2017 at 11:12 AM, Antoine Pitrou wrote: > > Antoine Pitrou added the comment: > > Le 01/10/2017 à 20:04, Daniel Colascione a écrit : > > > > It's not that specialized. You might

[issue31654] ctypes should support atomic operations

2017-10-01 Thread Daniel Colascione
Daniel Colascione added the comment: On Sun, Oct 1, 2017 at 11:14 AM, Antoine Pitrou wrote: > > Antoine Pitrou added the comment: > > Note that if there is already a C API to perform atomic ops, you can > simply use ctypes to invoke

[issue31622] Make threading.get_ident() return an opaque type

2017-10-01 Thread Benjamin Peterson
Benjamin Peterson added the comment: On Sun, Oct 1, 2017, at 12:25, Antoine Pitrou wrote: > Another possibility would be to have a new separate threading API > returning a "low-level opaque thread handle" that you could pass to > pthread_kill() and pthread_getcpuclockid().

[issue31634] Consider installing wheel in ensurepip by default

2017-10-01 Thread Eric V. Smith
Change by Eric V. Smith : -- nosy: +eric.smith ___ Python tracker ___ ___

[issue31622] Make threading.get_ident() return an opaque type

2017-10-01 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le 01/10/2017 à 21:20, Benjamin Peterson a écrit : > >>> signal.pthread_kill and pdox's proposed time.pthread_getcpuclockid on >>> https://github.com/python/cpython/pull/3756 >> >> Given how specialized (and of little actual use) those

[issue31622] Make threading.get_ident() return an opaque type

2017-10-01 Thread Benjamin Peterson
Benjamin Peterson added the comment: On Sun, Oct 1, 2017, at 12:15, Antoine Pitrou wrote: > > Antoine Pitrou added the comment: > > Le 01/10/2017 à 21:07, Benjamin Peterson a écrit : > > > > signal.pthread_kill and pdox's proposed

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

2017-10-01 Thread Stefan Krah
Stefan Krah added the comment: OpenBSD reduces to the range [-pi/4,pi/4]: https://github.com/openbsd/src/blob/master/lib/libm/src/s_tan.c According to the man page on i386: http://man.openbsd.org/FreeBSD-11.0/math.3 "Argument reduction is not performed accurately

[issue31622] Make threading.get_ident() return an opaque type

2017-10-01 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le 01/10/2017 à 21:07, Benjamin Peterson a écrit : > > signal.pthread_kill and pdox's proposed time.pthread_getcpuclockid on > https://github.com/python/cpython/pull/3756 Given how specialized (and of little actual use) those functions are, I

[issue31622] Make threading.get_ident() return an opaque type

2017-10-01 Thread Benjamin Peterson
Benjamin Peterson added the comment: On Sun, Oct 1, 2017, at 12:05, Antoine Pitrou wrote: > > Antoine Pitrou added the comment: > > > You don't think having a function that takes an integer and dereferences it > > as memory is a bad idea? > > I'm not

[issue31622] Make threading.get_ident() return an opaque type

2017-10-01 Thread Antoine Pitrou
Antoine Pitrou added the comment: > You don't think having a function that takes an integer and dereferences it > as memory is a bad idea? I'm not sure what you're talking about. What function is that? -- ___ Python tracker

[issue31622] Make threading.get_ident() return an opaque type

2017-10-01 Thread Benjamin Peterson
Benjamin Peterson added the comment: You don't think having a function that takes an integer and dereferences it as memory is a bad idea? -- nosy: +benjamin.peterson ___ Python tracker

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

2017-10-01 Thread Tim Peters
Tim Peters added the comment: Of course the relationship is extremely delicate near pi/2. On my Windows Python 3: >>> import math >>> (1.5707963267948961).hex() '0x1.921fb54442d16p+0' >>> math.tan(float.fromhex('0x1.921fb54442d16p+0')) # what the test expects

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

2017-10-01 Thread Mark Dickinson
Mark Dickinson added the comment: So actually, the cause of the inaccuracy here could be that OpenBSD _is_ using the hardware instructions ... -- ___ Python tracker

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

2017-10-01 Thread Mark Dickinson
Mark Dickinson added the comment: I'm fairly sure most modern OSs on x86-64 use software implementations of sin, cos and tan. At least, I hope so: the x87 hardware versions are notoriously inaccurate:

[issue31654] ctypes should support atomic operations

2017-10-01 Thread Antoine Pitrou
Antoine Pitrou added the comment: Note that if there is already a C API to perform atomic ops, you can simply use ctypes to invoke that API. Unfortunately, the aforementioned GCC builtins seem to be only available as intrinsics (at least I couldn't find a shared library that

[issue31654] ctypes should support atomic operations

2017-10-01 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le 01/10/2017 à 20:04, Daniel Colascione a écrit : > > It's not that specialized. You might want atomic updates for coordinating > with C APIs that expect callers to have this capability. That does sound specialized to me :-) Can you give an

[issue31654] ctypes should support atomic operations

2017-10-01 Thread Daniel Colascione
Daniel Colascione added the comment: On Oct 1, 2017 10:46 AM, "Antoine Pitrou" wrote: Antoine Pitrou added the comment: While the use case is reasonable (if specialized), It's not that specialized. You might want atomic updates for

[issue31654] ctypes should support atomic operations

2017-10-01 Thread Daniel Colascione
Daniel Colascione added the comment: On Oct 1, 2017 10:19 AM, "Raymond Hettinger" wrote: Raymond Hettinger added the comment: > Compare-and-exchange is sufficient for avoiding the GIL contention > I describe above. If

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

2017-10-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: I would have thought this would be a straight pass-through to the underlying hardware FPU tan() instruction so that it would give the same answer for the same hardware regardless of O/S. Perhaps we're seeing a software-only

[issue31654] ctypes should support atomic operations

2017-10-01 Thread Antoine Pitrou
Antoine Pitrou added the comment: While the use case is reasonable (if specialized), I'm not sure ctypes is the place to expose such functionality, which can be quite extensive (see https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html). Perhaps as a separate

[issue31622] Make threading.get_ident() return an opaque type

2017-10-01 Thread Antoine Pitrou
Antoine Pitrou added the comment: > On a system with pthreads, the thread_id that Python provides is merely > pthread_t casted to unsigned long. This works today, but is in violation of > the standard, and could break on systems with exotic pthread_t. I don't think that

[issue31654] ctypes should support atomic operations

2017-10-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Compare-and-exchange is sufficient for avoiding the GIL contention > I describe above. If Python objects are involved, it is more complicated than you suggest. Possibly, multiprocessing can offer a shared counter that

[issue21983] segfault in ctypes.cast

2017-10-01 Thread Oren Milman
Oren Milman added the comment: IMHO, Lib/ctypes/test/test_cast.py is the relevant test. Mark, do you still wish to provide a fix for that? (Otherwise, i would be happy to open a PR.) -- nosy: +Oren Milman ___ Python tracker

[issue31622] Make threading.get_ident() return an opaque type

2017-10-01 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +ncoghlan, pitrou ___ Python tracker ___

[issue31655] SimpleNamespace accepts non-string keyword names

2017-10-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Wouldn't be better to add also the check that keyword names > for SimpleNamespace constructor are strings? Yes. > I don't know how classify this issue, as a bug or an enhancement. It is arguably a bug fix. +0 for putting

[issue31553] Extend json.tool to handle jsonlines (with a flag)

2017-10-01 Thread Jeffrey Rackauckas
Change by Jeffrey Rackauckas : -- keywords: +patch pull_requests: +3828 stage: -> patch review ___ Python tracker ___

[issue31656] Bitwise operations for bytes-type

2017-10-01 Thread R. David Murray
R. David Murray added the comment: What happens when you apply a bitwise operation to two bytes objects of unequal length? Since the answer to that question is not obvious, we simply don't support the operation. If you want to make a proposal for this the python-ideas

[issue31657] unit test for optimization levels does not cover __debug__ case

2017-10-01 Thread diana
Change by diana : -- keywords: +patch pull_requests: +3827 stage: -> patch review ___ Python tracker ___

[issue31657] unit test for optimization levels does not cover __debug__ case

2017-10-01 Thread diana
New submission from diana : There are currently three supported optimization levels (0, 1, and 2). Briefly summarized, they do the following. 0: no optimizations 1: remove assert statements and __debug__ blocks 2: remove docstrings, assert statements,

[issue31656] Bitwise operations for bytes-type

2017-10-01 Thread Matthias Gilch
New submission from Matthias Gilch : I've seen that the bytes type does not support bitwise operations, but I think users would expect that those operations will work. -- components: Interpreter Core messages: 303464 nosy: MGilch priority: normal

[issue31655] SimpleNamespace accepts non-string keyword names

2017-10-01 Thread R. David Murray
R. David Murray added the comment: Sorry, not broken, it just raises a type error, which is appropriate :) -- ___ Python tracker

[issue31654] ctypes should support atomic operations

2017-10-01 Thread SilentGhost
Change by SilentGhost : -- nosy: +amaury.forgeotdarc, belopolsky, meador.inge ___ Python tracker ___

[issue31555] Windows pyd slower when not loaded via load_dynamic

2017-10-01 Thread Steve Dower
Steve Dower added the comment: I don't really care, since you're comparing multiple unsupported technologies, but my guess is that the egg install injects the library much earlier on sys.path, which avoids most of the relatively expensive file system scan. --

[issue31655] SimpleNamespace accepts non-string keyword names

2017-10-01 Thread R. David Murray
Change by R. David Murray : -- nosy: +eric.snow ___ Python tracker ___ ___

[issue31655] SimpleNamespace accepts non-string keyword names

2017-10-01 Thread R. David Murray
R. David Murray added the comment: Well, it would be an "unenhancement" (reducing functionality :). What I think it would be classed as is an API bug fix, and those generally can be made only in feature releases. I can imagine code depending on this ability, since

[issue31478] assertion failure in random.seed() in case the seed argument has a bad __abs__() method

2017-10-01 Thread Oren Milman
Change by Oren Milman : -- pull_requests: +3826 ___ Python tracker ___ ___

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

2017-10-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Using nested _PyMem_DebugRawRealloc() looks suspicions to me. This may be a bug. But even without nested _PyMem_DebugRawRealloc() writing to the extra memory after using realloc() looks wrong to me. This can break other

[issue31626] Crash in _PyUnicode_DecodeUnicodeEscape on OpenBSD

2017-10-01 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +3825 stage: -> patch review ___ Python tracker ___

[issue31555] Windows pyd slower when not loaded via load_dynamic

2017-10-01 Thread Safihre
Safihre added the comment: If you know the problem, would you also know the solution? What is the difference in how they generate sys.path entries and how does this affect performance during execution of the module function? Just want to understand what is going on :)

[issue31308] forkserver process isn't re-launched if it died

2017-10-01 Thread Antoine Pitrou
Antoine Pitrou added the comment: Looks like this will not make into 3.6.3. I'd like to sum up the discussion a bit: - I think at the very least least we must protect the forkserver against SIGINT, like the semaphore tracker already is - I think it's beneficial to also restart

[issue31626] Crash in _PyUnicode_DecodeUnicodeEscape on OpenBSD

2017-10-01 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- priority: normal -> critical ___ Python tracker ___

[issue31626] Crash in _PyUnicode_DecodeUnicodeEscape on OpenBSD

2017-10-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There several bugs in the memory allocator. Incorrectly detected the case when realloc() resizes a memory block in-place. Wrong address is used for filling the extra memory with DEADBYTE. -if (q == oldq && nbytes <

[issue31653] Don't release the GIL if we can acquire a multiprocessing semaphore immediately

2017-10-01 Thread Antoine Pitrou
Change by Antoine Pitrou : -- type: enhancement -> performance ___ Python tracker ___ ___

[issue31465] Allow _PyType_Lookup() to raise exceptions

2017-10-01 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: -3632 ___ Python tracker ___

[issue31465] Allow _PyType_Lookup() to raise exceptions

2017-10-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I'm positive to this change in general, but this is too complex and delicate code. In needs careful reviewing. -- ___ Python tracker

[issue31336] Speed up _PyType_Lookup() for class creation

2017-10-01 Thread Stefan Behnel
Stefan Behnel added the comment: Thanks for the reviews, and thank you for merging it, Serhiy. -- ___ Python tracker ___

[issue31336] Speed up _PyType_Lookup() for class creation

2017-10-01 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue31336] Speed up _PyType_Lookup() for class creation

2017-10-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you for your contribution Stefan! I had doubts about your initial (much simpler) changes, but changed my mind. -- ___ Python tracker

[issue31336] Speed up _PyType_Lookup() for class creation

2017-10-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 2102c789035ccacbac4362589402ac68baa2cd29 by Serhiy Storchaka (scoder) in branch 'master': bpo-31336: Speed up type creation. (#3279) https://github.com/python/cpython/commit/2102c789035ccacbac4362589402ac68baa2cd29

[issue31651] io.FileIO cannot write more than 2GB (-4096) bytes??? must be documented (if not fixed)

2017-10-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > On Linux, write() (and similar system calls) will transfer at most 0x7000 > (2,147,479,552) bytes, returning the number of bytes > actually transferred. (This is true on both 32-bit and 64-bit > systems.) This is

[issue31478] assertion failure in random.seed() in case the seed argument has a bad __abs__() method

2017-10-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I agree that a backport is still desirable. Your plan LGTM. Implement __abs__ raising an exception (test both int ant long subclasses). Make sure that no error is raised. Make sure that random() returns the same value as when

[issue31655] SimpleNamespace accepts non-string keyword names

2017-10-01 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : Usually non-string keyword names are rejected. >>> def f(**kwargs): pass >>> >>>

[issue31653] Don't release the GIL if we can acquire a multiprocessing semaphore immediately

2017-10-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Looks reasonable to me. Do you want to provide a patch Daniel? -- components: +Extension Modules -Library (Lib) keywords: +easy (C) nosy: +davin, pitrou, serhiy.storchaka stage: -> needs patch type: -> enhancement