[issue32899] Not documented: key in dict test may raise TypeError

2018-02-21 Thread xitop

xitop  added the comment:

You are right. It is 'key in d', not 'object in d'.

(Thanks for you patience. I'm sorry I did not get it right earlier.)

--

___
Python tracker 

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



[issue32906] AttributeError: 'NoneType' object has no attribute 'sendall'

2018-02-21 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

Hi, this is for tracking bugs in the Python interpreter and standard library, 
not asking for help debugging your own code. There's no reason (yet) to believe 
this error is a bug in Python, you need to debug it first to ensure it is not a 
bug in your own code before posting it as a bug here.

If you need help debugging your code, try the python-l...@python.org mailing 
list.

If you find that it is not a bug in your code, please re-open this issue.

--
nosy: +steven.daprano
resolution:  -> rejected
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



[issue32899] Not documented: key in dict test may raise TypeError

2018-02-21 Thread INADA Naoki

INADA Naoki  added the comment:

We have it already:

https://docs.python.org/3/library/stdtypes.html#mapping-types-dict

> A dictionary’s keys are almost arbitrary values. Values that are not 
> hashable, that is, values containing lists, dictionaries or other mutable 
> types (that are compared by value rather than by object identity) may not be 
> used as keys.

--

___
Python tracker 

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



[issue32905] IDLE: remove unused code in pyparse module

2018-02-21 Thread miss-islington

miss-islington  added the comment:


New changeset d8e7b98b17cd2cc15b307f54a768c9ca31072b5f by Miss Islington (bot) 
in branch '3.6':
bpo-32905: IDLE - remove unused code in pyparse module (GH-5807)
https://github.com/python/cpython/commit/d8e7b98b17cd2cc15b307f54a768c9ca31072b5f


--

___
Python tracker 

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



[issue32899] Not documented: key in dict test may raise TypeError

2018-02-21 Thread xitop

xitop  added the comment:

While I do fully agree with not documenting all exceptions, I'd like to point 
out a major difference in the case of "unhashable in dict". 

It differs from the general case where an exception means the function is 
unable to return a meaningful result, beacuse it easily COULD return False as 
its documentation states. The exception is raised by a design decision, not by 
necessity. That makes it special.

A single sentence like "A hashable key is precondition of all dict operations." 
would explain the behaviour well. 

That's all I wanted to say. Thank you.

--

___
Python tracker 

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



[issue32905] IDLE: remove unused code in pyparse module

2018-02-21 Thread miss-islington

miss-islington  added the comment:


New changeset dfa1144582e19e5fee2c07e6b7e281da1bef7782 by Miss Islington (bot) 
in branch '3.7':
bpo-32905: IDLE - remove unused code in pyparse module (GH-5807)
https://github.com/python/cpython/commit/dfa1144582e19e5fee2c07e6b7e281da1bef7782


--
nosy: +miss-islington

___
Python tracker 

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



[issue32906] AttributeError: 'NoneType' object has no attribute 'sendall'

2018-02-21 Thread Varalakshmi

New submission from Varalakshmi :

Hi ,
I have requirement to simulate http server on particular port 
we have an application which sends req to that simulated server for that port 
I need to get that request 
read the request body 
Validate the request body
and send response back to the appln from the simulated server based on the 
validation 

I want to do all this in robot framework 

I'm using BaseHTTPServer module to simulate the server 
my code is as follows 

#!/usr/bin/python
import sys
simulator_server_ip=sys.argv[1]
simulator_server_port=sys.argv[2]

from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from SocketServer import ThreadingMixIn
import threading


class Handler(BaseHTTPRequestHandler):

def do_POST(self):
print "getting data section"
content_len = int(self.headers.getheader('content-length', 0))
self.req_body = self.rfile.read(content_len)
return self.req_body


def sendresponse_code(self,code):
print "response section"
self.send_response(code)
self.end_headers()
message =  threading.currentThread().getName()
self.wfile.write(message)
self.wfile.write('\n')
return

class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
"""Handle requests in a separate thread."""

if __name__ == '__main__':
server = 
ThreadedHTTPServer((simulator_server_ip,int(simulator_server_port)), Handler)
req,c_a=server.get_request()
hlr=Handler(req,c_a,server.server_address)
print hlr.req_body  # this is the request body which needs to be 
validated outside the code
resp_code=input("send the code:")  # based on the validation I need to send 
the response which is handled from outside 
hlr.sendresponse_code(resp_code)



when I run the above code , in send_response section it is failing and 
I'm getting the following error 

getting data section
{"push-message":"json_data_too_many_parameters_so_not_pasting_the_Data"}
send the code:200
response section
10.10.30.50 - - [22/Feb/2018 19:14:44] "POST /pushnotification/v1.0/message 
HTTP/1.1" 200 -
Traceback (most recent call last):
  File "PNS_200Resp.py", line 38, in 
hlr.sendresponse_code(resp_code)
  File "PNS_200Resp.py", line 22, in sendresponse_code
self.send_response(code)
  File "/usr/lib64/python2.6/BaseHTTPServer.py", line 383, in send_response
(self.protocol_version, code, message))
  File "/usr/lib64/python2.6/socket.py", line 324, in write
self.flush()
  File "/usr/lib64/python2.6/socket.py", line 303, in flush
self._sock.sendall(buffer(data, write_offset, buffer_size))
AttributeError: 'NoneType' object has no attribute 'sendall'


can some one Please check and let me know what is wrong with the code

--
components: Library (Lib)
messages: 312537
nosy: blvaralaks...@gmail.com
priority: normal
severity: normal
status: open
title: AttributeError: 'NoneType' object has no attribute 'sendall'
type: compile error
versions: Python 2.7

___
Python tracker 

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



[issue32905] IDLE: remove unused code in pyparse module

2018-02-21 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5586

___
Python tracker 

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



[issue32905] IDLE: remove unused code in pyparse module

2018-02-21 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5585
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



[issue32905] IDLE: remove unused code in pyparse module

2018-02-21 Thread Terry J. Reedy

Terry J. Reedy  added the comment:


New changeset 451d1edaf4d27c4e632d81246d308e8dd6ea945f by Terry Jan Reedy in 
branch 'master':
bpo-32905: IDLE - remove unused code in pyparse module (GH-5807)
https://github.com/python/cpython/commit/451d1edaf4d27c4e632d81246d308e8dd6ea945f


--

___
Python tracker 

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



[issue32905] IDLE: remove unused code in pyparse module

2018-02-21 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
title: IDLE pyparse: fix initialization and remove unused code -> IDLE: remove 
unused code in pyparse module

___
Python tracker 

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



[issue32898] [BUILD] Using COUNT_ALLOCS breaks build

2018-02-21 Thread miss-islington

miss-islington  added the comment:


New changeset bc2e1104693fd471b96ecac5b2ab4cffa09830ab by Miss Islington (bot) 
in branch '3.7':
closes bpo-32898: Fix debug build crash with COUNT_ALLOCS (GH-5800)
https://github.com/python/cpython/commit/bc2e1104693fd471b96ecac5b2ab4cffa09830ab


--
nosy: +miss-islington

___
Python tracker 

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



[issue32905] IDLE pyparse: fix initialization and remove unused code

2018-02-21 Thread Terry J. Reedy

New submission from Terry J. Reedy :

Spinoff from #32880.
msg312394: dump duplicates print, except that sys.__stdout__ may be None.
msg312395: lastopenbracketpos is now always initialized in _study2, as was 
stmt_bracketing.  get_last_open_bracket_pos is never called.

Test are adjusted for removals.

--
stage: patch review -> test needed

___
Python tracker 

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



[issue32905] IDLE pyparse: fix initialization and remove unused code

2018-02-21 Thread Terry J. Reedy

Change by Terry J. Reedy :


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



[issue32880] IDLE: Fix and update and cleanup pyparse

2018-02-21 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
dependencies: +IDLE pyparse: fix initialization and remove unused code

___
Python tracker 

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



[issue32905] IDLE pyparse: fix initialization and remove unused code

2018-02-21 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
assignee: terry.reedy
components: IDLE
nosy: terry.reedy
priority: normal
severity: normal
stage: test needed
status: open
title: IDLE pyparse: fix initialization and remove unused code
type: behavior
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



[issue32898] [BUILD] Using COUNT_ALLOCS breaks build

2018-02-21 Thread Benjamin Peterson

Benjamin Peterson  added the comment:


New changeset 745dc65b17b3936e3f9f4099f735f174d30c4e0c by Benjamin Peterson 
(Eddie Elizondo) in branch 'master':
closes bpo-32898: Fix debug build crash with COUNT_ALLOCS (GH-5800)
https://github.com/python/cpython/commit/745dc65b17b3936e3f9f4099f735f174d30c4e0c


--
nosy: +benjamin.peterson
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



[issue32898] [BUILD] Using COUNT_ALLOCS breaks build

2018-02-21 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5583

___
Python tracker 

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



[issue32874] IDLE: Add tests for pyparse

2018-02-21 Thread miss-islington

miss-islington  added the comment:


New changeset 52064c3d8a62c8c14967ec1e004927e9297bb62c by Miss Islington (bot) 
in branch '3.6':
bpo-32874: IDLE: add tests for pyparse (GH-5755)
https://github.com/python/cpython/commit/52064c3d8a62c8c14967ec1e004927e9297bb62c


--

___
Python tracker 

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



[issue32874] IDLE: Add tests for pyparse

2018-02-21 Thread miss-islington

miss-islington  added the comment:


New changeset c59bc98fb26ff1a2361f168a97da4a5f6c1e5b43 by Miss Islington (bot) 
in branch '3.7':
bpo-32874: IDLE: add tests for pyparse (GH-5755)
https://github.com/python/cpython/commit/c59bc98fb26ff1a2361f168a97da4a5f6c1e5b43


--
nosy: +miss-islington

___
Python tracker 

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



[issue32891] Add 'Integer' as synonym for 'Integral' in numbers module.

2018-02-21 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

As things stand, given Serhiy comment, I agree.

Like others, I don't like 'Integral', but also I don't like clunky special case 
code.

--
priority: high -> normal
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



[issue32874] IDLE: Add tests for pyparse

2018-02-21 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5582

___
Python tracker 

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



[issue32874] IDLE: Add tests for pyparse

2018-02-21 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5581

___
Python tracker 

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



[issue32874] IDLE: Add tests for pyparse

2018-02-21 Thread Terry J. Reedy

Terry J. Reedy  added the comment:


New changeset c84cf6c03fce1fb73bfaf91d7909f1c2708f14a2 by Terry Jan Reedy 
(Cheryl Sabella) in branch 'master':
bpo-32874: IDLE: add tests for pyparse (GH-5755)
https://github.com/python/cpython/commit/c84cf6c03fce1fb73bfaf91d7909f1c2708f14a2


--

___
Python tracker 

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



[issue23077] PEP 1: Allow Provisional status for PEPs

2018-02-21 Thread Nick Coghlan

Nick Coghlan  added the comment:

I'll also note that I made my comments above about writing a new PEP prior to 
the migration to GitHub and the availability of a PR-based workflow for 
reviewing PEP changes.

So consider the PR Cheryl linked and the post at 
https://mail.python.org/pipermail/python-dev/2018-February/152205.html the 
replacement for that PEP suggestion :)

--

___
Python tracker 

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



[issue32904] os.chdir(), os.getcwd() may crash on Windows in presence of races

2018-02-21 Thread Alexey Izbyshev

Alexey Izbyshev  added the comment:

The same issue applies to os.getcwd().

--
title: os.chdir() may crash on Windows in presence of races -> os.chdir(), 
os.getcwd() may crash on Windows in presence of races

___
Python tracker 

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



[issue32880] IDLE: Fix and update and cleanup pyparse

2018-02-21 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

One sub-issue is to expand the current short doc section (2.1. Automatic 
indentation) the intended smart indenting.  There is nothing about open 
parameter lists, not about multiline tuple/list/dict displays.  It should say 
(IN CAPS?) that an indent that seems wrong likely indicates a syntax error that 
has mislead the indenter.

--

___
Python tracker 

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



[issue32880] IDLE: Fix and update and cleanup pyparse

2018-02-21 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

As noted in the test for find_good_parse_start and PR5755 discussion, a single 
line header on a line by itself in a multiline comment before a multiline 
header can prevent recognition of the latter.
 
>>> P.set_str("'somethn=ig'\ndef g(a,\nb\n")
>>> P.find_good_parse_start(lambda i: False) 
13
>>> P.set_str("'''\ndef f():\n pass'''\ndef g(a,\nb\n") 
>>> P.find_good_parse_start(lambda i:i < 15)
>>>

One alternative to the current algorithm would be to search the beginning of 
every line for a compound statement keyword, not just lines ending with ':'.  I 
believe the concern is that this would require uselessly checking more lines 
within strings.  I believe that the same concern is why 'if' and 'for' are 
missing from the keyword list.

When the window is an editor rather than shell, find_good_parse_start is called 
in EditorWindow.newline_and_indent_event and Hyperparser.__init__.  The 
call-specific in-string function is returned by EW._build_char_in_string_func. 
It calls EW.is_char_in_string, which returns False only if the char in the text 
widget has been examined by the colorizer and not tagged with STRING.

The call to find_good_parse_start is always followed by a call to set_lo and 
and then _study1 (via a call to another function).  _study1 replaces runs of 
non-essential chars with 'x', which means that string literals within the code 
string are mostly reduced to a single x per line.  (It would be fine if they 
were emptied except for newlines.)  This suggests starting 
find_good_parse_start with a partial reduction, of just string literals, saved 
for further reduction by _study, so that keywords would never occur within the 
reduced literal.

The problem is that one cannot tell for sure whether ''' or """ is the 
beginning or end of a multiline literal without parsing from the beginning of 
the code (which colorizer does).  An alternate way to reuse the colorizer work 
might be to use splitlines on the code and then get all string tag ranges.

The code-context option picks out compound-statement header lines.  When 
enabled, I believe that its last line may be the desired good parse start line.

Any proposed speedup should be tested by parsing multiple chunks of multiple 
stdlib modules.

--

___
Python tracker 

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



[issue32903] os.chdir() may leak memory on Windows

2018-02-21 Thread Alexey Izbyshev

Change by Alexey Izbyshev :


--
versions: +Python 2.7

___
Python tracker 

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



[issue28498] tk busy command

2018-02-21 Thread Ned Deily

Change by Ned Deily :


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



[issue32904] os.chdir() may crash on Windows in presence of races

2018-02-21 Thread Alexey Izbyshev

Change by Alexey Izbyshev :


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

___
Python tracker 

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



[issue32904] os.chdir() may crash on Windows in presence of races

2018-02-21 Thread Alexey Izbyshev

New submission from Alexey Izbyshev :

win32_wchdir() retries GetCurrentDirectory() with a larger buffer if necessary, 
but doesn't check whether the new buffer is large enough. Another thread could 
change the current directory in meanwhile, so the buffer could turn out to be 
still not large enough, left in an uninitialized state and passed to 
SetEnvironmentVariable() afterwards.

--
components: Extension Modules, Windows
messages: 312524
nosy: izbyshev, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
priority: normal
severity: normal
status: open
title: os.chdir() may crash on Windows in presence of races
type: crash
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



[issue32903] os.chdir() may leak memory on Windows

2018-02-21 Thread Alexey Izbyshev

Change by Alexey Izbyshev :


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

___
Python tracker 

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



[issue23077] PEP 1: Allow Provisional status for PEPs

2018-02-21 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Pull request:
https://github.com/python/peps/pull/577

--
nosy: +csabella

___
Python tracker 

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



[issue32903] os.chdir() may leak memory on Windows

2018-02-21 Thread Alexey Izbyshev

New submission from Alexey Izbyshev :

'new_path' is not freed if the new directory is a UNC path longer than MAX_PATH.

--
components: Extension Modules, Windows
messages: 312522
nosy: izbyshev, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
priority: normal
severity: normal
status: open
title: os.chdir() may leak memory on Windows
type: resource usage
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



[issue28498] tk busy command

2018-02-21 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

There was a lot of work put into this patch, but I don't think it's been 
committed yet.  Are any of the original authors interested in converting this 
to a Github pull request on the master branch?  Thanks!

--
nosy: +csabella

___
Python tracker 

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



[issue32884] Adding the ability for getpass to print asterisks when passowrd is typed

2018-02-21 Thread Matanya Stroh

Matanya Stroh  added the comment:

for getpass.win_getpass() it can simply be done by adding this line
msvcrt.putch("*").
So the code will look like:

def win_getpass(prompt='Password: ', stream=None):
"""Prompt for password with echo off, using Windows getch()."""
if sys.stdin is not sys.__stdin__:
return fallback_getpass(prompt, stream)

for c in prompt:
msvcrt.putwch(c)
pw = ""
while 1:
c = msvcrt.getwch()
if c == '\r' or c == '\n':
break
if c == '\003':
raise KeyboardInterrupt
if c == '\b':
pw = pw[:-1]
else:
pw = pw + c
msvcrt.putch("*") #Line that was added
msvcrt.putwch('\r')
msvcrt.putwch('\n')
return pw

--

___
Python tracker 

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



[issue32016] Python 3.6.3 venv FAILURE

2018-02-21 Thread Ned Deily

Ned Deily  added the comment:

> Without any additional information, should this be closed as 'Works for Me'?

Yes, please.

--
nosy: +ned.deily

___
Python tracker 

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



[issue32016] Python 3.6.3 venv FAILURE

2018-02-21 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

Without any additional information, should this be closed as 'Works for Me'?

--
nosy: +csabella

___
Python tracker 

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



[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-02-21 Thread Eric V. Smith

Change by Eric V. Smith :


--
nosy: +ned.deily
priority: normal -> release blocker

___
Python tracker 

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



[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-02-21 Thread Eric V. Smith

Eric V. Smith  added the comment:

That's a great bug report. Thanks for the tiny code to replicate it.

It turns out the code isn't quite doing what I thought. I'll have to give some 
thought to exactly how I'm going to handle this without breaking other cases, 
but I should have it fixed soon.

Thanks again.

--

___
Python tracker 

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



[issue27923] PEP 467 -- Minor API improvements for binary sequences

2018-02-21 Thread Ned Deily

Change by Ned Deily :


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



[issue32902] FileInput "inplace" redirects output of other threads

2018-02-21 Thread mj4int

New submission from mj4int :

A pool of threads exists, all of which have started executing.

Thread A has a fileinput object and is currently iterating over the files in 
"edit in place mode".  For each file, stdout is redirected to the file.  Thread 
A can call print and write to the file.

Thread B just wants to log some things in the console.  Thread B calls print 
and... writes to the file thread A is processing.  stdout is hijacked by thread 
A's fileinput loop.

Whether or not every thread should have an independent evaluation of stdout, 
certainly a fileinput object shouldn't silently redirect the prints of an 
innocent bystander thread?

May exist in other python versions, but not checked.

--
components: IO, Library (Lib)
messages: 312516
nosy: mj4int
priority: normal
severity: normal
status: open
title: FileInput "inplace" redirects output of other threads
type: behavior
versions: Python 2.7, Python 3.5

___
Python tracker 

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



[issue32895] Make general function sum() use Numpy's sum when obviously possible

2018-02-21 Thread Raymond Hettinger

Change by Raymond Hettinger :


--
resolution:  -> rejected
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



[issue32899] Not documented: key in dict test may raise TypeError

2018-02-21 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

In general, Python functions don't document all possible exceptions.  One 
reason is that it would lead to substantial redundancy in the docs.  Another 
reason is that functions generally don't know all the possible exceptions that 
can be raised because that can be controlled determined by the data itself.  
Also, the docs try to focus on core functionality and not drown out the message 
with side details.

For comparison, look at str.startswith() or math.cos() which can raise a 
TypeError if the input type is incorrect.  There is no reason to discuss that 
in the docs because most functions raise a TypeError when the type is 
incorrect.  This is more of a general FAQ than a function by function 
documentation issue.

--
resolution:  -> rejected
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



[issue32901] Update Windows 3.7/8 builds to tcl/tk 8.6.8

2018-02-21 Thread Zachary Ware

Zachary Ware  added the comment:

This is on Steve these days due to the binary signing.

--
assignee:  -> steve.dower
components: +Tkinter, Windows
nosy: +paul.moore, steve.dower, tim.golden

___
Python tracker 

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



[issue32900] Teach pdb to step through asyncio et al.

2018-02-21 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

Can you back up a bit and give an example of the problem you're running into?

--

___
Python tracker 

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



[issue32899] Not documented: key in dict test may raise TypeError

2018-02-21 Thread xitop

New submission from xitop :

I'd like to suggest an addition to the documentation of the "key in dict" 
operation.

Current version found at
https://docs.python.org/3/library/stdtypes.html#dict
says only:

---
key in d

Return True if d has a key key, else False.
---

This is not precise. TypeError is also a possible outcome. It happens when the 
key is unhashable. Unsure whether the description is incomplete or the 
membership test has a bug I submitted the issue 32675 in January. The issue was 
closed with resolution of "not a bug".

If it is indded the intended behaviour, I think it needs to be documented in 
order to prevent further misunderstandings. Before the issue 32675 I believed a 
membership test is failsafe, because the definition of __contains__ clearly 
defines the return value as either True or False.

--
assignee: docs@python
components: Documentation
messages: 312506
nosy: docs@python, xitop
priority: normal
severity: normal
status: open
title: Not documented: key in dict test may raise TypeError
type: enhancement

___
Python tracker 

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



[issue32901] Update Windows 3.7/8 builds to tcl/tk 8.6.8

2018-02-21 Thread Terry J. Reedy

New submission from Terry J. Reedy :

This should be done ASAP for most testing.

MacOS 64bit 3.7.0b1 links to 8.6.7.  Whether that should be upgraded to 8.6.8 
is up to Ned.  I raised question on #15663.

--
messages: 312512
nosy: serhiy.storchaka, terry.reedy, zach.ware
priority: normal
severity: normal
status: open
title: Update Windows 3.7/8 builds to tcl/tk 8.6.8
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



[issue15663] Investigate providing Tcl/Tk 8.6 with OS X installers

2018-02-21 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Is there anything left to do for this?  The new 64 bit MacOS 3.7.0b1 links with 
8.6.7.  Perhaps that should be updated to 8.6.8.

--

___
Python tracker 

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



[issue32900] Teach pdb to step through asyncio et al.

2018-02-21 Thread Matthias Urlichs

Matthias Urlichs  added the comment:

File attachment failed, retrying …

--
keywords: +patch
Added file: https://bugs.python.org/file47456/pdb.diff

___
Python tracker 

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



[issue32900] Teach pdb to step through asyncio et al.

2018-02-21 Thread Matthias Urlichs

New submission from Matthias Urlichs :

The attached patch is a proof-of-concept implementation of a way to teach pdb 
to "single-step" through non-interesting code that you can't skip with "n". The 
prime example for this is asyncio, trio et al., though decorators like 
@contextlib.contextmanager also benefit.

A "real" implementation should allow the user to specify ranges to ignore, on 
the pdb command line (probably by filename and optional range of line numbers, 
instead of pattern matching). A visual indication of how much code has been 
skipped-ahead that way might also be beneficial.

--
components: asyncio
messages: 312509
nosy: asvetlov, giampaolo.rodola, njs, smurfix, yselivanov
priority: normal
severity: normal
status: open
title: Teach pdb to step through asyncio et al.
type: enhancement

___
Python tracker 

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



[issue32886] new Boolean ABC in numbers module

2018-02-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

Adjusted title (since the Integer <-> Integral rename is the subject of a 
separate issue) and versions (since as a new feature, this can't go into Python 
3.7, which is already in feature freeze).

--
title: new Boolean ABC in numbers module + Integral>Integer renaming -> new 
Boolean ABC in numbers module
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



[issue32897] test_gdb failed on Fedora 27

2018-02-21 Thread Amit Ghadge

New submission from Amit Ghadge :

Hi,

I get latest changes,
$ git log -1
Author: Paul Price 
Date:   Wed Feb 21 01:00:01 2018 -0500

compilation done successfully but gdb test is failing, I attached output of 
test_gdb

--
components: Tests
files: error.txt
messages: 312503
nosy: amitg-b14
priority: normal
severity: normal
status: open
title: test_gdb failed on Fedora 27
versions: Python 3.8
Added file: https://bugs.python.org/file47455/error.txt

___
Python tracker 

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



[issue32893] ast.literal_eval() shouldn't accept booleans as numbers in AST

2018-02-21 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This doesn't look like Python literal. And if the function accepts a one 
particular non-literal the user can except that it accepts other looking 
similarly non-literal, that is false.

Actually ast.literal_eval("+True") is error. But 
ast.literal_eval(ast.UnaryOp(ast.UAdd(), ast.Constant(True))) is successful by 
oversight.

And look at this from other side. What is the benefit of accepting "+True"? 
This doesn't make the code simpler.

--

___
Python tracker 

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



[issue32886] new Boolean ABC in numbers module + Integral>Integer renaming

2018-02-21 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Use <= for this operation.

--

___
Python tracker 

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



[issue32898] [BUILD] Using COUNT_ALLOCS breaks build

2018-02-21 Thread Eddie Elizondo

New submission from Eddie Elizondo :

The following build crashed:
mkdir debug && cd debug
../configure --with-pydebug
make EXTRA_CFLAGS="-DCOUNT_ALLOCS"

The bug was introduced here: 
https://github.com/python/cpython/commit/25420fe290b98171e6d30edf9350292c21ef700e

Fix:
1) s/inter/interp/
2) Declare PyTypeObject

--
components: Build
messages: 312504
nosy: elizondo93
priority: normal
pull_requests: 5578
severity: normal
status: open
title: [BUILD] Using COUNT_ALLOCS breaks build
type: compile error

___
Python tracker 

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



[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-02-21 Thread Eric V. Smith

Change by Eric V. Smith :


--
assignee:  -> eric.smith
components: +Library (Lib)
type: crash -> behavior

___
Python tracker 

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



[issue32886] new Boolean ABC in numbers module + Integral>Integer renaming

2018-02-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

> This one is common to both python bool and np.bool_.

It's not, though. One of my examples was using `~` (`__invert__`) from the 
proposed ABC). And the behaviour of that function differs between NumPy and 
Python

I think one of the rules about this sort of abstraction should be that there 
should be multiple concrete examples available that you intend the abstraction 
to apply to, *before* you abstract. Otherwise there's a risk of making an 
abstraction that doesn't turn out to fit actual use-cases. Right now, we only 
have Python's bool as a concrete example; NumPy's bool_ is IMO not close enough 
in its behaviour. Are you aware of other bool-like types around that the 
proposed ABC would be helpful for?

--

___
Python tracker 

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



[issue32897] test_gdb failed on Fedora 27

2018-02-21 Thread Amit Ghadge

Amit Ghadge  added the comment:

gdb version is,
GNU gdb (GDB) Fedora 8.0.1-30.fc27

--

___
Python tracker 

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



[issue32899] Not documented: key in dict test may raise TypeError

2018-02-21 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +inada.naoki, rhettinger

___
Python tracker 

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



[issue32895] Make general function sum() use Numpy's sum when obviously possible

2018-02-21 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I concur with Raymond.

NumPy is a third-party library, Python builtins can't depend on it. This could 
be solved by introducing a special protocol, but this isn't free. It adds a 
burden on writing and maintaining code and tests, and adds a runtime overhead 
of checking if the protocol is supported. This will slowdown sum() for every 
other collection. It can even slowdown it for short NumPy arrays.

And, as Raymond has noted, if introduce the __sum__ protocol, why not introduce 
protocols for min(), max(), sort(), all(), and for any other builtin? This has 
the same drawbacks as for sum(), but multiplied by many times.

If you use NumPy arrays just use NumPy array methods. Otherwise what is the 
reason of using NumPy?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue32898] [BUILD] Using COUNT_ALLOCS breaks build

2018-02-21 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
stage:  -> patch review
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



[issue32893] ast.literal_eval() shouldn't accept booleans as numbers in AST

2018-02-21 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

What harm comes from accepting expressions like "+True" or "True+2j"?  While 
weird looking, those are valid Python expressions, so this doesn't seem like a 
bug.  A key feature of booleans is that they are interoperable with integers.

--
nosy: +rhettinger

___
Python tracker 

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



[issue32886] new Boolean ABC in numbers module + Integral>Integer renaming

2018-02-21 Thread Sylvain Marie

Sylvain Marie  added the comment:

@Mark: you are right. That's why the proposed ABC does NOT inherit from 
Integral/Integer and focuses on boolean logic in its simplest form (not, and, 
or, xor). This one is common to both python bool and np.bool_.

@Serhiy: thanks for this interesting suggestion ! However having been in the 
software development world for 12 years, I never met these concepts in practice 
yet. I suspect that therefore I will not be the only one - I'm afraid that 
might make this ABC hard to understand. Besides, I am not sure that numpy bool 
and python bool implement this correctly:

>>> True > False
True
>>> np.bool_(True) > np.bool_(False)
True

This does not seem to comply with the description I found in 
https://en.wikipedia.org/wiki/Material_conditional

For these reasons I would suggest these operations to be part of a separate 
class.

-Sylvain

--

___
Python tracker 

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



[issue32895] Make general function sum() use Numpy's sum when obviously possible

2018-02-21 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

> I think many programmers aren't aware of that, so all in all 
> it can improve the performance of a lot of existing code.

We could create a __sum__ dunder method to allow classes to override the normal 
behavior of sum, but that isn't worth it because the speed issue has almost 
nothing to do with summation.  For example, the timings would also be slow for 
min(a), max(a), list(a), set(a), etc where a=np.random.rand(int(1e6)).

In general, if anything outside of numpy loops over a numpy array, then every 
datum has to be converted to a typed, reference-counted python object before 
the function can begin to do its work.  These are the facts-of-life when 
dealing with numpy.  The usual advice is to manipulate numpy arrays only with 
numpy tools because they all know how to operate on the data natively without 
allocating Python objects for every datum.

--
nosy: +rhettinger

___
Python tracker 

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



[issue32895] Make general function sum() use Numpy's sum when obviously possible

2018-02-21 Thread ppperry

Change by ppperry :


--
type: performance -> enhancement

___
Python tracker 

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



[issue32895] Make general function sum() use Numpy's sum when obviously possible

2018-02-21 Thread ppperry

Change by ppperry :


--
type: enhancement -> performance

___
Python tracker 

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



[issue32895] Make general function sum() use Numpy's sum when obviously possible

2018-02-21 Thread ppperry

Change by ppperry :


--
components: +Library (Lib) -2to3 (2.x to 3.x conversion tool)

___
Python tracker 

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



[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-02-21 Thread Ned Deily

Change by Ned Deily :


--
nosy: +eric.smith

___
Python tracker 

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



[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-02-21 Thread John Didion

New submission from John Didion :

> @dataclass
> class Foo:
>  x: dict = field(default_factory=dict)

> @dataclass
> class Bar(Foo):
>   y: int = 1

> @dataclass
> class Baz(Foo):
>   def blorf(self):
> print('hello')

> Foo().x
{}

> Bar().x
{}

> Baz().x

Traceback (most recent call last):
  File "", line 1, in 
TypeError: __init__() missing 1 required positional argument: 'x'

---

I understand that this is desired behavior when the subclass contains 
non-default attributes. But subclasses that define no additional attributes 
should work just the same as those that define only additional default 
attributes.

A similar issue was raised and dismissed when dataclasses was in development on 
GitHub: https://github.com/ericvsmith/dataclasses/issues/112, but that only 
concerned the case of subclasses defining non-default attributes.

--
messages: 312496
nosy: John Didion
priority: normal
severity: normal
status: open
title: Error when subclassing a dataclass with a field that uses a 
defaultfactory
type: crash
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



[issue32895] Make general function sum() use Numpy's sum when obviously possible

2018-02-21 Thread Uri Elias

New submission from Uri Elias :

True at least to PY2.7 and 3.5 - given x is a numpy array, say 
np.random.rand(int(1e6)), then sum(x) is much slower (for 1e6 elements - 2 
orders of magnitude) than x.sum(). 
Now, while this is understandable behaviour, I wander how hard it is to add a 
condition that if argument is a Numpy object then use its own sum. 
I think many programmers aren't aware of that, so all in all it can improve the 
performance of a lot of existing code.

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 312495
nosy: urielias
priority: normal
severity: normal
status: open
title: Make general function sum() use Numpy's sum when obviously possible
type: enhancement
versions: Python 2.7, 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



[issue28886] Move deprecated abc module decorators to separate section in docs

2018-02-21 Thread INADA Naoki

Change by INADA Naoki :


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



[issue32891] Add 'Integer' as synonym for 'Integral' in numbers module.

2018-02-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

And it's Ned's call, of course, but this smells like a new feature rather than 
a fix to me, and I'm not sure why it would be considered special enough to 
break the usual release-process rules. Serhiy's point about pickles shows that 
there's at least a little bit of care and thought needed here.

--

___
Python tracker 

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



[issue32886] new Boolean ABC in numbers module + Integral>Integer renaming

2018-02-21 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

If a Boolean ABC includes __and__, __or__ and __xor__ which implement 
conjunction, disjunction and exclusive disjunction, shouldn't it include 
__le__, __gt__, __ge__ and __lt__? They implement other logical operations: 
material implication, material nonimplication, converse implication and 
converse nonimplication.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue32894] AST unparsing of infinity numbers

2018-02-21 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

AST unparsing of infinity numbers produces a string which can't be evaluated 
because inf and infj are not builtins.

>>> from __future__ import annotations
>>> def f(x: A[1e1000, 1e1000j]): pass
... 
>>> f.__annotations__
{'x': 'A[(inf, infj)]'}

See how this problem is handled in Tools/parser/unparse.py.

There is similar problem with NaN. NaN can't be a result of parsing Python 
sources, but it can be injected manually in AST, and it can be a result of 
third-party AST optimizer.

--
components: Interpreter Core
messages: 312492
nosy: gvanrossum, lukasz.langa, serhiy.storchaka
priority: normal
severity: normal
status: open
title: AST unparsing of infinity numbers
type: behavior
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



[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-02-21 Thread Nick Coghlan

Nick Coghlan  added the comment:

Ah, right - in that case, I think the subclasses would be worthwhile, as they 
shouldn't be too much hassle to maintain for a release, and will provide a more 
graceful migration for folks doing their own AST processing and generation.

--

___
Python tracker 

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



[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-02-21 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Right, they shouldn't be just aliases, but Constant subclasses with __new__ 
which return Constant and __instancecheck__ which checks the type of the value. 
And the Constant class should have writable properties n and s. All these 
operations should emit a deprecation warning at runtime. Even this doesn't 
preserve perfect compatibility. issubclass(type(node), Num) will not work, and 
compile(Num('123')) will raise en exception in the Num constructor instead of 
compile().

--

___
Python tracker 

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



[issue18777] Cannot compile _ssl.c using openssl > 1.0

2018-02-21 Thread Dmitry Zotikov

Dmitry Zotikov  added the comment:

James, double check you specify the right path to the local system libraries.  
If the system is multilib, libssl resides in /usr/local/lib/hpux32 (64) and not 
in /usr/local/lib directly.

--
nosy: +dmitry.zotikov

___
Python tracker 

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



[issue29282] Fused multiply-add: proposal to add math.fma()

2018-02-21 Thread Nico Schlömer

Nico Schlömer  added the comment:

Okay, thanks for the info.

As a stop-gap measure, I've created pyfma [1, 2]. Install with
```
pip install pyfma
```
and use with
```
pyfma.fma(3.0, 2.0, 1.0)
```
Only works on Unix reliable then, but that's all I care about. :)

Cheers,
Nico

[1] https://github.com/nschloe/pyfma
[2] https://pypi.python.org/pypi/pyfma

--

___
Python tracker 

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



[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-02-21 Thread Nick Coghlan

Nick Coghlan  added the comment:

As pure aliases, those wouldn't necessarily be that useful, as aside from 
NameConstant, the field names are different (Num.n, Str.s, Bytes.s).

I do wonder whether it might be worth keeping "NameConstant", though, and use 
that for Ellipsis as well, so the singletons all use NameConstant, while 
regular constants use Constant.

--

___
Python tracker 

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



[issue32017] profile.Profile() has no method enable()

2018-02-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

We can't remove public-looking methods (i.e. they don't start with an 
underscore) like that because some people may be using them.  Rather than 
document the differences, I think it would be more useful to try to bridge the 
gap by augmenting the profile API with whatever supplementary APIs cProfile 
has.  If some API is difficult to implement for profile, then we can revisit 
that goal and make an exception.

--

___
Python tracker 

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



[issue32008] Example suggest to use a TLSv1 socket

2018-02-21 Thread Christian Heimes

Change by Christian Heimes :


--
pull_requests: +5576
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



[issue32893] ast.literal_eval() shouldn't accept booleans as numbers in AST

2018-02-21 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue32893] ast.literal_eval() shouldn't accept booleans as numbers in AST

2018-02-21 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue32893] ast.literal_eval() shouldn't accept booleans as numbers in AST

2018-02-21 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

Currently ast.literal_eval() accepts AST representing expressions like "+True" 
or "True+2j" if constants are represented as Constant. This is because the type 
of the value is tested with `isinstance(left, (int, float))` and since bool is 
a subclass of int it passes this test.

The proposed PR makes ast.literal_eval() using tests for exact type. I don't 
think it is worth backporting since it affects only passing AST to 
ast.literal_eval(). Usually ast.literal_eval() is used for evaluating strings.

--
components: Library (Lib)
messages: 312485
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: ast.literal_eval() shouldn't accept booleans as numbers in AST
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



[issue32008] Example suggest to use a TLSv1 socket

2018-02-21 Thread Christian Heimes

Christian Heimes  added the comment:

Err, I meant PROTOCOL_TLS_CLIENT:

>>> import ssl
>>> context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
>>> context.check_hostname
True
>>> context.verify_mode


--

___
Python tracker 

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



[issue32008] Example suggest to use a TLSv1 socket

2018-02-21 Thread Christian Heimes

Christian Heimes  added the comment:

For 3.6 to 3.8 I'd prefer TLS_PROTOCOL_CLIENT. It also sets check_hostname and 
verify_mode to sane, safe values, too.

--
resolution: fixed -> 
stage: resolved -> needs patch
status: closed -> open
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



[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-02-21 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

Currently different literals are represented by different types in AST:

Num -- for int, float and complex
Str -- for str
Bytes -- for bytes
Ellipsis -- for Ellipsis
NameConstant -- for True, False and None

And Constant (added in 3.6, issue26146) can represent any immutable value, 
including tuples and frozensets of constants. Instances of Constant are not 
created by the AST parser, they are created by the builtin AST optimizer and 
can be created manually.

These AST types don't have one-to-one correspondence with Python types, since 
Num represents three numeric types, NameConstant represents bool and NoneType, 
and any constant type can be represented as Constant.

I propose to get rid of Num, Str, Bytes, Ellipsis and NameConstant and always 
use Constant. This will simplify the code which currently needs to repeat 
virtually identical code for all types.

I have almost ready patch, the only question is whether it is worth to keep 
deprecated aliases Num, Str, Bytes, Ellipsis and NameConstant.

--
components: Interpreter Core
messages: 312482
nosy: benjamin.peterson, brett.cannon, gvanrossum, ncoghlan, serhiy.storchaka, 
vstinner, yselivanov
priority: normal
severity: normal
status: open
title: Remove specific constant AST types in favor of ast.Constant
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



[issue32891] Add 'Integer' as synonym for 'Integral' in numbers module.

2018-02-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

+1 for the Integer alias, if it can be made to work. The "Integral" name has 
always felt clunky and non-obvious to me.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue29282] Fused multiply-add: proposal to add math.fma()

2018-02-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

> Is this because of the inf/NaN discrimination hiccups [...]

No, more than that. If it were just that, we could work around it by adding the 
appropriate special case handling before calling the libm fma (as has been 
done, reluctantly, with some of the other math module functions; see the source 
for math.pow, for example).

But the fma implementation on Windows is fundamentally broken. For finite 
numbers, it simply doesn't give what it's supposed to (a * b + c, computed with 
a _single_ rounding). Since that single rounding is most of the point of fma, 
that makes the libm fma not fit for purpose on Windows.

It _is_ possible, with care, to code up a not-too-inefficient fma emulation 
using clever tricks like Veltkamp splitting and Dekker multiplication. I have 
half such an implementation sitting on my home computer, but so far have not 
had the cycles to finish it (and it's not high on the priority list right now).

--

___
Python tracker 

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



[issue32886] new Boolean ABC in numbers module + Integral>Integer renaming

2018-02-21 Thread Mark Dickinson

Mark Dickinson  added the comment:

> - register numpy bool ('np.bool_') as a virtual subclass of 'Boolean' only

Be aware that np.bool_ behaves differently from Python's bool type in a number 
of ways. It may not make sense to have something that tries to abstract over 
both bool and np.bool_.

>>> import numpy as np
>>> np.bool_(True) + np.bool_(True)
True
>>> ~np.bool_(True)
False
>>> True + True
2
>>> ~True
-2

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue32886] new Boolean ABC in numbers module + Integral>Integer renaming

2018-02-21 Thread Sylvain Marie

Sylvain Marie  added the comment:

Thanks !

1. > ok
2. > ok
3. > That's simply 'the latest state' in the discussion. I guess that having 
Boolean in numbers is better than it being in its own module, since it is 
consistent with the other ABCs (and bool is a subclass of both Boolean and 
Integral-er). To quote Guido's answer in the discussion thread

GVR> A thought just occurred to me. Maybe we should just add a Boolean class to 
numbers?

(several positive answers)

SMA > I would rather suggest to keep that Boolean ABC class independent of 
Integral (see proposal in first post) to let it remain 'pure', i.e. represent 
logical booleans only. However nothing prevents us to register python bool as a 
virtual subclass of *both* Integral and Boolean - while np.bool would be 
registered as a virtual subclass of Boolean only. This would reflect quite well 
the reality - the fact that python bool is both a Boolean and an Integer, while 
numpy bool is only a Boolean.

GVR> OK, that could work. At this point I think you should just file an issue 
on bugs.python.org (but since Python 3.7 is in feature freeze, expect this to 
be put on the 3.8 track).

4. > Very good point. I do not know how do handle this at this point. As long 
as bool is a subclass of int (changing this is another discussion), the only 
way to go for now is probably to remove the 'invert' method from this ABC - if 
I am interpreting your answer correctly?


Finally let's note that the Integral > Integer renaming is now handled in a 
separate thread https://bugs.python.org/issue32891

--

___
Python tracker 

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



[issue32880] IDLE: Fix and update and cleanup pyparse

2018-02-21 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

In _study2, let q instead of p be end of last good line and then set p back to 
beginning.  Setting p to end, q to p, and p to start is confusing.

--

___
Python tracker 

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