[issue12486] tokenize module should have a unicode API

2018-05-18 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

The old generate_tokens() was renamed to tokenize() in issue719888 because the 
latter is a better name. Is "generate_tokens" considered a good name now?

--

___
Python tracker 

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



[issue12486] tokenize module should have a unicode API

2018-05-18 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +barry, mark.dickinson, michael.foord, trent
versions: +Python 3.8 -Python 3.6

___
Python tracker 

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



[issue25478] Consider adding a normalize() method to collections.Counter()

2018-05-18 Thread Mark Dickinson

Mark Dickinson  added the comment:

> total should be a cached property, that's updated on every Counter update

That would run into difficulties for Counters with float values: e.g., after

>>> c = Counter()
>>> c['spam'] = 1e100
>>> c['eggs'] = 1
>>> c['spam'] = 0

the  cached total would likely be 0.0, because that's what the sum of the 
(new-old) values gives:

>>> (1e100 - 0) + (1 - 0) + (0 - 1e100)
0.0

--

___
Python tracker 

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



[issue33522] Enable CI builds on Visual Studio Team Services

2018-05-18 Thread Ammar Askar

Ammar Askar  added the comment:

>core-workflow made a premature decision to turn off Travis and AppVeyor and 
>make VSTS blocking.

It looks like AppVeyor and Travis are still running as of the latest PR: 
https://github.com/python/cpython/pull/6965

Annoyingly, I don't think there's a way to make certain checks like VSTS be 
optional and not show up with a red cross on Github.

--
nosy: +ammar2

___
Python tracker 

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



[issue25478] Consider adding a normalize() method to collections.Counter()

2018-05-18 Thread Vedran Čačić

Vedran Čačić  added the comment:

Well, yes, floats are innacurate. Do you really expect to normalize Counters 
containing values like a googol, or was it just a strawman? For me, it is much 
more imaginable* that total be zero because you have a negative value (e.g. 
{'spam': -1, 'eggs': 1}) than because you had a googol in your Counter at some 
time in the past.

(*) Note that the documentation says

> Counts are allowed to be any integer value including zero or _negative_ 
> counts. (emphasis mine)

... and floats are only mentioned at the bottom, in a Note. Besides, floats 
have that problem already, even with an existing API:

>>> from collections import Counter as C
>>> big = C(spam=1e100)
>>> c = C(spam=1)
>>> not +c
False
>>> c.update(big)
>>> c.subtract(big)
>>> not +c
True

--

___
Python tracker 

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



[issue25478] Consider adding a normalize() method to collections.Counter()

2018-05-18 Thread Mark Dickinson

Mark Dickinson  added the comment:

The point is that if you cache the total and update on each operation, you end 
up with a total that depends not just on the current contents of the Counter, 
but also on the history of operations. That seems like a bad idea: you could 
have two Counters with exactly the same counts in them (so that they compare 
equal), but with different cached totals.

So if floats (or Decimal instances) are permitted as Counter values, your 
suggested caching approach is not viable.

Of course, if Counter values are restricted to be plain old integers then it's 
fine, but that's not the current state of affairs.

--

___
Python tracker 

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



[issue33565] strange tracemalloc results

2018-05-18 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

Victor, could you take a look?

--
nosy: +asvetlov, vstinner

___
Python tracker 

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



[issue12486] tokenize module should have a unicode API

2018-05-18 Thread Thomas Kluyver

Thomas Kluyver  added the comment:

I wouldn't say it's a good name, but I think the advantage of documenting an 
existing name outweighs that. We can start (or continue) using 
generate_tokens() right away, whereas a new name presumably wouldn't be 
available until Python 3.8 comes out. And we usually don't require a new Python 
version until a couple of years after it is released.

If we want to add better names or clearer APIs on top of this, great. But I 
don't want that discussion to hold up the simple step of committing to keep the 
existing API.

--

___
Python tracker 

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



[issue12486] tokenize module should have a unicode API

2018-05-18 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

My concern is that we will have two functions with non-similar names 
(tokenize() and generate_tokens()) that does virtually the same, but accept 
different types of input (bytes or str), and the single function untokenize() 
that produces different type of result depending on the value of input. This 
doesn't look like a good design to me.

--

___
Python tracker 

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



[issue33554] Optimize PyDictObject

2018-05-18 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I'm -1 too. There are no visible benefits, but this change makes maintaining 
harder and adds a risk of introducing bugs and performance regression.

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



[issue33559] Exception's repr change not documented

2018-05-18 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Thank you for your report and PR Miro!

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



[issue33566] re.findall() dead locked whent the expected ending char not occur until end of string

2018-05-18 Thread Min

New submission from Min :

Firstly, I wrote something like this:

patn = r"\bROW\s*\((\d+|\*)\)(.|\s)*?\)"
newlines = re.sub(patn, "\nY\n", newlines)
but if the file(or string) ended without the expected ")" the code deadlock 
there, no progress, no exception, and no exit.

Then I changed it to :
 patn = r"\bROW\s*\((\d+|\*)\)(.|\s)*?(\)|$)"
newlines = re.sub(patn, "\nY\n", newlines) 
to enforce the rule of  end of file. then everything ok.

I felt this is a but, coz RE should not die, it should exit if can't match.

it is Py3.5 on ubuntu. Thanks!

--
messages: 317013
nosy: mamamiaibm
priority: normal
severity: normal
status: open
title: re.findall() dead locked whent the expected ending char not occur until 
end of string
type: behavior
versions: Python 3.5

___
Python tracker 

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



[issue33566] re.findall() dead locked whent the expected ending char not occur until end of string

2018-05-18 Thread Min

Min  added the comment:

Sorry, forgot I have upgraded to 3.6.2, not 3.5

--
versions: +Python 3.6 -Python 3.5

___
Python tracker 

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



[issue25478] Consider adding a normalize() method to collections.Counter()

2018-05-18 Thread Vedran Čačić

Vedran Čačić  added the comment:

My reading of the documentation says floats are only tentatively supported. The 
main text of the documentation says the values are supposed to be integers. 
Even the note mostly talks about negative values, the floats are mentioned in 
only one item. (And in that item, it says the value type should support 
addition and subtraction. I think it's not too big a stretch to stipulate it 
should support them accurately.:)

But whatever you do about total (cached property was just my idea to enable 
implementation of a probability distribution as a view on a Counter), it's 
obvious from the documentation that the output of normalize is _not_ a Counter. 
It might be a subclass, but I'd rather it be a completely separate class. The 
API intersection is not really that fat.

--

___
Python tracker 

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



[issue33566] re.findall() dead locked whent the expected ending char not occur until end of string

2018-05-18 Thread Min

Min  added the comment:

Sorry again, the sample code offered is issue of re.sub(), not findall() :o)))

--

___
Python tracker 

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



[issue12486] tokenize module should have a unicode API

2018-05-18 Thread Thomas Kluyver

Thomas Kluyver  added the comment:

I agree, it's not a good design, but it's what's already there; I just want to 
ensure that it won't be removed without a deprecation cycle. My PR makes no 
changes to behaviour, only to documentation and tests.

This and issue 9969 have both been around for several years. A new tokenize API 
is clearly not at the top of anyone's priority list - and that's fine. I'd 
rather have *some* unicode API today than a promise of a nice unicode API in 
the future. And it doesn't preclude adding a better API later, it just means 
that the existing API would have to have a deprecation cycle.

--

___
Python tracker 

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



[issue33522] Enable CI builds on Visual Studio Team Services

2018-05-18 Thread Stéphane Wirtel

Stéphane Wirtel  added the comment:

Hi Steve

I just saw VSTS in action, it's a great job, thank you.

Compared to Travis-CI:

* is there more computers for the tests on VSTS?

* with time, what will be the reference if there is a 'green' build? TravisCI 
or VSTS?

Thank you again for the job.

--
nosy: +matrixise

___
Python tracker 

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



[issue12486] tokenize module should have a unicode API

2018-05-18 Thread Martin Panter

Martin Panter  added the comment:

Don’t forget about updating __all__.

--

___
Python tracker 

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



[issue12486] tokenize module should have a unicode API

2018-05-18 Thread Thomas Kluyver

Thomas Kluyver  added the comment:

Thanks - I had forgotten it, just fixed it now.

--

___
Python tracker 

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



[issue33567] Explicitly mention bytes and other buffers in the documentation for float()

2018-05-18 Thread Martijn Pieters

New submission from Martijn Pieters :

float(bytesobject) treats the contents of the bytesobject as a sequence of 
ASCII characters, and converts those to a float value as if you used 
float(bytesobject.decode('ASCII')). The same support is extended to other 
objects implementing the buffer protocol.

The documentation, however, doesn't mention this:

> Return a floating point number constructed from a number or string x.

Everywhere else in the functions documentation, "string" refers to an object of 
type `str`. Please make it explicit that `bytes` is also acceptedable, like it 
does for the int() documentation.

--
messages: 317022
nosy: mjpieters
priority: normal
severity: normal
status: open
title: Explicitly mention bytes and other buffers in the documentation for 
float()

___
Python tracker 

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



[issue33565] strange tracemalloc results

2018-05-18 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Can you post a reproducer that doesn't involve S3?

--
nosy: +pitrou

___
Python tracker 

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



[issue33567] Explicitly mention bytes and other buffers in the documentation for float()

2018-05-18 Thread Joël Schaerer

Change by Joël Schaerer :


--
nosy: +joelthelion

___
Python tracker 

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



[issue33524] non-ascii characters in headers causes TypeError on email.policy.Policy.fold

2018-05-18 Thread Licht Takeuchi

Change by Licht Takeuchi :


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

___
Python tracker 

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



[issue32463] problems with shutil.py and os.get_terminal_size

2018-05-18 Thread Berker Peksag

Berker Peksag  added the comment:

Thanks for the report. I agree with Eryk. os.get_terminal_size() is a low-level 
function. shutil.get_terminal_size() should be used as documented at 
https://docs.python.org/3/library/os.html#os.get_terminal_size

shutil.get_terminal_size() is the high-level function which should
normally be used, os.get_terminal_size is the low-level
implementation.

--
nosy: +berker.peksag
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue33568] Inconsistent behavior of non-ascii handling in EmailPolicy.fold

2018-05-18 Thread Licht Takeuchi

New submission from Licht Takeuchi :

policy.utf8 is False, but non-ascii are not well-handled.
Repro. code.

```
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 18:10:19) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from email.message import EmailMessage
>>> from email.policy import default
>>> 
>>> policy = default.clone()
>>> policy.utf8
False
>>> msg = EmailMessage()
>>> msg["Subject"] = "á"
>>> policy.fold("Subject", msg["Subject"])
'Subject: =?utf-8?q?=C3=A1?=\n'
>>> policy.fold("Subject", 'á')
'Subject: á\n'
```

--
components: Library (Lib)
messages: 317025
nosy: licht-t
priority: normal
severity: normal
status: open
title: Inconsistent behavior of non-ascii handling in EmailPolicy.fold
versions: 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



[issue33568] Inconsistent behavior of non-ascii handling in EmailPolicy.fold

2018-05-18 Thread Licht Takeuchi

Change by Licht Takeuchi :


--
type:  -> behavior

___
Python tracker 

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



[issue33569] dataclasses InitVar does not maintain any type info

2018-05-18 Thread reinhrst

New submission from reinhrst :

Right now dataclasses.InitVar[something] is dataclasses.InitVar. This means 
that any type-information is removed, and it will (for instance) be impossible 
to do (runtime) type info checks on the generated __init__, or find out 
anything about the type of the variable.

--
messages: 317026
nosy: reinhrst
priority: normal
severity: normal
status: open
title: dataclasses InitVar does not maintain any type info
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



[issue33376] [pysqlite] Duplicate rows can be returned after rolling back a transaction

2018-05-18 Thread Aviv Palivoda

Change by Aviv Palivoda :


--
nosy: +palaviv

___
Python tracker 

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



[issue33570] OpenSSL 1.1.1 / TLS 1.3 cipher suite changes

2018-05-18 Thread Christian Heimes

New submission from Christian Heimes :

The definition and configuration of TLS 1.3 cipher suites has changed during 
the development phase of OpenSSL 1.1.1. The cipher suites are no longer 
prefixed with "TLS13-". TLS 1.3 are always enabled and can no longer be 
disabled with SSLContext.set_ciphers() / SSL_CTX_set_cipher_list(). Instead the 
suites are now configured with SSL_CTX_set_ciphersuites(). See 
https://github.com/openssl/openssl/pull/5392

For now I'm not going to expose the new API. Instead I'll update the 
documentation and tests for 2.7 to 3.8 with new names. I'll also mention that 
TLS 1.3 suites will be always available with OpenSSL 1.1.1.

--
assignee: christian.heimes
components: SSL
messages: 317027
nosy: alex, benjamin.peterson, christian.heimes, dstufft, janssen, ned.deily
priority: high
severity: normal
stage: test needed
status: open
title: OpenSSL 1.1.1 / TLS 1.3 cipher suite changes
type: behavior
versions: Python 2.7, 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



[issue30437] SSL_shutdown needs SSL_read() until SSL_ERROR_ZERO_RETURN

2018-05-18 Thread Christian Heimes

Christian Heimes  added the comment:

The issue can occur when the peer sends data while processing the close notify 
alert.

The meaningless SSL_ERROR_SYSCALL in SSL_shutdown() is even more severe with 
OpenSSL 1.1.1 and TLS 1.3. In case the client only writes and never reads, 
SSL_shutdown fails to unwrap the socket. The issue is caused by the fact that 
the session ticket is transferred after the handshake. With a SSL_read(), the 
ticket is stuck on the wire and may not be consumed until OpenSSL waits for 
close notify TLS alert.

In https://github.com/openssl/openssl/issues/6262#issuecomment-389987860 Kurt 
wrote:

> The peer is still allowed to send data after receiving the "close notify" 
> event. If the peer did send data it need to be processed by calling 
> SSL_read() before calling SSL_shutdown() a second time. SSL_read() will 
> indicate the end of the peer data by returning <= 0 and SSL_get_error() 
> returning SSL_ERROR_ZERO_RETURN. It is recommended to call SSL_read() between 
> SSL_shutdown() calls.

I hacked SSL_read() into the code and the problem did no longer occur for me. 
My workaround is not a proper solution, though. The shutdown code is slightly 
complicated (to say the least).

--
priority: normal -> deferred blocker
title: SSL_shutdown can return meaningless SSL_ERROR_SYSCALL -> SSL_shutdown 
needs SSL_read() until SSL_ERROR_ZERO_RETURN
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



[issue32519] venv API docs - symlinks default incorrect

2018-05-18 Thread Berker Peksag

Change by Berker Peksag :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue33571] Add triple quotes to list of delimiters that trigger '...' prompt

2018-05-18 Thread Andrés Delfino

Change by Andrés Delfino :


--
assignee: docs@python
components: Documentation
nosy: adelfino, docs@python
priority: normal
severity: normal
status: open
title: Add triple quotes to list of delimiters that trigger '...' prompt
type: enhancement
versions: Python 2.7, 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



[issue33571] Add triple quotes to list of delimiters that trigger '...' prompt

2018-05-18 Thread Andrés Delfino

Change by Andrés Delfino :


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

___
Python tracker 

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



[issue33522] Enable CI builds on Visual Studio Team Services

2018-05-18 Thread Steve Dower

Steve Dower  added the comment:

> * is there more computers for the tests on VSTS?

I don't know what Travis is giving us, but Microsoft has provided 20 concurrent 
builds. They also seem to be more powerful machines, though some caching 
features are missing and many builds seem to take about the same time.

> * with time, what will be the reference if there is a 'green' build? TravisCI 
> or VSTS?

This is a question for the core-workflow list. I'm deliberately staying out of 
this part of the discussion.

--

___
Python tracker 

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



[issue33522] Enable CI builds on Visual Studio Team Services

2018-05-18 Thread Steve Dower

Steve Dower  added the comment:

> I don't think there's a way to make certain checks like VSTS be optional and 
> not show up with a red cross on Github

Most of the failures I've seen have been reproducible, so I suspect they're due 
to race conditions that rarely occurred on Travis. Unfortunately, we are no 
longer watching the build bots as closely as we used to, so many 
platform-specific or configuration-specific failures are missed :(

--

___
Python tracker 

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



[issue33507] Improving the html rendered by cgitb.html

2018-05-18 Thread Stéphane Blondon

Stéphane Blondon  added the comment:

> Instead of hardcoding colors, would it be better to use CSS instead.

I agree with you. The current source code contains hardcoded colors. I
could add an optional parameter to change the css for the cgitb.html()
function:

def html(einfo, context=5, css=_DEFAULT_CSS):
   ...

_DEFAULT_CSS would be a string with the equivalent of the hardcoded style.

For this change, I will modify the html code to replace some
deprecated tags (like big or font) by supported tags.

What do you think about it (new optional parameter and html update)?

--

___
Python tracker 

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



[issue33257] Race conditions in Tkinter with non-threaded Tcl

2018-05-18 Thread Ivan Pozdeev

Change by Ivan Pozdeev :


--
pull_requests: +6627

___
Python tracker 

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



[issue33572] False/True as dictionary keys treated as integers

2018-05-18 Thread Janusz Harkot

New submission from Janusz Harkot :

using boolean (True/False) as dictionary keys, coerce them to integers - is 
this behavior documented somewhere?

I know that asking to fix this is not easy fix, but shouldn't this be 
highlighted everywhere with red flags and warnings, so people will know that 
this is expected?


Python 3.6.5 (default, Mar 29 2018, 03:28:50)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> dta = {False: 'false', True: 'true', 0: 'zero', 1: 'one'}
>>> print(dta[False])
zero
>>>

--
components: Interpreter Core
messages: 317032
nosy: Janusz Harkot
priority: normal
severity: normal
status: open
title: False/True as dictionary keys treated as integers
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



[issue33572] False/True as dictionary keys treated as integers

2018-05-18 Thread Janusz Harkot

Janusz Harkot  added the comment:

Python 3.6.5 (default, Mar 29 2018, 03:28:50)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> dta = {False: 'false', True: 'true', 0: 'zero', 1: 'one'}
>>> print(dta[False])
zero
>>> dta
{False: 'zero', True: 'one'}
>>>

--

___
Python tracker 

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



[issue33522] Enable CI builds on Visual Studio Team Services

2018-05-18 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

I've emailed support@github on this one.  Their UI is horrible, "show all 
checks" does not show them all.  It shows five at most.

It is an invisible scrolling region.  We're forced to manually mouse over and 
scroll down in that region in order to confirm that the trustworthy checks have 
run.

--

___
Python tracker 

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



[issue33522] Enable CI builds on Visual Studio Team Services

2018-05-18 Thread Gregory P. Smith

Change by Gregory P. Smith :


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

___
Python tracker 

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



[issue33572] False/True as dictionary keys treated as integers

2018-05-18 Thread Mark Dickinson

Mark Dickinson  added the comment:

It's documented here: 
https://docs.python.org/3/library/stdtypes.html#mapping-types-dict

> Numeric types used for keys obey the normal rules for numeric
> comparison: if two numbers compare equal (such as 1 and 1.0) then 
> they can be used interchangeably to index the same dictionary entry.

Since False == 0, False and 0 are interchangeable as dictionary keys. Similarly 
for True and 1. Note that the dictionary you created only actually has two 
entries:

>>> dta = {False: 'false', True: 'true', 0: 'zero', 1: 'one'}
>>> dta
{False: 'zero', True: 'one'}

Though calling out numeric types in particular in the docs does feel a little 
odd to me: the rule is that *any* two hashable objects that compare equal 
should be interchangeable for the purposes of dictionary lookup (or set 
membership, come to that). There's nothing particularly special about numbers 
in this context.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue33477] Document that compile(code, 'exec') has different behavior in 3.7+

2018-05-18 Thread INADA Naoki

INADA Naoki  added the comment:

Any comments?
Would you close this issue?

--

___
Python tracker 

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



[issue33477] Document that compile(code, 'exec') has different behavior in 3.7+

2018-05-18 Thread Matthias Bussonnier

Matthias Bussonnier  added the comment:

Fair enough that what's new include things about Module


> The first statement in their body is not considered as a docstring anymore.

Note that this sentence read backward to me. I understand what is meant because 
I know the new behavior. It might be good to clarify. potentially:

> The first statement in the `body` attribute of should not be considered the 
> docstring of the module anymore, the `docstring` attribute  is reserved for 
> that.


Though the documentation of `compile()` does not say that `compile(...,'exec')` 
compile a module. It says:

> The mode argument specifies what kind of code must be compiled;
> it can be 'exec' if source consists of a sequence of statements

Which now is incorrect. I was expecting `compile(..., 'exec')` to return a 
Module with `None` or empty string as the docstring attribute – which is also a 
perfectly reasonable request.

I think that `compile`  documentation should be changed to reflect what it 
does. 


Or (but I see why this is un-reasonable) split add the `mode='module'` that has 
new behavior, while `exec` does not.

--

___
Python tracker 

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



[issue19251] bitwise ops for bytes of equal length

2018-05-18 Thread Stefan Behnel

Stefan Behnel  added the comment:

I'd second the proposal of considering the "array.array" type for this, instead 
of the bytes/bytearray types. Why? Because it is somewhat of a niche case after 
all, and the bytes type seems too exposed for it. Also, array.array supports 
more diverse base item types than just plain bytes, which could potentially 
cover more use cases or at least simplify certain data processing needs.

Alternatively, implement a lightweight SIMD-like memoryview type that operates 
on arbitrary buffers (which covers bytes, bytearray and array.array). But 
that's either NumPy then, or something new that would best spend its early days 
on PyPI.

--
nosy: +scoder

___
Python tracker 

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



[issue33471] string format with 'n' failling with french locales

2018-05-18 Thread Terry J. Reedy

Change by Terry J. Reedy :


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



[issue33492] Updating the Evaluation order section to cover *expression in calls

2018-05-18 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
versions:  -Python 3.5

___
Python tracker 

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



[issue19251] bitwise ops for bytes of equal length

2018-05-18 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Please, let's have this API discussion outside of the bug tracker.  This 
deserves a PEP.  Also because I have an alternative API to suggest :-)

--

___
Python tracker 

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



[issue32282] When using a Windows XP compatible toolset, `socketmodule.c` fails to build

2018-05-18 Thread Berker Peksag

Berker Peksag  added the comment:


New changeset 09eb6fe8fdd2515546b933902aef36b72d417ace by Berker Peksag (Miss 
Islington (bot)) in branch '3.6':
bpo-32282: Remove unnecessary check for `VersionHelpers.h` in `socketmodule.c` 
on Windows (GH-5120)
https://github.com/python/cpython/commit/09eb6fe8fdd2515546b933902aef36b72d417ace


--
nosy: +berker.peksag

___
Python tracker 

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



[issue32282] When using a Windows XP compatible toolset, `socketmodule.c` fails to build

2018-05-18 Thread Berker Peksag

Berker Peksag  added the comment:

It looks like we need to backport this manually for 3.5 (if Larry approves)

--
stage: patch review -> backport needed
versions:  -Python 3.6, Python 3.7

___
Python tracker 

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



[issue33477] Document that compile(code, 'exec') has different behavior in 3.7+

2018-05-18 Thread Matthias Bussonnier

Change by Matthias Bussonnier :


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

___
Python tracker 

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



[issue33566] re.findall() dead locked whent the expected ending char not occur until end of string

2018-05-18 Thread Matthew Barnett

Matthew Barnett  added the comment:

You don't give the value of 'newlines', but the problem is probably 
catastrophic backtracking, not deadlock.

--
nosy: +mrabarnett

___
Python tracker 

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



[issue33566] re.findall() dead locked whent the expected ending char not occur until end of string

2018-05-18 Thread Tim Peters

Tim Peters  added the comment:

Min, you need to give a complete example other people can actually run for 
themselves.

Offhand, this part of the regexp

(.|\s)*

all by itself _can_ cause exponential-time behavior. You can run this for 
yourself:

>>> import re
>>> p = r"(.|\s)*K"
>>> re.search(p, " " * 10) # fast
>>> re.search(p, " " * 15) # fast
>>> re.search(p, " " * 20) # obviously takes a bit of time
>>> re.search(p, " " * 21) # very obviously takes time
>>> re.search(p, " " * 22) # over a second
>>> re.search(p, " " * 25) # about 10 seconds

Etc.

--
nosy: +tim.peters

___
Python tracker 

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



[issue33500] Python TKinter for Mac on latest 2.7.15 still extremely slow vs Windows

2018-05-18 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Responses to the following might help anyone who works on this.

1. Is the relative performance only an issue on 2.7 and not 3.6+?

2. What are the 'recent issues here'?  What is different about your example 
code.

3. We prefer plain text .py files that can be viewed in a browser or downloaded 
and run.

4. We prefer minimal failing examples.  (Here, 'failing' means 'slow'.)  What 
particular tkinter functions run comparitively slow?

--
components: +macOS
nosy: +ned.deily, ronaldoussoren, serhiy.storchaka, terry.reedy

___
Python tracker 

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



[issue33516] unittest.mock: Add __round__ to supported magicmock methods

2018-05-18 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
nosy: +michael.foord
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



[issue33527] Invalid child function scope

2018-05-18 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
stage:  -> test needed
versions:  -Python 3.4, Python 3.5

___
Python tracker 

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



[issue33572] False/True as dictionary keys treated as integers

2018-05-18 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Mark, are you suggesting a doc addition (and a change of Components) or should 
we close this as 'not a bug'?

--
nosy: +terry.reedy

___
Python tracker 

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



[issue33572] False/True as dictionary keys treated as integers

2018-05-18 Thread Tim Peters

Tim Peters  added the comment:

I expect these docs date back to when ints, longs, and floats were the only 
hashable language-supplied types for which mixed-type comparison could ever 
return True.

They could stand some updates ;-)  `fractions.Fraction` and `decimal.Decimal` 
are more language-supplied numeric types that participate now, and the Boolean 
singletons are instances of (a subclass of) `int`.  I think it would be good to 
point that out, especially the latter (in many other languages Booleans can't 
be compared to ints).

So +1 both to Mark's more-general explanation, and to explicitly naming more 
specific cases for illustration.

--
nosy: +tim.peters

___
Python tracker 

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



[issue33556] leftover thread crumb in threading.ident docstring

2018-05-18 Thread Zachary Ware

Zachary Ware  added the comment:


New changeset 5634331a76dfe9fbe4b76475e11307a0922d6a15 by Zachary Ware (Skip 
Montanaro) in branch 'master':
bpo-33556: Remove reference to thread module from docstring (GH-6963)
https://github.com/python/cpython/commit/5634331a76dfe9fbe4b76475e11307a0922d6a15


--

___
Python tracker 

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



[issue33556] leftover thread crumb in threading.ident docstring

2018-05-18 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6629

___
Python tracker 

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



[issue33556] leftover thread crumb in threading.ident docstring

2018-05-18 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6630

___
Python tracker 

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



[issue33572] False/True as dictionary keys treated as integers

2018-05-18 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
assignee:  -> docs@python
components: +Documentation -Interpreter Core
nosy: +docs@python

___
Python tracker 

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



[issue33573] statistics.median does not work with ordinal scale

2018-05-18 Thread W deW

New submission from W deW :

The 0.5-quantile or median is defined for ordinal, interval, and ratio scales. 
An Enumerator as derived from Enum and extended with rich comparison methods 
implements an ordinal scale. Therefore calculating the median over a list of 
such enum-elements ought to be possible.

The current implementation tries to interpolate the median value by averaging 
the two middle observations. This is allowed for interval and ratio scales, but 
since this interpolation involves an addition, not so for ordinal scales. 
Although computationally it is possible to do this for numeric ordinal 
variables, logically it is non-sense for the distance between ordinal values is 
- by definition - unknown. On non-numeric ordinal values it is even 
computationally impossible.

The correct return value would be: the first value in an ordered set where al 
least half the number of observations is smaller or equal than it. This is 
observation[len(observation)//2] for odd and even length ordered lists of 
values.

Whether the same applies to interval and ratio scales is a matter of opinion. 
The currently implemented algorith definitely is more popular these days.

--
components: Library (Lib)
files: testMedian.py
messages: 317048
nosy: W deW
priority: normal
severity: normal
status: open
title: statistics.median does not work with ordinal scale
type: crash
versions: Python 3.4
Added file: https://bugs.python.org/file47601/testMedian.py

___
Python tracker 

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



[issue33574] Conversion of Number to String(str(number))

2018-05-18 Thread Khalid Moh'd.

New submission from Khalid Moh'd. :

Consider conversion of an integer to string:
a=5 #number
str #outputs 
str(a) #works perfectly and prints '5'

Now, consider:
str="Hello World" #reads the string
str #prints "Hello World"
str(5) #gives an error


Interpreter considers variable str before parenthesis not str from 
There must be a way to distinguish user defined variable str and conversion 
operation str().

--
messages: 317049
nosy: Khalid Moh'd.
priority: normal
severity: normal
status: open
title: Conversion of Number to String(str(number))
type: compile error
versions: Python 3.6

___
Python tracker 

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



[issue33547] Relative imports do not replace local variables

2018-05-18 Thread Rolf Campbell

Rolf Campbell  added the comment:

Re-opening because I've found a simple example that does not involve __main__.

./func/__init__.py:func = 1
./func/__init__.py:from . import func
./func/__init__.py:print(f"Namespace value of func after func module 
import:{func}")
./func/func.py:print("Module imported")
./main.py:import func
./main.py:def func(x):
./main.py:  return x

If you create files that look like that, and then run: "python3.6 main.py" I 
get this output:
Namespace value of func after func module import:1

If I comment out the "func = 1" line, then func ends up being imported (and 
printing as a ).

--
status: closed -> open

___
Python tracker 

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



[issue33547] Relative imports do not replace local variables

2018-05-18 Thread Rolf Campbell

Change by Rolf Campbell :


--
resolution: not a bug -> 

___
Python tracker 

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



[issue33556] leftover thread crumb in threading.ident docstring

2018-05-18 Thread miss-islington

miss-islington  added the comment:


New changeset c6a5cc8f244ee71ce932003366411aacadda8dd0 by Miss Islington (bot) 
in branch '3.6':
bpo-33556: Remove reference to thread module from docstring (GH-6963)
https://github.com/python/cpython/commit/c6a5cc8f244ee71ce932003366411aacadda8dd0


--
nosy: +miss-islington

___
Python tracker 

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



[issue33565] strange tracemalloc results

2018-05-18 Thread Alexander Mohr

Alexander Mohr  added the comment:

here's a version that tries to do something similar but does not reproduce the 
issue

--
Added file: https://bugs.python.org/file47602/tracemalloc_test2.py

___
Python tracker 

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



[issue33572] Better document mixed-type comparison of set items, dict keys

2018-05-18 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

With Tim's addition

>>> from fractions import Fraction as F
>>> from decimal import Decimal as D
>>> s = {0, 1, 0.0, 1.0, F(0,1), F(1, 1), D(0), D(1), False, True}
>>> s
{0, 1}

I think we should consider moving the main discussion of the general comparison 
and hashing principle and example to the set entry.  (Sets ars simpler and are 
when people new to Python already know about.) Point out that for displays, the 
first of equals is kept and not replaced (this is also true of dicts).  Then, 
in the dict entry, say that dict keys are treated like set items, give an 
equivalent dict example, and link to the discussion of set items.

>>> x = None
>>> d = {0:x, 1:x, 0.0:x, 1.0:x, F(0,1):x, F(1, 1):x, D(0):x, D(1):x, False:x, 
>>> True:x}
>>> d
{0: None, 1: None}
>>>

--
title: False/True as dictionary keys treated as integers -> Better document 
mixed-type comparison of set items, dict keys

___
Python tracker 

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



[issue33556] leftover thread crumb in threading.ident docstring

2018-05-18 Thread Zachary Ware

Zachary Ware  added the comment:


New changeset abde17e663edd6437cc7eb0405fe418449a25d72 by Zachary Ware (Miss 
Islington (bot)) in branch '3.7':
bpo-33556: Remove reference to thread module from docstring (GH-6963)
https://github.com/python/cpython/commit/abde17e663edd6437cc7eb0405fe418449a25d72


--

___
Python tracker 

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



[issue33556] leftover thread crumb in threading.ident docstring

2018-05-18 Thread Zachary Ware

Zachary Ware  added the comment:

Done, thanks Skip :)

Can we convince you to reclaim your commit bits so you can click the buttons 
yourself next time? ;)

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



[issue33570] OpenSSL 1.1.1 / TLS 1.3 cipher suite changes

2018-05-18 Thread Christian Heimes

Change by Christian Heimes :


--
keywords: +patch
pull_requests: +6631
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



[issue33447] Asynchronous lambda syntax

2018-05-18 Thread Yury Selivanov

Yury Selivanov  added the comment:

The syntax for async lambdas doesn't look nice and I, personally, don't see 
that many use cases for them to justify adding new syntax.  And this would need 
a new PEP. 

I suggest to start a discussion on the Python-ideas mailing list if this is 
something you want to see in Python.

--
components: +Interpreter Core -asyncio
resolution:  -> postponed
stage:  -> resolved
status: open -> closed
versions: +Python 3.8 -Python 3.7

___
Python tracker 

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



[issue33574] Conversion of Number to String(str(number))

2018-05-18 Thread Eric V. Smith

Eric V. Smith  added the comment:

The way to avoid this problem is to not assign to str. You should not shadow 
python builtins that you want to continue using.

--
nosy: +eric.smith
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type: compile error -> crash

___
Python tracker 

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



[issue33522] Enable CI builds on Visual Studio Team Services

2018-05-18 Thread Steve Dower

Steve Dower  added the comment:

GitHub has broken CSS everywhere right now :) Their oauth page doesn't show 
scroll bars either, which means you can't get to the "authorise" button if 
you're in more than a couple of organisations.

--

___
Python tracker 

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



[issue30437] SSL_shutdown needs SSL_read() until SSL_ERROR_ZERO_RETURN

2018-05-18 Thread Christian Heimes

Change by Christian Heimes :


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

___
Python tracker 

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



[issue22848] Subparser help does not respect SUPPRESS argument

2018-05-18 Thread Andrew Gaul

Change by Andrew Gaul :


--
nosy: +gaul

___
Python tracker 

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



[issue33540] socketserver: Add an opt-in option to get Python 3.6 behaviour on server_close()

2018-05-18 Thread Ned Deily

Ned Deily  added the comment:

It would be great if someone(s) could give PR 6911 a review, since it is a 
release blocker for 3.7.0rc1.  Thanks!

--

___
Python tracker 

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



[issue33547] Relative imports do not replace local variables

2018-05-18 Thread R. David Murray

R. David Murray  added the comment:

It's the same answer.  __init__ *is* the package namespace, so you are setting 
the value of 'func' in the package (.) namespace, and what import is doing is 
correct.

I know this is confusing.  I banged my head against it while debugging a weird 
import problem in the anydb module, but it is working as designed.  I think the 
way __init__ works may fall under rule 14 of the Zen :)

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

___
Python tracker 

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



[issue33447] Asynchronous lambda syntax

2018-05-18 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

The only thing special about functions defined with lambda expressions rather 
than def statements is the generic name attribute '' instead of a 
specific name.  PEP8 intentionally and properly discourages 'name = lambda ...' 
as inferior to 'def name(...'.

For your example, 

async def foo(a, b): return 5 + await bar(b)

For inline function expressions, as in function calls, the obvious proposals 
would be to reuse 'async' in f(async lambda a, b: ...) or a new keyword, such 
as 'alambda' or 'asynclambda' or ... . Either would need multiple use cases to 
justify not just using async def first.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue33547] Relative imports do not replace local variables

2018-05-18 Thread Rolf Campbell

Rolf Campbell  added the comment:

OK, OK, I think I finally understand what you mean here.  Let me try to repeat 
it just to make sure I really understand:

When requesting a member of a multi-file module (like "func" in my example), 
python only tries to load that member as a module from disk if there isn't 
something already created as part of __init__.py.

In my case, I'm trying to load "func.func" which I specifically created in 
line#1 of func/__init__.py, so Python sees no need to even try to load the 
func/func.py file.

If I comment-out the first line of func/__init__.py, then Python fails to find 
an item called "func.func" and so it tries to load one from disk which causes 
it to load "func/func.py".

My real problem here was that I shouldn't be creating entries in the "func" 
namespace that clash with on-disk sub-modules that I want loaded.

Thanks for your time and effort in explaining this.

--

___
Python tracker 

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



[issue33547] Relative imports do not replace local variables

2018-05-18 Thread R. David Murray

R. David Murray  added the comment:

Yes, you are substantially correct.  A subtlety that may enhance your 
understanding (if it doesn't instead totally confuse you :) is that __init__ is 
simply the most straightforward way to affect the module namespace.  You would 
see the same phenomenon if in your package func had a submodule bar that did:

   import func
   func.func = 1
   from . import func

func would now be 1, because it already exists in the module namespace at the 
point the relative import is done, so import just returns it, it doesn't go 
looking for a module to import.

--

___
Python tracker 

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



[issue32996] Improve What's New in 3.7

2018-05-18 Thread Elvis Pranskevichus

Change by Elvis Pranskevichus :


--
pull_requests: +6633

___
Python tracker 

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



[issue28556] typing.py upgrades

2018-05-18 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:


New changeset f65e31fee3b55dfb6ed5398179d5c5d6b502dee5 by Ivan Levkivskyi in 
branch 'master':
bpo-28556: Don't simplify unions at runtime (GH-6841)
https://github.com/python/cpython/commit/f65e31fee3b55dfb6ed5398179d5c5d6b502dee5


--

___
Python tracker 

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



[issue28556] typing.py upgrades

2018-05-18 Thread miss-islington

Change by miss-islington :


--
pull_requests: +6634

___
Python tracker 

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



[issue33521] Add 1.32x faster C implementation of asyncio.isfuture().

2018-05-18 Thread STINNER Victor

STINNER Victor  added the comment:

About the benchmark: you should not loop inside the function. I propose a 
variant of the benchmark: isfuture_benchmark2.py.

Jimmy: Would you mind to run this variant on your PR?

--
Added file: https://bugs.python.org/file47603/isfuture_benchmark2.py

___
Python tracker 

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



[issue28556] typing.py upgrades

2018-05-18 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:


New changeset 09ca5906b7d1619b7efed0bebb6f3c424fe3d83b by Ivan Levkivskyi (Miss 
Islington (bot)) in branch '3.7':
bpo-28556: Don't simplify unions at runtime (GH-6841) (GH-6979)
https://github.com/python/cpython/commit/09ca5906b7d1619b7efed0bebb6f3c424fe3d83b


--

___
Python tracker 

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



[issue16055] incorrect error text for int(base=1000, x='1')

2018-05-18 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +6635

___
Python tracker 

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



[issue30273] The coverage job is broken: distutils build_ext fails on None

2018-05-18 Thread STINNER Victor

STINNER Victor  added the comment:

https://github.com/python/cpython/pull/1515 has the "needs backport to 2.7" 
label, but I'm unable to reproduce the bug on Python 2.7:

* Python 2.7 has no "venv" module
* When I compile Python out of tree, and then use "virtualenv -p ./python 
VENV", I got the following error from virtualenv.py:

AssertionError: Filename /home/vstinner/prog/python/2.7/Lib/os.py does not 
start with any of these prefixes: ['/usr/local']

So I removed the "needs backport to 2.7" label from the PR. I'm sorry, I don't 
know if Python 2.7 is affected or not. In case of doubt, I prefer to not 
backport the change.

--

___
Python tracker 

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



[issue33518] Add PEP to glossary

2018-05-18 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset a3a554a536599189166843cd80e62d02b2b68aa8 by Victor Stinner 
(Andrés Delfino) in branch '3.7':
[3.7] bpo-33518: Add PEP entry to documentation glossary (GH-6860) (#6934)
https://github.com/python/cpython/commit/a3a554a536599189166843cd80e62d02b2b68aa8


--

___
Python tracker 

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



[issue33518] Add PEP to glossary

2018-05-18 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset fb5d0aa116125dfb29a3c4d8819a38dfb2760bb9 by Victor Stinner 
(Andrés Delfino) in branch '3.6':
[3.6] bpo-33518: Add PEP entry to documentation glossary (GH-6860) (#6935)
https://github.com/python/cpython/commit/fb5d0aa116125dfb29a3c4d8819a38dfb2760bb9


--

___
Python tracker 

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



[issue33358] [EASY] x86 Ubuntu Shared 3.x: test_embed.test_pre_initialization_sys_options() fails

2018-05-18 Thread STINNER Victor

STINNER Victor  added the comment:

Thank you for the fix Pablo!

--

___
Python tracker 

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



[issue20104] expose posix_spawn(p)

2018-05-18 Thread STINNER Victor

STINNER Victor  added the comment:

posix_spawn can still be found in Python 3.7:

configure:11243: posix_fallocate posix_fadvise posix_spawn pread preadv preadv2 
\
configure.ac:3470: posix_fallocate posix_fadvise posix_spawn pread preadv 
preadv2 \
pyconfig.h.in:710:/* Define to 1 if you have the `posix_spawn' function. */

This check has been added by the commit 
6c6ddf97c402709713d668d0ed53836a7749ba99 and should be removed from Python 3.7 
as well, no? It's not a release blocker, but it may be good to remove 
posix_spawn from configure.ac (and related generated files).

--

___
Python tracker 

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



[issue16055] incorrect error text for int(base=1000, x='1')

2018-05-18 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset d13169fc5ac7572a272cbcff830c3d96ba27cc7c by Victor Stinner in 
branch '2.7':
bpo-16055: Fixes incorrect error text for int('1', base=1000) (#6980)
https://github.com/python/cpython/commit/d13169fc5ac7572a272cbcff830c3d96ba27cc7c


--

___
Python tracker 

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



[issue16055] incorrect error text for int(base=1000, x='1')

2018-05-18 Thread STINNER Victor

STINNER Victor  added the comment:

I backported manually the fix to Python 2.7 for int and long types.

Thank you Chris Jerdonek for the bug report, and Sanyam Khurana for the bugfix!

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



[issue33575] Python relies on C undefined behavior float-cast-overflow

2018-05-18 Thread Gregory P. Smith

New submission from Gregory P. Smith :

Clang's undefined behavior sanitizer is flagging several places in CPython 
where it is relying on float-cast-overflow behavior.  Typically exposed where 
an out of bounds floating point value is cast to another type.

The clang compiler is about to start applying optimizations that alters the 
previous version of the undefined behavior on some platforms.  We need to make 
CPython clean for float-cast-overflow errors.

examples:
 _PyTime_DoubleToDenominator 
https://github.com/python/cpython/blob/master/Python/pytime.c#L159
 _PyTime_FromFloatObject - 
https://github.com/python/cpython/blob/master/Python/pytime.c#L389
 getargs double cast to a float - 
https://github.com/python/cpython/blob/master/Python/getargs.c#L864
 _PyFloat_Pack4 double cast to a float - 
https://github.com/python/cpython/blob/master/Objects/floatobject.c#L2234

These are found by running a ubsan build with this checker enabled on 
test_datetime, test_getargs2, test_struct, and test_thread.

There are probably others, but our own test suite happens to trigger these.

In many cases we should use correct conversion code instead of the cast that 
does what we want when the value is out of bounds and without a defined 
conversion.  In others we might want an OverflowError or ValueError.  But 
preserving the existing compilers up until now behavior makes more sense from a 
code compatibility standpoint (ie: it is not expecting an OverflowError when we 
make a CPython API that takes a float as input but behind the scenes uses a C 
API that operates on an int64 - that is an implementation detail no user should 
care about).

--
components: Extension Modules, Interpreter Core
messages: 317074
nosy: gregory.p.smith
priority: normal
severity: normal
stage: needs patch
status: open
title: Python relies on C undefined behavior float-cast-overflow
type: behavior
versions: Python 2.7, 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



[issue32534] Speed-up list.insert: use memmove()

2018-05-18 Thread STINNER Victor

STINNER Victor  added the comment:

This issue is a micro-optimization which is only 1.08x faster:
https://bugs.python.org/issue32534#msg310146

Moreover, it seems really hard to measure precisely the benefit on benchmarks. 
Results seem to not be reliable.

I suggest to close the issue as WONTFIX, as I cannot see any reliable speedup 
nor any significant impact on performance.

--

___
Python tracker 

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



[issue20104] expose posix_spawn(p)

2018-05-18 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

I originally removed it from the configure script in PR6794 but it was 
reintroduced in commit 57009526f6a405e0ffe8c16012cce509b62cb577. Check the PR 
for Greg's rationale.

--

___
Python tracker 

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



[issue29640] _PyThreadState_Init and fork race leads to inconsistent key list

2018-05-18 Thread STINNER Victor

STINNER Victor  added the comment:

Oh, it seems like I was wrong in my previous comment. Python 2.7 code base is 
already designed to support native TLS. It's just that we only implement native 
TLS on Windows. So yeah, it seems doable to implement native TLS for pthread.

History of Py_HAVE_NATIVE_TLS:

commit 8d98d2cb95ac37147a4de5a119869211e8351324
Author: Mark Hammond 
Date:   Sat Apr 19 15:41:53 2003 +

New PyGILState_ API - implements pep 311, from patch 684256.

commit 00f2df495a6fcb40d70243c34f296f26ccc72719
Author: Kristján Valur Jónsson 
Date:   Fri Jan 9 20:03:27 2009 +

Issue 3582.  Improved thread support and TLS for Windows

--

___
Python tracker 

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



[issue33470] Changes from GH-1638 (GH-3575, bpo-28411) are not documented in Porting to Python 3.7

2018-05-18 Thread STINNER Victor

STINNER Victor  added the comment:

> Sorry for mixing two things here, but I meant that I found out about this 
> because of the private API use in gdb, however nothing from the change is 
> documented on whatsnew at all.

It seems like there is at least one change in the public API: the removal of 
the PyInterpreterState.modules field. Are the members of the PyInterpreterState 
structure part of the public API?

@Eric: do you consider that it should be documented?

--

___
Python tracker 

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



  1   2   >