[issue35888] ssl module - could not get the server certificate w/o completed handshake

2019-02-01 Thread Lee Eric


New submission from Lee Eric :

Hi,

I'm not sure if this is the right place to ask after I exhausted several 
communication ways. I'm trying to use standard ssl module to get the server 
certificate details. If I understand correctly, the certificate I can get only 
when the TLS/SSL handshake is done. Which means, if the server uses mTLS to 
authenticate client and I use ssl module to try to get the peer certificate w/o 
client certificate, I would not get the result due to the handshake is not 
complete.

I would like to know if there's any method that I can get the certificate even 
the handshake is not complete. Also, as the very initial handshake stage, in 
Server Hello the service side has sent out the server certificate already.

If the standard ssl module is designed in this behavior, is there any other 
module I can use to bypass the completed handshake to get the server 
certificate?

Thanks.

Eric

--
assignee: christian.heimes
components: SSL
messages: 334738
nosy: Lee Eric, christian.heimes
priority: normal
severity: normal
status: open
title: ssl module - could not get the server certificate w/o completed handshake
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue35813] shared memory construct to avoid need for serialization between processes

2019-02-01 Thread Davin Potts


Davin Potts  added the comment:


New changeset e5ef45b8f519a9be9965590e1a0a587ff584c180 by Davin Potts in branch 
'master':
bpo-35813: Added shared_memory submodule of multiprocessing. (#11664)
https://github.com/python/cpython/commit/e5ef45b8f519a9be9965590e1a0a587ff584c180


--

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-02-01 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +11630, 11631, 11632

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-02-01 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +11630, 11631

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-02-01 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +11630

___
Python tracker 

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



[issue34235] PyArg_ParseTupleAndKeywords: support required keyword arguments

2019-02-01 Thread Michael Sullivan


Michael Sullivan  added the comment:

How about adding another sigil that indicates that subsequent keyword-only 
arguments are required? So then your example becomes (using ` as a totally 
strawman option):

PyArg_ParseTupleAndKeywords(args, kwds, "O|O$O`O", kwlist, , , , )

It's a little complicated but so is Python argument processing, so maybe that 
makes sense.

I can submit a PR for this.

--
nosy: +msullivan

___
Python tracker 

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



[issue35321] None _frozen_importlib.__spec__.origin attribute

2019-02-01 Thread Nina Zakharenko


Change by Nina Zakharenko :


--
keywords: +patch
pull_requests: +11629
stage: test needed -> patch review

___
Python tracker 

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



[issue35537] use os.posix_spawn in subprocess

2019-02-01 Thread Nina Zakharenko


Change by Nina Zakharenko :


--
pull_requests: +11626, 11627

___
Python tracker 

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



[issue35537] use os.posix_spawn in subprocess

2019-02-01 Thread Nina Zakharenko


Change by Nina Zakharenko :


--
pull_requests: +11626, 11627, 11628

___
Python tracker 

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



[issue35537] use os.posix_spawn in subprocess

2019-02-01 Thread Nina Zakharenko


Change by Nina Zakharenko :


--
pull_requests: +11626

___
Python tracker 

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



[issue35887] Doc string for updating the frozen version of importlib in _bootstrap.py incorrect

2019-02-01 Thread Nina Zakharenko


New submission from Nina Zakharenko :

In the process of creating a fix for issue #35321, I noticed what I believe to 
be a documentation omission. 

In Lib/importlib/_bootstrap.py the top level comment states that:

# IMPORTANT: Whenever making changes to this module, be sure to run
# a top-level make in order to get the frozen version of the module
# updated.

>From my testing, it appears that the header file will only be updated when 
>running `make regen-importlib`

To repo:
- make a code change in Lib/importlib/_bootstrap_external.py
- run a top-level `make`
- see that Python/importlib.h does not change
- run `make regen-importlib`
- see that Python/importlib.h has now been updated

The documentation in Lib/importlib/_bootstrap_external.py does in fact mention 
this.

I propose amending the documentation to include the correct instructions.

If this is deemed necessary, I will write the patch over the weekend.

--
assignee: nnja
components: Library (Lib)
messages: 334735
nosy: barry, nnja
priority: low
severity: normal
status: open
title: Doc string for updating the frozen version of importlib in _bootstrap.py 
incorrect
versions: Python 3.8

___
Python tracker 

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



[issue35886] Move PyInterpreterState into Include/internal/pycore_pystate.h

2019-02-01 Thread Eric Snow


Eric Snow  added the comment:

FWIW, I was hoping to the same for PyThreadState but it looks like 6 of its 
fields are exposed in "stable" header files via the following macros:

  # Include/object.h
  Py_TRASHCAN_SAFE_BEGIN
  Py_TRASHCAN_SAFE_END
  Include.ceval.h
  Py_EnterRecursiveCall
  Py_LeaveRecursiveCall
  _Py_MakeRecCheck
  Py_ALLOW_RECURSION
  Py_END_ALLOW_RECURSION

I'm not sure how that factors into the stable ABI (PyThreadState wasn't ever 
guarded by Py_LIMITED_API).  However, I didn't need to deal with it right now 
so I'm not going to go there. :)

--

___
Python tracker 

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



[issue35886] Move PyInterpreterState into Include/internal/pycore_pystate.h

2019-02-01 Thread Eric Snow


Change by Eric Snow :


--
keywords: +patch, patch, patch
pull_requests: +11623, 11624, 11625
stage: needs patch -> patch review

___
Python tracker 

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



[issue35886] Move PyInterpreterState into Include/internal/pycore_pystate.h

2019-02-01 Thread Eric Snow


Change by Eric Snow :


--
keywords: +patch, patch
pull_requests: +11623, 11624
stage: needs patch -> patch review

___
Python tracker 

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



[issue35886] Move PyInterpreterState into Include/internal/pycore_pystate.h

2019-02-01 Thread Eric Snow


Change by Eric Snow :


--
keywords: +patch
pull_requests: +11623
stage: needs patch -> patch review

___
Python tracker 

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



[issue35839] Suggestion: Ignore sys.modules entries with no __spec__ attribute in find_spec

2019-02-01 Thread Barry A. Warsaw


Change by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue35886] Move PyInterpreterState into Include/internal/pycore_pystate.h

2019-02-01 Thread Eric Snow


New submission from Eric Snow :

In November Victor created the Include/cpython directory and moved a decent 
amount of public (but not limited) API there.  This included the 
PyInterpreterState struct.  I'd like to move it into the "internal" headers 
since it is somewhat coupled to the internal runtime implementation.  The 
alternative is extra complexity.  I ran into this while working on another 
issue.

Note that the docs indicate that all of the struct's fields are private (and I 
am not aware of any macros leaking fields into the stable ABI).  So moving it 
should not break anything (yeah, right!), and certainly not the stable ABI 
(Victor's move would have done that already).

--
assignee: eric.snow
messages: 334733
nosy: eric.snow, vstinner
priority: normal
severity: normal
stage: needs patch
status: open
title: Move PyInterpreterState into Include/internal/pycore_pystate.h
versions: Python 3.8

___
Python tracker 

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



[issue35321] None _frozen_importlib.__spec__.origin attribute

2019-02-01 Thread Barry A. Warsaw


Change by Barry A. Warsaw :


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



[issue35845] Can't read a F-contiguous memoryview in physical order

2019-02-01 Thread Stefan Krah


Change by Stefan Krah :


--
keywords: +patch
pull_requests: +11620
stage: needs patch -> patch review

___
Python tracker 

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



[issue35845] Can't read a F-contiguous memoryview in physical order

2019-02-01 Thread Stefan Krah


Change by Stefan Krah :


--
keywords: +patch, patch
pull_requests: +11620, 11621
stage: needs patch -> patch review

___
Python tracker 

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



[issue35845] Can't read a F-contiguous memoryview in physical order

2019-02-01 Thread Stefan Krah


Change by Stefan Krah :


--
keywords: +patch, patch, patch
pull_requests: +11620, 11621, 11622
stage: needs patch -> patch review

___
Python tracker 

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



[issue24177] Add https?_proxy support to http.client

2019-02-01 Thread Demian Brecht


Change by Demian Brecht :


--
keywords: +patch, patch
pull_requests: +11617, 11618
stage: needs patch -> patch review

___
Python tracker 

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



[issue24177] Add https?_proxy support to http.client

2019-02-01 Thread Demian Brecht


Change by Demian Brecht :


--
keywords: +patch, patch, patch
pull_requests: +11617, 11618, 11619
stage: needs patch -> patch review

___
Python tracker 

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



[issue24177] Add https?_proxy support to http.client

2019-02-01 Thread Demian Brecht


Change by Demian Brecht :


--
keywords: +patch
pull_requests: +11617
stage: needs patch -> patch review

___
Python tracker 

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



[issue35883] Change invalid unicode characters to replacement characters in argv

2019-02-01 Thread Eryk Sun


Eryk Sun  added the comment:

In Unix, Python 3.6 decodes the char * command line arguments via mbstowcs. In 
Linux, I see the following misbehavior of mbstowcs when decoding an overlong 
UTF-8 sequence:

>>> mbstowcs = ctypes.CDLL(None, use_errno=True).mbstowcs
>>> arg = bytes(x + 128 for x in [1 + 124, 63, 63, 59, 58, 58])
>>> mbstowcs(None, arg, 0)
1
>>> buf = (ctypes.c_int * 2)()
>>> mbstowcs(buf, arg, 2)
1
>>> hex(buf[0])
'0x7fffbeba'

This shouldn't be an issue in 3.7, at least not with the default UTF-8 mode 
configuration. With this mode, Py_DecodeLocale calls _Py_DecodeUTF8Ex using the 
surrogateescape error handler [1].

[1]: https://github.com/python/cpython/blob/v3.7.2/Python/fileutils.c#L456

--
nosy: +eryksun

___
Python tracker 

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



[issue17972] inspect module docs omits many functions

2019-02-01 Thread kernc


Change by kernc :


--
nosy: +kernc

___
Python tracker 

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



[issue35880] math.sin has no backward error; this isn't documented

2019-02-01 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
stage:  -> needs patch
versions:  -Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue35879] test_type_comments leaks references

2019-02-01 Thread Guido van Rossum


Change by Guido van Rossum :


--
assignee:  -> gvanrossum
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue35879] test_type_comments leaks references

2019-02-01 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset d2b4c19d53f5f021fb1c7c32d48033a92ac4fe49 by Guido van Rossum in 
branch 'master':
bpo-35879: Fix type comment leaks (GH-11728)
https://github.com/python/cpython/commit/d2b4c19d53f5f021fb1c7c32d48033a92ac4fe49


--

___
Python tracker 

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



[issue35879] test_type_comments leaks references

2019-02-01 Thread Guido van Rossum


Guido van Rossum  added the comment:

Found it! You need to call PyArena_AddPyObject(). I racked my brain and finally 
found the example code I needed at the end of new_identifier(). Please review 
quickly so we won't ship 3.8.0a1 with a memory leak.

--

___
Python tracker 

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



[issue35879] test_type_comments leaks references

2019-02-01 Thread Guido van Rossum


Change by Guido van Rossum :


--
keywords: +patch, patch, patch
pull_requests: +11614, 11615, 11616
stage:  -> patch review

___
Python tracker 

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



[issue35879] test_type_comments leaks references

2019-02-01 Thread Guido van Rossum


Change by Guido van Rossum :


--
keywords: +patch, patch
pull_requests: +11614, 11615
stage:  -> patch review

___
Python tracker 

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



[issue35879] test_type_comments leaks references

2019-02-01 Thread Guido van Rossum


Change by Guido van Rossum :


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

___
Python tracker 

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



[issue35885] configparser: indentation

2019-02-01 Thread mrs.red


New submission from mrs.red :

The configparser module does not have an option for indentation. I would like 
to indent the keys by tabs. Maybe we could implement an option for that?
I already have some example code for it.

--
components: Library (Lib)
messages: 334729
nosy: mrs.red
priority: normal
severity: normal
status: open
title: configparser: indentation
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue34886] subprocess.run throws exception when input and stdin are passed as kwargs

2019-02-01 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

I opened a PR with @josh.r proposed change.

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue34886] subprocess.run throws exception when input and stdin are passed as kwargs

2019-02-01 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


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

___
Python tracker 

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



[issue34886] subprocess.run throws exception when input and stdin are passed as kwargs

2019-02-01 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
keywords: +patch, patch, patch
pull_requests: +11611, 11612, 11613
stage:  -> patch review

___
Python tracker 

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



[issue34886] subprocess.run throws exception when input and stdin are passed as kwargs

2019-02-01 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
keywords: +patch, patch
pull_requests: +11611, 11612
stage:  -> patch review

___
Python tracker 

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



[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks a lot Guido and Emily for guidance on this issue. Happy to see this for 
alpha release :)

--

___
Python tracker 

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



[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Emily Morehouse


Change by Emily Morehouse :


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



[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Emily Morehouse


Emily Morehouse  added the comment:


New changeset ac19081c26eaa7de3e6aabeb789ddc2e7cdd5b24 by Emily Morehouse in 
branch 'master':
bpo-35877: Add test for while loop named expression without parentheses 
(GH-11726)
https://github.com/python/cpython/commit/ac19081c26eaa7de3e6aabeb789ddc2e7cdd5b24


--

___
Python tracker 

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



[issue35861] test_named_expressions raises SyntaxWarning

2019-02-01 Thread Emily Morehouse


Change by Emily Morehouse :


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



[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Emily Morehouse


Emily Morehouse  added the comment:

Thanks, Karthikeyan! I added an additional test to make sure this gets 
coverage. I'll close out this issue once tests pass and I can merge that.

--

___
Python tracker 

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



[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Emily Morehouse


Change by Emily Morehouse :


--
pull_requests: +11608, 11609, 11610

___
Python tracker 

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



[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Emily Morehouse


Change by Emily Morehouse :


--
pull_requests: +11608

___
Python tracker 

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



[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Emily Morehouse


Change by Emily Morehouse :


--
pull_requests: +11608, 11609

___
Python tracker 

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



[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Emily Morehouse


Emily Morehouse  added the comment:


New changeset d4fceaafb8e3f8700d9ec6ab37a51e903392f74f by Emily Morehouse 
(Xtreak) in branch 'master':
bpo-35877: Make parenthesis optional for named expression in while statement 
(GH-11724)
https://github.com/python/cpython/commit/d4fceaafb8e3f8700d9ec6ab37a51e903392f74f


--

___
Python tracker 

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



[issue35879] test_type_comments leaks references

2019-02-01 Thread Guido van Rossum


Guido van Rossum  added the comment:

In the meantime here's the fix for the '# type: ignore' leak. 
https://github.com/gvanrossum/cpython/commit/ef3b9e952906aab8f5452ebcf3b9e359d35615b4

--

___
Python tracker 

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



[issue35879] test_type_comments leaks references

2019-02-01 Thread Guido van Rossum


Guido van Rossum  added the comment:

I have been trying to do the same thing and likewise, no luck understanding yet 
how type comments are different here.

--

___
Python tracker 

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



[issue35879] test_type_comments leaks references

2019-02-01 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I'm almost sure this is not the correct fix, but I think these findings point 
to that object as the one being leaked. I do not understand how this object 
should be deallocated and where, I am trying to follow how the other PyObject* 
(name) is deallocated but I am not finding anything :(

--

___
Python tracker 

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



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-02-01 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 85d83ec7c99727476c79feb5c34c65264a99144e by Raymond Hettinger 
(Amador Pahim) in branch 'master':
bpo-35864: fix namedtuple._asdict() docstring (GH-11720)
https://github.com/python/cpython/commit/85d83ec7c99727476c79feb5c34c65264a99144e


--

___
Python tracker 

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



[issue35884] Add variable access benchmark to Tools/Scripts

2019-02-01 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Here's what the output looks like (here am comparing a fresh Py3.8 with Clang 
versus the same build with GCC-8):

$ make distclean && ./configure && make
$ py Tools/scripts/var_access_benchmark.py
Speed of different kinds of variable accesses:
   4.2 μs   read_local
   4.7 μs   read_nonlocal
  13.7 μs   read_global
  18.5 μs   read_builtin
  18.2 μs   read_classvar
  26.8 μs   read_instancevar
  20.3 μs   read_instancevar_slots
  19.1 μs   read_namedtuple
  26.9 μs   read_boundmethod
   4.5 μs   write_local
   4.8 μs   write_nonlocal
  18.8 μs   write_global
  89.9 μs   write_classvar
  37.1 μs   write_instancevar
  25.7 μs   write_instancevar_slots
   0.3 μs   loop_overhead

$ make distclean && ./configure CC=gcc-8 && make
$ py Tools/scripts/var_access_benchmark.py
Speed of different kinds of variable accesses:
   4.0 μs   read_local
   4.2 μs   read_nonlocal
  11.4 μs   read_global
  16.3 μs   read_builtin
  16.4 μs   read_classvar
  24.8 μs   read_instancevar
  20.1 μs   read_instancevar_slots
  16.8 μs   read_namedtuple
  23.2 μs   read_boundmethod
   4.3 μs   write_local
   4.5 μs   write_nonlocal
  15.4 μs   write_global
  89.4 μs   write_classvar
  33.5 μs   write_instancevar
  24.5 μs   write_instancevar_slots
   0.3 μs   loop_overhead

--

___
Python tracker 

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



[issue35884] Add variable access benchmark to Tools/Scripts

2019-02-01 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue35884] Add variable access benchmark to Tools/Scripts

2019-02-01 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
keywords: +patch, patch
pull_requests: +11606, 11607
stage:  -> patch review

___
Python tracker 

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



[issue35879] test_type_comments leaks references

2019-02-01 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Note:

the extra DECREF will fail in other tests because it will deallocate None if 
ast2obj_object returns Py_None because the comment is NULL.

--

___
Python tracker 

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



[issue35879] test_type_comments leaks references

2019-02-01 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

Hu I may be missing something but these is what I am seeing:

BASELINE


❯ ./python.exe -m test test_type_comments -R 10:10
Run tests sequentially
0:00:00 load avg: 2.30 [1/1] test_type_comments
beginning 20 repetitions
12345678901234567890

test_type_comments leaked [37, 37, 37, 37, 37, 37, 37, 37, 37, 37] references, 
sum=370
test_type_comments leaked [11, 12, 11, 11, 11, 11, 11, 11, 11, 11] memory 
blocks, sum=111
test_type_comments failed

== Tests result: FAILURE ==

1 test failed:
test_type_comments

Total duration: 1 sec 28 ms
Tests result: FAILURE


EXTRA_DECREF

❯ git --no-pager diff
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index 1a56e90bca..cb3036dbba 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -2791,6 +2791,7 @@ ast2obj_stmt(void* _o)
 if (_PyObject_SetAttrId(result, _type_comment, value) == -1)
 goto failed;
 Py_DECREF(value);
+Py_DECREF(value);
 break;
 case AsyncFunctionDef_kind:
 result = PyType_GenericNew(AsyncFunctionDef_type, NULL, NULL);

~/github/cpython master ✗
❯ ./python.exe -m test test_type_comments -R 10:10
Run tests sequentially
0:00:00 load avg: 2.12 [1/1] test_type_comments
beginning 20 repetitions
12345678901234567890

test_type_comments leaked [8, 9, 8, 8, 8, 8, 8, 8, 8, 8] memory blocks, sum=81
test_type_comments failed

== Tests result: FAILURE ==

1 test failed:
test_type_comments

Total duration: 976 ms
Tests result: FAILURE


So my interpretation is that there are still leaks somewhere or, but the 
extra-decref resolves the reference leaks somehow. Probably the extra DECREF 
here is not the proper fix, but is as far as I went when I started debugging 
this morning. Also, if you change one test to do the parsing in a loop:


 def test_funcdef(self):
-tree = self.parse(funcdef)
+for _ in range(10):
+tree = self.parse(funcdef)
 self.assertEqual(tree.body[0].type_comment, "() -> int")


And you ran test_type_comments.py with PYTHONDUMPREFS=1:

WITHOUT EXTRA DECREF


  65 wrapper_descriptor
  75 str
  82 str
  85 str
  86 str
  92 str
 110 str
 416 str
200015 str


WITH EXTRA DECREF
-

PYTHONDUMPREFS=1 ./python.exe -m test test_type_comments |& cut -d " " -f 3 | 
uniq -c | sort -n

  85 str
  86 str
  92 str
 110 str
 416 str

--

___
Python tracker 

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



[issue35884] Add variable access benchmark to Tools/Scripts

2019-02-01 Thread Raymond Hettinger


New submission from Raymond Hettinger :

Adding a short script that I've found useful many times over the past decade. 
It has allowed my to quickly notice performance regressions and has helped 
identify places in need of optimization work.  It is also useful for building a 
empirical mental model of the relative cost of various kinds of variable access 
-- this is useful in writing high performance code.

--
components: Demos and Tools
messages: 334716
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Add variable access benchmark to Tools/Scripts
type: performance
versions: Python 3.8

___
Python tracker 

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



[issue35861] test_named_expressions raises SyntaxWarning

2019-02-01 Thread Emily Morehouse


Emily Morehouse  added the comment:


New changeset 075de6cf6cb0f5f4d3711fc07f023a9a7a0a816b by Emily Morehouse 
(Joannah Nanjekye) in branch 'master':
bpo-35861: Fix SyntaxWarning in test_named_expressions.py (GH-11722)
https://github.com/python/cpython/commit/075de6cf6cb0f5f4d3711fc07f023a9a7a0a816b


--

___
Python tracker 

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



[issue35883] Change invalid unicode characters to replacement characters in argv

2019-02-01 Thread SilentGhost


Change by SilentGhost :


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



[issue35258] Consider enabling -Wmissing-prototypes

2019-02-01 Thread Eric Snow


Change by Eric Snow :


--
nosy: +eric.snow

___
Python tracker 

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



[issue35766] Merge typed_ast back into CPython

2019-02-01 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 3a32e3bf880f0842ac73d18285f5a1caa902a2ca by Guido van Rossum in 
branch 'master':
bpo-35766 follow-up: Kill half-support for FunctionType in PyAST_obj2mod 
(#11714)
https://github.com/python/cpython/commit/3a32e3bf880f0842ac73d18285f5a1caa902a2ca


--

___
Python tracker 

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



[issue35879] test_type_comments leaks references

2019-02-01 Thread Guido van Rossum


Guido van Rossum  added the comment:

> ast2obj_string increments it once and the setattr does it again and then 
> there is only one Py_DECREF.

Actually I don't understand how this is the leak. Adding another 
Py_DECREF(value) causes an immediate crash. I've been trying to follow other 
paths but haven't found the root yet.

--

___
Python tracker 

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



[issue35883] Change invalid unicode characters to replacement characters in argv

2019-02-01 Thread Neui


Neui  added the comment:

I'd say that the terminal is not really relevant here, but rather the locale 
settings because it uses wide string functions. Prefixing it with LC_ALL=C 
produces the same output as you had on my Ubuntu machine. I also get that 
output when running it in Cygwin (and MSYS2), although it seems setting LC_ALL 
has no effect.

--

___
Python tracker 

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



[issue35773] test_bdb fails on AIX bot (regression)

2019-02-01 Thread Michael Felt


Michael Felt  added the comment:

OK. New info.

Back in the time of issue 34347 I installed some extra filesets to support 
UTF-8 on the virtual machine (aka partition) that I have the bot on.

On systems where this fileset is not installed this test does not fail.

Shall dig further - in a bout a week - but I expect it is something very 
different than whatever bdb is testing.

fyi - the additional fileset (not normally installed afaik) is/are: 
  bos.loc.com.utf   7.1.4.30C FCommon Locale Support - UTF-8
  bos.loc.utf.EN_US 7.1.4.30C FBase System Locale UTF Code

--

___
Python tracker 

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



[issue35134] Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details

2019-02-01 Thread Eric Snow


Change by Eric Snow :


--
nosy: +eric.snow

___
Python tracker 

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



[issue35829] datetime: parse "Z" timezone suffix in fromisoformat()

2019-02-01 Thread Jakub Wilk


Change by Jakub Wilk :


--
nosy: +jwilk

___
Python tracker 

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



[issue35880] math.sin has no backward error; this isn't documented

2019-02-01 Thread Tim Peters


Tim Peters  added the comment:

As Mark said, the behavior of Python's floating-point math functions (not just 
trig, but also log, pow, exp, ...) is inherited almost entirely from the 
platform C's math libraries.  Python itself guarantees nothing about what 
`math.sin(x)` returns for any `x` - and it can, & does, vary across platforms.

--
nosy: +tim.peters

___
Python tracker 

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



[issue35879] test_type_comments leaks references

2019-02-01 Thread Guido van Rossum


Guido van Rossum  added the comment:

OK, let me make a PR, I found another leak for type:ignore.

On Fri, Feb 1, 2019 at 9:22 AM Pablo Galindo Salgado 
wrote:

>
> Pablo Galindo Salgado  added the comment:
>
> The extra referenced happen here in Python-ast.c :
>
> value = ast2obj_string(o->type_comment);
> if (!value) goto failed;
> if (_PyObject_SetAttrId(result, _type_comment, value) == -1)
> goto failed;
> Py_DECREF(value);
>
> ast2obj_string increments it once and the setattr does it again and then
> there is only one Py_DECREF.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue35879] test_type_comments leaks references

2019-02-01 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

The extra referenced happen here in Python-ast.c :

value = ast2obj_string(o->type_comment);
if (!value) goto failed;
if (_PyObject_SetAttrId(result, _type_comment, value) == -1)
goto failed;
Py_DECREF(value);

ast2obj_string increments it once and the setattr does it again and then there 
is only one Py_DECREF.

--

___
Python tracker 

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



[issue35883] Change invalid unicode characters to replacement characters in argv

2019-02-01 Thread SilentGhost


SilentGhost  added the comment:

Hm, this seems to be due to how the terminal emulator handles those special 
characters, actually. I can reproduce in another terminal.

--

___
Python tracker 

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



[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
keywords: +patch, patch, patch
pull_requests: +11603, 11604, 11605
stage: needs patch -> patch review

___
Python tracker 

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



[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
keywords: +patch, patch
pull_requests: +11603, 11604
stage: needs patch -> patch review

___
Python tracker 

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



[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
keywords: +patch
pull_requests: +11603
stage: needs patch -> patch review

___
Python tracker 

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



[issue35880] math.sin has no backward error; this isn't documented

2019-02-01 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

> sin(1<<500) is correctly computed as 0.42925739234242827

py> math.sin(1<<500)
0.9996230490249484

Wolfram Alpha says it is 
0.429257392342428277735329299112473759079115476327819897...

https://www.wolframalpha.com/input/?i=sin%282^500%29=%22TrigRD%22+-%3E+%22R%22


> Some text could be added (which I am happy to produce) that explains what 
> backward error means

You could start by telling us here what you mean by backward error. Are you 
talking about this?

https://en.wikipedia.org/wiki/Numerical_stability#Stability_in_numerical_linear_algebra

--
nosy: +steven.daprano

___
Python tracker 

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



[issue35883] Change invalid unicode characters to replacement characters in argv

2019-02-01 Thread SilentGhost

SilentGhost  added the comment:

I'm on  4.15.0-44-generic and I cannot reproduce the crash. I get "python3: 
can't open file '��': [Errno 2] No such file or directory"

Could you try this on a different machine / installation?

--
nosy: +SilentGhost
type: behavior -> crash

___
Python tracker 

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



[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

> Thanks, Karthikeyan! Can you submit that as a PR?

Sure, I will submit the patch with tests for the same.

Thanks

--

___
Python tracker 

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



[issue35883] Change invalid unicode characters to replacement characters in argv

2019-02-01 Thread Neui


New submission from Neui :

When an invalid unicode character is given to argv (cli arguments), then python 
abort()s with an fatal error about an character not in range (ValueError: 
character U+7fffbeba is not in range [U+; U+10]).

I am wondering if this behaviour should change to replace those with U+FFFD 
REPLACEMENT CHARACTER (like .decode(..., 'replace')) or even with something 
similar/better (see 
https://docs.python.org/3/library/codecs.html#error-handlers )

The reason for this is that other applications can use the invalid character 
since it is just some data (like GDB for use as an argument to the program to 
be debugged), where in python this becomes an limitation, since the script (if 
specified) never runs.

The main motivation for me is that there is an command-not-found debian package 
that gets the wrongly-typed command as a command argument. If that then 
contains an invalid unicode character, it then just fails rather saying it 
couldn't find the/a similar command. If this doesn't get changed, it either 
then has to accept that this is a limitation, use an other way of passing the 
command or re-write it in not python.

# Requires bash 4.2+
# Specifying a script omits the first two lines
$ python3.6 $'\U7fffbeba'
Failed checking if argv[0] is an import path entry
ValueError: character U+7fffbeba is not in range [U+; U+10]
Fatal Python error: no mem for sys.argv
ValueError: character U+7fffbeba is not in range [U+; U+10]

Current thread 0x7fd212eaf740 (most recent call first):
Aborted (core dumped)

$ python3.6 --version
Python 3.6.7

$ uname -a
Linux nopea 4.15.0-39-generic #42-Ubuntu SMP Tue Oct 23 15:48:01 UTC 2018 
x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:Ubuntu 18.04.1 LTS
Release:18.04
Codename:   bionic

GDB backtrace just before throwing the error: (note that it's argc=2 since 
first argument is a script)
#0  find_maxchar_surrogates (begin=begin@entry=0xa847a0 L'\x7fffbeba' , end=end@entry=0xa847d0 L"", maxchar=maxchar@entry=0x7fffde94, 
num_surrogates=num_surrogates@entry=0x7fffde98) at 
../Objects/unicodeobject.c:1626
#1  0x004cee4b in PyUnicode_FromUnicode (u=u@entry=0xa847a0 
L'\x7fffbeba' , size=12) at ../Objects/unicodeobject.c:2017
#2  0x004db856 in PyUnicode_FromWideChar (w=0xa847a0 L'\x7fffbeba' 
, size=, size@entry=-1) at 
../Objects/unicodeobject.c:2502
#3  0x0043253d in makeargvobject (argc=argc@entry=2, 
argv=argv@entry=0xa82268) at ../Python/sysmodule.c:2145
#4  0x00433228 in PySys_SetArgvEx (argc=2, argv=0xa82268, updatepath=1) 
at ../Python/sysmodule.c:2264
#5  0x004332c1 in PySys_SetArgv (argc=, argv=) at ../Python/sysmodule.c:2277
#6  0x0043a5bd in Py_Main (argc=argc@entry=3, argv=argv@entry=0xa82260) 
at ../Modules/main.c:733
#7  0x00421149 in main (argc=3, argv=0x7fffe178) at 
../Programs/python.c:69

Similar issues:
https://bugs.python.org/issue25631 "Segmentation fault with invalid Unicode 
command-line arguments in embedded Python" (actually 'fixed' since it now 
abort()s)
https://bugs.python.org/issue2128 "sys.argv is wrong for unicode strings"

--
components: Interpreter Core
messages: 334703
nosy: Neui
priority: normal
severity: normal
status: open
title: Change invalid unicode characters to replacement characters in argv
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



[issue12822] NewGIL should use CLOCK_MONOTONIC if possible.

2019-02-01 Thread INADA Naoki


Change by INADA Naoki :


--
pull_requests: +11601, 11602
stage:  -> patch review

___
Python tracker 

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



[issue35879] test_type_comments leaks references

2019-02-01 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue12822] NewGIL should use CLOCK_MONOTONIC if possible.

2019-02-01 Thread INADA Naoki


Change by INADA Naoki :


--
pull_requests: +11601
stage:  -> patch review

___
Python tracker 

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



[issue35879] test_type_comments leaks references

2019-02-01 Thread Guido van Rossum


Guido van Rossum  added the comment:

I can confirm it, but I don't understand it yet. Somehow the type_comment 
fields get an extra reference count and are never freed. How are other string 
fields handled?

--

___
Python tracker 

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



[issue34028] Python 3.7.0 wont compile with SSL Support 1.1.0 > alledged missing X509_VERIFY_PARAM_set1_host() support

2019-02-01 Thread Kent Scheidegger


Kent Scheidegger  added the comment:

I was unable to get it working even with all the suggestions in this thread. I 
have a shared account on a system with only Python 2.7 and an old version of 
openssl. I have write access only to my user directory. I installed a new 
openssl in a local directory and pointed to it with both --with-openssl and 
LDFLAGS, as suggested. The configure step seems to work, but on make the 
libssl.so.1.1 still isn't found.

I fell back to Python 3.6. Same result. I fell back to 3.4. It finally worked.

--
nosy: +kscheidegger

___
Python tracker 

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



[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks, Karthikeyan! Can you submit that as a PR?

--

___
Python tracker 

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



[issue25592] distutils docs: data_files always uses sys.prefix

2019-02-01 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

(note typo in the above: /tmp/prefix/pip should be /tmp/prefix/bin/pip)

--

___
Python tracker 

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



[issue25592] distutils docs: data_files always uses sys.prefix

2019-02-01 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> Could you still give it a quick check?

I did just that. For reference, these are the steps:
- Checkout the "2.7" branch of the cpython git repo
- ./configure --prefix=/tmp/prefix --exec-prefix=/tmp/eprefix && make && make 
install
- Install pip 
(https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py)
- /tmp/prefix/pip install --no-deps --verbose pari_jupyter  # This requires the 
PARI/GP library to be installed
- Note that all Jupyter stuff is installed in /tmp/prefix/share/jupyter while 
the directory /tmp/eprefix/share does not exist

--

___
Python tracker 

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



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-02-01 Thread Eric Snow


Eric Snow  added the comment:

FWIW, both PEP 468 (kwargs order) and PEP 520 (class definition order) specify 
order-preserving mapping rather than dict.  The main difference is that they 
are about language features rather than something out of the stdlib. :)

--

___
Python tracker 

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



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-02-01 Thread Eric Snow


Eric Snow  added the comment:

If you prefer, I'd be glad to open separate issues for either thing.

--

___
Python tracker 

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



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-02-01 Thread Eric Snow


Eric Snow  added the comment:

Also, there's a potentially misleading detail that you might consider 
correcting in the text.  However, making it correct might make it slightly less 
clear, so it's a bit of a judgement call on how important it is to be explicit 
here.  (FWIW, I think it's worth it to some extent.)

The language reference doesn't guarantee that dictionaries are order-preserving 
(yet). [1]  Therefore there can be (are?) Python implementations where dict 
isn't ordered.  Users of those implementations may be confused by the docs (and 
docstring) saying the method returns a dict.

This could be addressed by changing those places to say something like it 
returns an insertion-ordered mapping.  The docs entry would also have an 
"CPython implementation detail" part saying it's actually a dict in CPython.

Since "insertion-ordered mapping" isn't nearly as clear as "dict" (even if more 
correct), it may make more sense to simply say "dict".  However, in that case 
I'd recommend at the very least to add a "CPython implementation detail" part 
to the docs entry which says in CPython it returns a dict, but in other 
implementations it may be some other order-preserving mapping.

Honestly, after having written that the latter option seems more sensible. :)


[1] https://docs.python.org/3.8/reference/datamodel.html#index-29

--

___
Python tracker 

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



[issue35864] Replace OrderedDict with regular dict in namedtuple's _asdict() method.

2019-02-01 Thread Eric Snow


Eric Snow  added the comment:

Thanks for doing this, Raymond!

FYI, I found a couple of places where it still refers to OrderedDict:

1. in the doc entry in collections.rst [1]
2. in the docstring [2]


[1] 
https://github.com/python/cpython/commit/0bb4bdf0d93b301407774c4ffd6df54cff947df8#diff-a2f0632ea84b755c7ef5b9bd291c7fdfR890
[2] 
https://github.com/python/cpython/commit/0bb4bdf0d93b301407774c4ffd6df54cff947df8#diff-8a750c700ae5ac1d0a14922de83e99ccR432

--
nosy: +eric.snow

___
Python tracker 

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



[issue30670] pprint for dict in sorted order or insert order?

2019-02-01 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

https://docs.python.org/3/library/pprint.html

> Dictionaries are sorted by key before the display is computed.

https://mail.python.org/pipermail/python-dev/2017-December/151369.html . There 
was some discussion in the thread about this being a breaking change and the 
behavior of pprint. @remi.lapeyre I would suggest waiting for a core dev on 
approving this change before proceeding with a patch to avoid work being wasted.

--
nosy: +xtreak

___
Python tracker 

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



[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

> Emily, I think this would be as simple as making a tiny change to 
> Grammar/Grammar and running make regen-grammar. Can you take care of that?

Thanks, can confirm that this fixes the issue. I changed test to namedexpr_test 
for while statement in grammar and ran `make regen-grammar` and `make`. The 
reported program runs fine and Lib/test/test_named_expressions.py also passes.

➜  cpython git:(master) ✗ cat /tmp/foo.py
import re

with open("/tmp/foo.py") as f:
while line := f.readline():
if match := re.search(r"foo", line):
print(match.string.strip("\n"))
➜  cpython git:(master) ✗ ./python.exe /tmp/foo.py
with open("/tmp/foo.py") as f:
if match := re.search(r"foo", line):


Patch : 

➜  cpython git:(master) ✗ git diff | cat
diff --git a/Grammar/Grammar b/Grammar/Grammar
index e65a688e4c..a425978059 100644
--- a/Grammar/Grammar
+++ b/Grammar/Grammar
@@ -72,7 +72,7 @@ assert_stmt: 'assert' test [',' test]
 compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | 
funcdef | classdef | decorated | async_stmt
 async_stmt: 'async' (funcdef | with_stmt | for_stmt)
 if_stmt: 'if' namedexpr_test ':' suite ('elif' namedexpr_test ':' suite)* 
['else' ':' suite]
-while_stmt: 'while' test ':' suite ['else' ':' suite]
+while_stmt: 'while' namedexpr_test ':' suite ['else' ':' suite]
 for_stmt: 'for' exprlist 'in' testlist ':' [TYPE_COMMENT] suite ['else' ':' 
suite]
 try_stmt: ('try' ':' suite
((except_clause ':' suite)+
diff --git a/Python/graminit.c b/Python/graminit.c
index 6e0f19891b..5cdde2789c 100644
--- a/Python/graminit.c
+++ b/Python/graminit.c
@@ -971,7 +971,7 @@ static arc arcs_42_0[1] = {
 {103, 1},
 };
 static arc arcs_42_1[1] = {
-{26, 2},
+{99, 2},
 };
 static arc arcs_42_2[1] = {
 {27, 3},

--

___
Python tracker 

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



[issue35863] email.headers wraps headers badly

2019-02-01 Thread R. David Murray


R. David Murray  added the comment:

Well, "display" in the context of email includes looking at the raw email 
serialized as a text file.  This is something one can do in most mailers. I use 
nmh as my mailer, which only shows raw headers, so I myself would be personally 
affected if headers were not normally wrapped at 78 characters when possible :)

The >80 characters issue you mention is fixed by the folder used by the new 
API.  That folder will use encoded words to wrap overlong tokens in text 
portions of headers, which may or may not have been the best decision (jury is 
still out on that one), and for non-text headers it does not put in that /n if 
the word won't fit on the next line if wrapped.  (Or at least its not supposed 
to, so if you find a case where it does, please submit a bug report.)

email.Header is a legacy module and no longer maintained.  And yes, I realize 
it is used by default.  There should be an open issue about going through a 
deprecation cycle to make the new API the default, but I've lost track and have 
no time to push for it myself.

--

___
Python tracker 

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



[issue35853] Extend the functools module with more higher order function combinators

2019-02-01 Thread Tobias Pleyer


Tobias Pleyer  added the comment:

Thank you for your quick and detailed answer. It appears I slightly 
misunderstood the purpose of the functools module. However kudos for your great 
effort to push the Python language forward.

Best regards
Tobias

--

___
Python tracker 

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



[issue30670] pprint for dict in sorted order or insert order?

2019-02-01 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi josephsmeng, dict order preservation is now used in a lot of place in 
Python. I will post a patch to make pprint use insertion order in a few hours.

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue35877] parenthesis is mandatory for named expressions in while statement

2019-02-01 Thread Guido van Rossum


Guido van Rossum  added the comment:

Emily, I think this would be as simple as making a tiny change to 
Grammar/Grammar and running make regen-grammar. Can you take care of that?

--
assignee:  -> emilyemorehouse
stage:  -> needs patch

___
Python tracker 

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



[issue35882] distutils fails with UnicodeEncodeError with strange filename in package_data

2019-02-01 Thread Jody McIntyre

New submission from Jody McIntyre :

I encountered an error while installing savReaderWriter using pip from a 
Dockerfile, reported as 
https://bitbucket.org/fomcl/savreaderwriter/issues/73/pip-install-fails-for-non-utf-8-encoding

This is actually an issue with distutils.

Steps to reproduce:

1. Create the following tree. setup.py is as attached. The .sav file is empty.

./setup.py
./savReaderWriter
./savReaderWriter/test_data
./savReaderWriter/test_data/scheiß Encoding.sav

2. Run LANG=C python setup.py install --record=/tmp/install-record.txt 
--single-version-externally-managed

Actual output:

running install
running build
running build_py
package init file 'savReaderWriter/__init__.py' not found (or not a regular 
file)
creating build
creating build/lib
creating build/lib/savReaderWriter
creating build/lib/savReaderWriter/test_data
copying savReaderWriter/test_data/scheiß Encoding.sav -> 
build/lib/savReaderWriter/test_data
running install_lib
running install_egg_info
running egg_info
creating savReaderWriter.egg-info
writing savReaderWriter.egg-info/PKG-INFO
writing dependency_links to savReaderWriter.egg-info/dependency_links.txt
writing top-level names to savReaderWriter.egg-info/top_level.txt
writing manifest file 'savReaderWriter.egg-info/SOURCES.txt'
'savReaderWriter/test_data/schei\udcc3\udc9f Encoding.sav' not utf-8 encodable 
-- skipping
reading manifest file 'savReaderWriter.egg-info/SOURCES.txt'
writing manifest file 'savReaderWriter.egg-info/SOURCES.txt'
removing 
'/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/site-packages/savReaderWriter-1.2.3-py3.6.egg-info'
 (and everything under it)
Copying savReaderWriter.egg-info to 
/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/site-packages/savReaderWriter-1.2.3-py3.6.egg-info
running install_scripts
writing list of installed files to '/tmp/install-record.txt'
Traceback (most recent call last):
  File "setup.py", line 9, in 
version='1.2.3',
  File 
"/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/site-packages/setuptools/__init__.py",
 line 129, in setup
return distutils.core.setup(**attrs)
  File "/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/distutils/core.py", 
line 148, in setup
dist.run_commands()
  File "/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/distutils/dist.py", 
line 955, in run_commands
self.run_command(cmd)
  File "/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/distutils/dist.py", 
line 974, in run_command
cmd_obj.run()
  File 
"/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/site-packages/setuptools/command/install.py",
 line 61, in run
return orig.install.run(self)
  File 
"/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/distutils/command/install.py",
 line 572, in run
self.record)
  File "/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/distutils/cmd.py", 
line 335, in execute
util.execute(func, args, msg, dry_run=self.dry_run)
  File "/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/distutils/util.py", 
line 301, in execute
func(*args)
  File 
"/home/scjody/.pyenv/versions/3.6.5/lib/python3.6/distutils/file_util.py", line 
236, in write_file
f.write(line + "\n")
UnicodeEncodeError: 'ascii' codec can't encode characters in position 94-95: 
ordinal not in range(128)

Expected results:

The package is installed and install-record.txt is created.


Related: https://bugs.python.org/issue9561

--
components: Distutils
files: setup.py
messages: 334687
nosy: dstufft, eric.araujo, scjody
priority: normal
severity: normal
status: open
title: distutils fails with UnicodeEncodeError with strange filename in 
package_data
type: crash
versions: Python 3.6
Added file: https://bugs.python.org/file48095/setup.py

___
Python tracker 

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



[issue35881] test_type_comments leaks references and memory blocks

2019-02-01 Thread STINNER Victor


STINNER Victor  added the comment:

> :(

I'm kidding :-) Sorry for not reviewing emails from buildbot-status.

--

___
Python tracker 

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



[issue35431] Add a function for computing binomial coefficients to the math module

2019-02-01 Thread kellerfuchs


kellerfuchs  added the comment:

> Given that people clarified they prefer comb(), and that people conspicuously 
> didn't comment on it being entirely-opaque to people who do not elready know 
> what it is, I guess there is indeed consensus.

commit afb3d36e82b8d690a410fa9dca8029a8fad42984
Author: The Fox in the Shell 
Date:   Fri Feb 1 15:42:11 2019 +0100

Rename math.combinations to math.comb

--

___
Python tracker 

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



[issue35537] use os.posix_spawn in subprocess

2019-02-01 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 325e4bac5ab49f47ec60242d3242647605193a2e by Victor Stinner in 
branch 'master':
bpo-35537: Fix function name in os.posix_spawnp() errors (GH-11719)
https://github.com/python/cpython/commit/325e4bac5ab49f47ec60242d3242647605193a2e


--

___
Python tracker 

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



[issue35431] Add a function for computing binomial coefficients to the math module

2019-02-01 Thread kellerfuchs


kellerfuchs  added the comment:

@Steven
> > This involved a few changes, which seem to reflect the consensus here:
> > - raise ValueError if k>n ;
> > - rename the function to math.combinations.
> [...]
> > As far as I can tell from the discussions here, Steven and you stated a 
> > preference for the shortened names, and that's it.
> > There was also no reply to my comment about `comb` being confusing (due to 
> > the collision with an English word).
> >
> > Since there was, however, pretty clear agreement on calling it after 
> > combinations (shortened or not) rather than binomial(), I went with this.
>
> I see at least four people (myself, Raymond, Mark and Tim) giving comb 
as first choice, and I didn't see anyone give combinations as their 
first choice.
>
> I don't object to you taking it upon yourself to go with the longer name 
> (which is my second choice), but I do object to you claiming concensus 

I wasn't claiming consensus on the short-vs.-long name issue, but on the 
binomial-vs-combinations one.
I thought that would have been clear considering the context quoted above 
(which was missing from your reply)

Given that people clarified they prefer comb(), and that people conspicuously 
didn't comment on it being entirely-opaque to people who do not elready know 
what it is, I guess there is indeed consensus.

--

___
Python tracker 

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



  1   2   >