[issue34641] Curiosity: f((a)=1) is not a syntax error -- why?

2018-09-11 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

There seems to be some of the similar cases that have tests added as part of 
c960f26044edaea6669e60859ecf590c63c65e62 and the original error message added 
at 3e0055f8c65c407e74ce476b8e2b1fb889723514.

Existing tests : 

>>> f(x()=2)
Traceback (most recent call last):
SyntaxError: keyword can't be an expression
>>> f(a or b=1)
Traceback (most recent call last):
SyntaxError: keyword can't be an expression
>>> f(x.y=1)
Traceback (most recent call last):
SyntaxError: keyword can't be an expression


Thanks

--

___
Python tracker 

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



[issue25041] document AF_PACKET socket address format

2018-09-11 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset a00de685c11cf8bdca1f8efa7aab80552d80ddfb by Benjamin Peterson in 
branch '3.6':
[3.6] closes bpo-25041: Document AF_PACKET socket address format. (GH-9209)
https://github.com/python/cpython/commit/a00de685c11cf8bdca1f8efa7aab80552d80ddfb


--

___
Python tracker 

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



[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2018-09-11 Thread Tal Einat


Tal Einat  added the comment:

Now just the collections module is left from this group.

Raymond, what would you like done with it WRT AC conversion, if at all?

--

___
Python tracker 

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



[issue34637] Make *start* usable as a keyword argument for sum().

2018-09-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Is not this a duplicate of issue31141?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue34641] Curiosity: f((a)=1) is not a syntax error -- why?

2018-09-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue34606] Unable to read zip file with extra

2018-09-11 Thread Vladimir Matveev


Vladimir Matveev  added the comment:

In this particular case looks like a crux of the problem was in the fact that 
compression encodes extra fields only if either zip64 is set or length of the 
field is larger than threshold but decompression always tries to decode it. 
Attached PR switches decoding to be conditioned on the presence of zip64 end of 
central directory record.

--
nosy: +v2m

___
Python tracker 

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



[issue34643] How to build Release Version of Python in Windows?

2018-09-11 Thread Valentin Zhao

Valentin Zhao  added the comment:

Sorry I posted a wrong pic.

--
Added file: https://bugs.python.org/file47798/build前.png

___
Python tracker 

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



[issue34637] Make *start* usable as a keyword argument for sum().

2018-09-11 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue34641] Curiosity: f((a)=1) is not a syntax error -- why?

2018-09-11 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue34642] time.ctime() uses %3d instead of %.2d to format.

2018-09-11 Thread Martin Panter


Martin Panter  added the comment:

I think "ctime" and "asctime" are supposed to wrap or imitate the standard C 
functions: , so I think this 
is intended behaviour. But see Issue 13927 about improving the documentation.

For a single-digit day of the month, there is supposed to be two spaces. Using 
"%.2d" would produce "Sep02" or "Sep 02", with a leading zero. On the other 
hand, changing the double space to a single space would produce "Sep 2", 
without a leading zero.

--
nosy: +martin.panter
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
superseder:  -> Extra spaces in the output of time.ctime

___
Python tracker 

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



[issue34643] How to build Release Version of Python in Windows?

2018-09-11 Thread Valentin Zhao

New submission from Valentin Zhao :

I am going to build a Python.exe to migrate it to another PC, in order to build 
a seemingly virtual *environment* of Python which could run python files. What 
I do to implement this is to *COPY* \win32 folder to another pc then execute 
python.exe with specific python file path tagged along.

For now, it works well, however, I met with a strange problem that I cannot 
find *tcl* under current file hierarchy and this library is generated very 
deeply so I have to extract it to the root directory manually. 

Surprisingly, I found that I can directly *COPY* all the folders generated by 
*msi installer* to another pc then use it. Nevertheless, I fret about there 
could be some registration thing during installation.

So how could I compile the source and make it generate folder hierarchy like 
the release version(like the snapshot I attached below)? I have read README.md 
in the \PCBuild yet it helps little.

--
components: Windows
files: build后结构.png
messages: 325116
nosy: Valentin Zhao, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: How to build Release Version of Python in Windows?
type: compile error
versions: Python 3.6
Added file: https://bugs.python.org/file47797/build后结构.png

___
Python tracker 

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



[issue34642] time.ctime() uses %3d instead of %.2d to format.

2018-09-11 Thread William Chaseling


William Chaseling  added the comment:

It's easy to get around using .replace('  ', ' '), but it's still a bit 
annoying.

--

___
Python tracker 

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



[issue34642] time.ctime() uses %3d instead of %.2d to format.

2018-09-11 Thread William Chaseling


New submission from William Chaseling :

time.ctime() returns _asctime from a C module.
_asctime returns a PyUnicode_FromFormat() result using "%s %s%3d %.2d:%.2d:%.2d 
%d" as the string formatter.

This works: 'Wed Sep 12 22:30:00 2018'
Except when day <10, because it uses %3d instead of %.2d
'Wed Sep  2 22:30:00 2018'

This seems like it might be intended behavior for some reason, but I don't see 
the reason.

--
components: Library (Lib)
messages: 325114
nosy: William Chaseling
priority: normal
severity: normal
status: open
title: time.ctime() uses %3d instead of %.2d to format.
type: behavior
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



[issue1621] Do not assume signed integer overflow behavior

2018-09-11 Thread Sergey Fedoseev


Sergey Fedoseev  added the comment:

> Now you rely on PyMem_Malloc() to detect the overflow.

Now overflow is not possible or am I missing something?

--
nosy: +sir-sigurd

___
Python tracker 

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



[issue25041] document AF_PACKET socket address format

2018-09-11 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset cadb66e173ded86ebc85b54889db48f66e7af592 by Benjamin Peterson in 
branch '3.7':
[3.7] closes bpo-25041: Document AF_PACKET socket address format. (GH-9207)
https://github.com/python/cpython/commit/cadb66e173ded86ebc85b54889db48f66e7af592


--

___
Python tracker 

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



[issue34641] Curiosity: f((a)=1) is not a syntax error -- why?

2018-09-11 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

I expect you'd have to make the check of test nodes in ast.c stricter. Here's a 
slightly gross implementation of that:

diff --git a/Python/ast.c b/Python/ast.c
index 94962e00c7..b7cebf4777 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -2815,15 +2815,22 @@ ast_for_call(struct compiling *c, const node *n, 
expr_ty func, bool allowgen)
 identifier key, tmp;
 int k;
 
-/* chch is test, but must be an identifier? */
-e = ast_for_expr(c, chch);
-if (!e)
+static const int chain[] = {test, or_test, and_test, not_test, 
comparison, expr, xor_expr, and_expr, shift_expr, arith_expr, term, factor, 
power, atom_expr, atom, 0};
+
+node *expr_node = chch;
+for (int i = 0; chain[i]; i++) {
+if (TYPE(expr_node) != chain[i])
+break;
+if (NCH(expr_node) != 1)
+break;
+expr_node = CHILD(expr_node, 0);
+}
+if (TYPE(expr_node) != NAME) {
+ast_error(c, chch,
+"keyword can't be an expression");
 return NULL;
-/* f(lambda x: x[0] = 3) ends up getting parsed with
- * LHS test = lambda x: x[0], and RHS test = 3.
- * SF bug 132313 points out that complaining about a keyword
- * then is very confusing.
- */
+}
+e = ast_for_expr(c, chch);
 if (e->kind == Lambda_kind) {
 ast_error(c, chch,
 "lambda cannot contain assignment");

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue34405] Upgrade to OpenSSL 1.1.0i / 1.0.2p

2018-09-11 Thread Ned Deily


Change by Ned Deily :


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



[issue34405] Upgrade to OpenSSL 1.1.0i / 1.0.2p

2018-09-11 Thread miss-islington


miss-islington  added the comment:


New changeset e351fe241c1fcb8cd739b08e21d2bb2f2b4c8c89 by Miss Islington (bot) 
(Steve Dower) in branch '2.7':
[2.7] bpo-34405: Updated to OpenSSL 1.0.2p for Windows builds. (GH-8776) 
(GH-9202)
https://github.com/python/cpython/commit/e351fe241c1fcb8cd739b08e21d2bb2f2b4c8c89


--

___
Python tracker 

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



[issue1621] Do not assume signed integer overflow behavior

2018-09-11 Thread Jeffrey Walton


Jeffrey Walton  added the comment:

On Tue, Sep 11, 2018 at 8:26 PM, STINNER Victor  wrote:
>
> STINNER Victor  added the comment:
>
>> newsize <<= 1; // The largest possible value is PY_SSIZE_T_MAX + 1.
>
> Previously, there was a explicitly check for error raising  PyErr_NoMemory() 
> on overflow. Now you rely on PyMem_Malloc() to detect the overflow. I'm not 
> sure that it's a good idea.

+1. It will probably work as expected on Solaris and other OSes that
don't oversubscribe memory. It will probably fail in unexpected ways
on Linux when the allocation succeeds but then the OOM killer hits a
random process.

Jeff

--

___
Python tracker 

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



[issue25041] document AF_PACKET socket address format

2018-09-11 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
pull_requests: +8643

___
Python tracker 

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



[issue34637] Make *start* usable as a keyword argument for sum().

2018-09-11 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue25041] document AF_PACKET socket address format

2018-09-11 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
pull_requests: +8641

___
Python tracker 

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



[issue25041] document AF_PACKET socket address format

2018-09-11 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 731ff68eeef58babdf2b32dc9a73b141760c2be9 by Benjamin Peterson 
(Cheryl Sabella) in branch 'master':
closes bpo-25041: Document AF_PACKET socket address format. (GH-4092)
https://github.com/python/cpython/commit/731ff68eeef58babdf2b32dc9a73b141760c2be9


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



[issue34641] Curiosity: f((a)=1) is not a syntax error -- why?

2018-09-11 Thread Guido van Rossum


New submission from Guido van Rossum :

Emily and I just discovered that f((a)=1) is accepted and compiled the same as 
f(a=1). This goes against the intention that keyword arguments have the syntax 
f(NAME=expr).

I suspect that this behavior was introduced at the time we switched from 
generating from the (concrete) parse tree to first converting to an ast and 
then generating code from there. I.e. in the distant past (long before 2.7 
even).

But I still think it ought to be fixed. Thoughts? Anyone have an idea *where* 
to fix it?

--
messages: 325107
nosy: emilyemorehouse, gvanrossum
priority: normal
severity: normal
status: open
title: Curiosity: f((a)=1) is not a syntax error -- why?
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



[issue34640] remove the configure check TANH_PRESERVES_ZERO_SIGN

2018-09-11 Thread Benjamin Peterson


Change by Benjamin Peterson :


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

___
Python tracker 

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



[issue34640] remove the configure check TANH_PRESERVES_ZERO_SIGN

2018-09-11 Thread Benjamin Peterson


New submission from Benjamin Peterson :

configure.ac currently has to check for a bug in FreeBSD 6.2:

# On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
# -0. on some architectures.
AC_MSG_CHECKING(whether tanh preserves the sign of zero)
...

FreeBSD 6.2 is nearing 12 years old. It looks like the FreeBSD 10 bot is 
passing this check. So, I think we should remove this configure check.

--
messages: 325106
nosy: benjamin.peterson, mark.dickinson
priority: normal
severity: normal
status: open
title: remove the configure check TANH_PRESERVES_ZERO_SIGN

___
Python tracker 

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



[issue1621] Do not assume signed integer overflow behavior

2018-09-11 Thread STINNER Victor


STINNER Victor  added the comment:

> newsize <<= 1; // The largest possible value is PY_SSIZE_T_MAX + 1. 

Previously, there was a explicitly check for error raising  PyErr_NoMemory() on 
overflow. Now you rely on PyMem_Malloc() to detect the overflow. I'm not sure 
that it's a good idea.

--

___
Python tracker 

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



[issue31903] `_scproxy` calls SystemConfiguration functions in a way that can cause deadlocks

2018-09-11 Thread Ned Deily


Ned Deily  added the comment:

Thanks, Benjamin!

Ronald, do you think this should be backported?

--

___
Python tracker 

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



[issue34636] re module microoptimization: speed up bytes \w \s \d matching

2018-09-11 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
resolution:  -> fixed
stage:  -> commit review
status: open -> closed

___
Python tracker 

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



[issue34637] Make *start* usable as a keyword argument for sum().

2018-09-11 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

I suggest also allowing the first argument to be a keyword named sequence= as 
well.  (along the philosophy of positional only arguments on APIs that happen 
to be implemented in C in CPython are a bad legacy)

pypy already uses these names:
 
https://bitbucket.org/pypy/pypy/src/4cbeaa8bf545332c36ae277019772aa432693e4c/pypy/module/__builtin__/app_functional.py?at=default=file-view-default#app_functional.py-41

--

___
Python tracker 

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



[issue34405] Upgrade to OpenSSL 1.1.0i / 1.0.2p

2018-09-11 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +8639

___
Python tracker 

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



[issue33649] asyncio docs overhaul

2018-09-11 Thread Yury Selivanov


Yury Selivanov  added the comment:


New changeset 8be876e44b2dffb96b551029454cbfb16d697992 by Yury Selivanov in 
branch 'master':
bpo-33649: Cleanup asyncio/streams and asyncio/synchronization docs (GH-9192)
https://github.com/python/cpython/commit/8be876e44b2dffb96b551029454cbfb16d697992


--

___
Python tracker 

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



[issue34536] Enum._missing_ doesn't raise TypeError when a non-Enum object is a returned

2018-09-11 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch, patch, patch
pull_requests: +8636, 8637, 8638
stage:  -> patch review

___
Python tracker 

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



[issue34536] Enum._missing_ doesn't raise TypeError when a non-Enum object is a returned

2018-09-11 Thread Ethan Furman


Change by Ethan Furman :


--
keywords: +patch, patch
pull_requests: +8636, 8637
stage:  -> patch review

___
Python tracker 

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



[issue34536] Enum._missing_ doesn't raise TypeError when a non-Enum object is a returned

2018-09-11 Thread Ethan Furman


Change by Ethan Furman :


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

___
Python tracker 

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



[issue34637] Make *start* usable as a keyword argument for sum().

2018-09-11 Thread Steve Dower


Steve Dower  added the comment:

Woo! Thanks Raymond!

--
nosy: +steve.dower

___
Python tracker 

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



[issue34637] Make *start* usable as a keyword argument for sum().

2018-09-11 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

+1 agreed.

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue34405] Upgrade to OpenSSL 1.1.0i / 1.0.2p

2018-09-11 Thread miss-islington


miss-islington  added the comment:


New changeset aa02ab15aed9d0b70f619c186326594c0d50bdd6 by Miss Islington (bot) 
in branch '2.7':
[2.7] bpo-34405: Update to OpenSSL 1.0.2p for macOS installer builds (GH-9191) 
(GH-9196)
https://github.com/python/cpython/commit/aa02ab15aed9d0b70f619c186326594c0d50bdd6


--

___
Python tracker 

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



[issue34589] Py_Initialize() and Py_Main() should not enable C locale coercion

2018-09-11 Thread STINNER Victor

STINNER Victor  added the comment:

Example of C locale coercion with Python 3.7:

$ env -i PYTHONCOERCECLOCALE=0 ./python -X utf8=0 -c 'import sys; 
print(ascii(sys.argv[1]))' 'hé'
'h\udcc3\udca9'

$ env -i PYTHONCOERCECLOCALE=1 ./python -X utf8=0 -c 'import sys; 
print(ascii(sys.argv[1]))' 'hé'
'h\xe9'

It works as expected no? What's wrong with the current implementation according 
to you, Nick?

--

___
Python tracker 

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



[issue34589] Py_Initialize() and Py_Main() should not enable C locale coercion

2018-09-11 Thread STINNER Victor


STINNER Victor  added the comment:

> (...) The documentation could definitely be much clearer on that point 
> though, as even in the PEP it's only implied by the final paragraph in 
> https://www.python.org/dev/peps/pep-0538/#legacy-c-locale-coercion-in-the-standalone-python-interpreter-binary
>  which is mostly talking about the fact that this particular environment 
> variable is still checked, even if you pass the -I or -E command line options.

That's a separated issue: I created bpo-34639.

--

___
Python tracker 

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



[issue34638] Avoid circular references in asyncio streams

2018-09-11 Thread Andrew Svetlov


Change by Andrew Svetlov :


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

___
Python tracker 

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



[issue34639] PYTHONCOERCECLOCALE is ignored when using -E or -I option

2018-09-11 Thread STINNER Victor


New submission from STINNER Victor :

I modified Py_Main() to ignore the PYTHONCOERCECLOCALE environment variable if 
-E or -I command line option is used. But Nick asks to always read 
PYTHONCOERCECLOCALE.

We should either update the PEP or change the code.

I am not sure why PYTHONCOERCECLOCALE should be handled differently than other 
PYTHON* variable like PYTHONWARNINGS or PYTHONUTF8. Is it because it impacts 
the encodings? Is it because there was a chicken-and-egg issue before I 
reworked Py_Main() code? (PYTHONCOERCECLOCALE env var was read before reading 
command line arguments.)

--

Copy of Nick Coghlan's msg325009:

(The one exception to "nothing gets decoded incorrectly" is that 
PYTHONCOERCECLOCALE itself is always interpreted as an ASCII field: the values 
that it checks for are actually ASCII byte sequences, not Unicode code points.

The documentation could definitely be much clearer on that point though, as 
even in the PEP it's only implied by the final paragraph in 
https://www.python.org/dev/peps/pep-0538/#legacy-c-locale-coercion-in-the-standalone-python-interpreter-binary
 which is mostly talking about the fact that this particular environment 
variable is still checked, even if you pass the -I or -E command line options.

--
components: Interpreter Core
messages: 325096
nosy: vstinner
priority: normal
severity: normal
status: open
title: PYTHONCOERCECLOCALE is ignored when using -E or -I option
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



[issue34638] Avoid circular references in asyncio streams

2018-09-11 Thread Andrew Svetlov


New submission from Andrew Svetlov :

Now we have a cross-reference between asyncio stream reader and protocol.

It prevents objects deletion on ref-counting and requires a garbage collector 
run to destroy the stream.

--
components: asyncio
messages: 325095
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Avoid circular references in asyncio streams
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



[issue34605] Avoid master/slave terminology

2018-09-11 Thread miss-islington


miss-islington  added the comment:


New changeset fa7dfae3171914f91d629a64c6e829788b485b06 by Miss Islington (bot) 
(Victor Stinner) in branch 'master':
bpo-34605: Replace "pliant children" with "helpers" (GH-9195)
https://github.com/python/cpython/commit/fa7dfae3171914f91d629a64c6e829788b485b06


--
nosy: +miss-islington

___
Python tracker 

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



[issue34589] Py_Initialize() and Py_Main() should not enable C locale coercion

2018-09-11 Thread STINNER Victor


STINNER Victor  added the comment:

> (...) the locale should be coerced before *ANY* calls are made to 
> Py_DecodeLocale, as the whole point of the architecture of the PEP 
> implementation was to ensure that *nothing ever gets decoded incorrectly in 
> the first place*.

See my comment:
https://github.com/python/cpython/pull/9073#issuecomment-420461537

--

___
Python tracker 

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



[issue34637] Make *start* usable as a keyword argument for sum().

2018-09-11 Thread Raymond Hettinger


New submission from Raymond Hettinger :

Currently, we can write:

>>> sum(range(10), 50)
95

What we want to allow:

>>> sum(range(10), start=50)
95

The positional form would still be allowed.

--
assignee: rhettinger
components: Library (Lib)
messages: 325092
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Make *start* usable as a keyword argument for sum().
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



[issue1621] Do not assume signed integer overflow behavior

2018-09-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8633

___
Python tracker 

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



[issue1621] Do not assume signed integer overflow behavior

2018-09-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8634

___
Python tracker 

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



[issue1621] Do not assume signed integer overflow behavior

2018-09-11 Thread miss-islington


miss-islington  added the comment:


New changeset 6c7d67ce83a62b5f0fe5c53a6df602827451bf7f by Miss Islington (bot) 
(Sergey Fedoseev) in branch 'master':
bpo-1621: Avoid signed integer overflow in set_table_resize(). (GH-9059)
https://github.com/python/cpython/commit/6c7d67ce83a62b5f0fe5c53a6df602827451bf7f


--
nosy: +miss-islington

___
Python tracker 

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



[issue31903] `_scproxy` calls SystemConfiguration functions in a way that can cause deadlocks

2018-09-11 Thread Benjamin Peterson

Benjamin Peterson  added the comment:


New changeset 4859ba0d2ce4506fddc3f55f90f8dce031b3804f by Benjamin Peterson 
(Max Bélanger) in branch 'master':
closes bpo-31903: Release the GIL when calling into SystemConfiguration 
(GH-4178)
https://github.com/python/cpython/commit/4859ba0d2ce4506fddc3f55f90f8dce031b3804f


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



[issue30576] http.server should support HTTP compression (gzip)

2018-09-11 Thread Brett Cannon


Brett Cannon  added the comment:

I'm agreeing with all the other core devs (other than Victor ;) that I don't 
quite think this should go in. While I appreciate the work Pierre put into the 
PR, I just can't find myself to want to deal with future bug reports for this 
while http.server is meant for really simple testing scenarios.

My suggestion would be to toss it up on PyPI and if there is major uptake then 
we can revisit this, but right now I just don't think the long-term support 
costs are worth the benefit the new feature brings.

--
nosy: +brett.cannon
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



[issue26832] ProactorEventLoop doesn't support stdin/stdout nor files with connect_read_pipe/connect_write_pipe

2018-09-11 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue32236] open() shouldn't silently ignore buffering=1 in binary mode

2018-09-11 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

Thank you, Gregory. I didn't intend to add the warning to stable branches -- 
it's just that 3.7 hasn't been released yet when this report was submitted.

--

___
Python tracker 

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



[issue32270] subprocess closes redirected fds even if they are in pass_fds

2018-09-11 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

Thank you, Gregory!

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



[issue34636] re module microoptimization: speed up bytes \w \s \d matching

2018-09-11 Thread miss-islington


miss-islington  added the comment:


New changeset ec014a101a7f6243b95dfc08acfe1542b9fa5d39 by Miss Islington (bot) 
(Sergey Fedoseev) in branch 'master':
bpo-34636: Use fast path for more chars in SRE category macros. (GH-9170)
https://github.com/python/cpython/commit/ec014a101a7f6243b95dfc08acfe1542b9fa5d39


--
nosy: +miss-islington

___
Python tracker 

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



[issue34405] Upgrade to OpenSSL 1.1.0i / 1.0.2p

2018-09-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8632

___
Python tracker 

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



[issue34405] Upgrade to OpenSSL 1.1.0i / 1.0.2p

2018-09-11 Thread Ned Deily


Ned Deily  added the comment:


New changeset 31912b43c903aafad09350899ed6a9dec7c43421 by Ned Deily in branch 
'3.6':
bpo-34405: Update to OpenSSL 1.0.2p for macOS installer builds (GH-9191)
https://github.com/python/cpython/commit/31912b43c903aafad09350899ed6a9dec7c43421


--

___
Python tracker 

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



[issue34633] Simplify __reduce__ for ordered dict iterators

2018-09-11 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue34605] Avoid master/slave terminology

2018-09-11 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +8631

___
Python tracker 

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



[issue26832] ProactorEventLoop doesn't support stdin/stdout nor files with connect_read_pipe/connect_write_pipe

2018-09-11 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue34579] test_embed.InitConfigTests fail on AIX

2018-09-11 Thread STINNER Victor


STINNER Victor  added the comment:

Hum, you should run "env -i ./Programs/_testembed init_default_config" to run 
the program in an empty environment. test_embed modifies os.environ to remove 
all PYTHON* env vars.

--

___
Python tracker 

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



[issue29051] Improve error reporting involving f-strings (PEP 498)

2018-09-11 Thread Eric V. Smith


Eric V. Smith  added the comment:

Because this issue describes two different problems, I'm going to close it.

The part of it that involves errors during the evaluation of a syntactically 
valid expression was at least partially fixed in #30465. I will probably 
re-work how this fix was implemented.

I'm working on the syntax error part of it in #34364.

--
dependencies:  -Tracebacks should contain the first line of continuation lines
resolution:  -> duplicate
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



[issue34579] test_embed.InitConfigTests fail on AIX

2018-09-11 Thread STINNER Victor


STINNER Victor  added the comment:

What is the output of "./Programs/_testembed init_default_config"?

--

___
Python tracker 

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



[issue34595] PyUnicode_FromFormat(): add %T format for an object type name

2018-09-11 Thread STINNER Victor


STINNER Victor  added the comment:

Petr Viktorin asked me to open a wider discussion about this issue on 
python-dev. I just reverted my first change and posted:
https://mail.python.org/pipermail/python-dev/2018-September/155150.html

--

___
Python tracker 

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



[issue34595] PyUnicode_FromFormat(): add %T format for an object type name

2018-09-11 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 998b80636690ffbdb0a278810d9c031fad38631d by Victor Stinner in 
branch 'master':
Revert "bpo-34595: Add %T format to PyUnicode_FromFormatV() (GH-9080)" (GH-9187)
https://github.com/python/cpython/commit/998b80636690ffbdb0a278810d9c031fad38631d


--

___
Python tracker 

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



[issue31902] Fix col_offset for ast nodes: AsyncFor, AsyncFunctionDef, AsyncWith

2018-09-11 Thread miss-islington


miss-islington  added the comment:


New changeset d8bc7a666b1309aa5669980e35e7429071f3f7d3 by Miss Islington (bot) 
in branch '3.7':
closes bpo-31902: Fix the col_offset attribute for ast.Async* nodes to point to 
the "async" keyword. (GH-4175)
https://github.com/python/cpython/commit/d8bc7a666b1309aa5669980e35e7429071f3f7d3


--

___
Python tracker 

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



[issue33649] asyncio docs overhaul

2018-09-11 Thread Yury Selivanov


Change by Yury Selivanov :


--
pull_requests: +8630

___
Python tracker 

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



[issue34405] Upgrade to OpenSSL 1.1.0i / 1.0.2p

2018-09-11 Thread Ned Deily


Change by Ned Deily :


--
pull_requests: +8629

___
Python tracker 

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



[issue32055] Reconsider comparison chaining for containment tests

2018-09-11 Thread Guido van Rossum


Guido van Rossum  added the comment:

I agree that it would be less confusing if `in`/`not in` did not allow 
chaining, the occasional (surely very rare) useful example notwithstanding.

Then again if we're going to forbid (or even discourage) unusual combinations 
we might also want to frown at `a < b > c` -- surely in mathematical circles 
the chaining always goes in one direction only, e.g. `a < b <= c` or `a >= b 
==c > d`.

Finally as long as we're refining the terminology, maybe we could strive to 
distinguish "comparison" (`==` and `!=`) from "ordering" (`<`, `<=`, `>`, `>=`)?

--
nosy: +gvanrossum

___
Python tracker 

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



[issue33714] module can set an exception in tp_clear

2018-09-11 Thread Petr Viktorin


Petr Viktorin  added the comment:

I'm not sure what tp_clear should do in this situation.
Other than propagating the exception to the GC, the most reasonable behavior 
seems to be to write the exception to stderr and ignore it -- but I think 
having the GC do that would be more robust.

IOW, I think raising an exception from tp_clear is reasonable, and if that 
caused (causes?) a crash, it's a bug.

--

___
Python tracker 

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



[issue24412] setUpClass equivalent for addCleanup

2018-09-11 Thread Lisa Roach


Change by Lisa Roach :


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



[issue34636] re module microoptimization: speed up bytes \w \s \d matching

2018-09-11 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Confirming the microoptimization here with a non-debug (opt) build:

~/oss/cpython$ sre-before/python -m timeit -s "import re; s = (b'~' * 100); 
f = re.compile(b'\s\w\d').search" "f(s)"
20 loops, best of 5: 11 msec per loop
~/oss/cpython$ sre-after/python -m timeit -s "import re; s = (b'~' * 100); 
f = re.compile(b'\s\w\d').search" "f(s)"
20 loops, best of 5: 10.1 msec per loop

Those results are consistent across reruns.

--

___
Python tracker 

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



[issue34636] re module microoptimization: speed up bytes \w \s \d matching

2018-09-11 Thread Gregory P. Smith


New submission from Gregory P. Smith :

filing this issue to track https://github.com/python/cpython/pull/9170

--
assignee: gregory.p.smith
messages: 325073
nosy: gregory.p.smith
priority: normal
pull_requests: 8627
severity: normal
status: open
title: re module microoptimization: speed up bytes \w \s \d matching
type: performance
versions: Python 3.8

___
Python tracker 

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



[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2018-09-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset c4bccd3c7617018b1ce16f95840ffe1a890d44df by Raymond Hettinger 
(Tal Einat) in branch 'master':
bpo-20180: convert most of itertoolsmodule.c to use Argument Clinic (GH-9164)
https://github.com/python/cpython/commit/c4bccd3c7617018b1ce16f95840ffe1a890d44df


--

___
Python tracker 

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



[issue31902] Fix col_offset for ast nodes: AsyncFor, AsyncFunctionDef, AsyncWith

2018-09-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8626

___
Python tracker 

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



[issue31902] Fix col_offset for ast nodes: AsyncFor, AsyncFunctionDef, AsyncWith

2018-09-11 Thread miss-islington


New submission from miss-islington :


New changeset 90fc8980bbcc5c7dcced3627fe172b0bfd193a3b by Miss Islington (bot) 
(guoci) in branch 'master':
closes bpo-31902: Fix the col_offset attribute for ast.Async* nodes to point to 
the "async" keyword. (GH-4175)
https://github.com/python/cpython/commit/90fc8980bbcc5c7dcced3627fe172b0bfd193a3b


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



[issue34595] PyUnicode_FromFormat(): add %T format for an object type name

2018-09-11 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +8625

___
Python tracker 

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



[issue34633] Simplify __reduce__ for ordered dict iterators

2018-09-11 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
title: Simplify __reduce__ for ordered dict. -> Simplify __reduce__ for ordered 
dict iterators

___
Python tracker 

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



[issue26979] The danger of PyType_FromSpec()

2018-09-11 Thread Petr Viktorin


Petr Viktorin  added the comment:

Christian, do you have a specific example of the default tp_dealloc doing the 
wrong thing?

--

___
Python tracker 

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



[issue34635] inspect: add tools for inspecting subclasses

2018-09-11 Thread Zachary Ware


Change by Zachary Ware :


--
nosy: +yselivanov

___
Python tracker 

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



[issue34538] Remove encouragement to author a base class for all Exception subclasses in a module

2018-09-11 Thread Nathaniel Manista

Nathaniel Manista  added the comment:

I’d like to try to steer this conversation back toward what I think is the 
actionable question: “does the exemplification of this practice in the Errors 
and Exceptions portion of The Python Tutorial bring about a net benefit or a 
net cost to its intended audience?”.

What is the benefit? It is that when an author happens to be authoring a module 
*all user-defined Exception subclasses of which satisfy some 
more-specific-than-Exception type* the author is led to define an intermediate 
class between Exception and the directly-used user-defined Exception subclasses 
capturing that type in a usable code element.

What readers of the tutorial enjoy this benefit? Pretty much only those authors 
(who happen to be authoring a module *all user-defined Exception subclasses of 
which satisfy some more-specific-than-Exception type*) who are still learning 
about classes and inheritance. That’s a doubly slim population, isn’t it? Maybe 
also those who kind of know, but aren’t so sure and could use some 
reinforcement from seeing in the tutorial something that they independently did 
on their own in their own code. I wouldn’t think that authors who already know 
with confidence and from experience about classes and inheritance would benefit 
from the example in the tutorial, so “In my experience as a teacher, the 
possibility doesn't usually occur to people without it having been suggested” 
comes as a surprise to me. But… okay, them too - but again, only when they 
happen to be authoring a module *all user-defined Exception subclasses of which 
satisfy some more-specific-than-Exception type*.

What is the cost? It is that when an author happens to be authoring a module 
that does *not* have the property that all user-defined Exception subclasses 
satisfy some more-specific-than-Exception type, the common intermediate class 
is just bloat. It’s noise disrupting the signal. It undermines the API design 
advice “when in doubt, leave it out”. It unnecessarily widens the module’s API. 
It undermines the API design advice “classes are the most complex kind of code 
element in common use so they have the highest value proposition to satisfy to 
justify their existence”. It violates the Liskov Substitution Principle. Maybe 
most importantly, it obscures other relationships among the user-defined 
Exception subclasses in the module such as a superclass shared by 
some-but-not-all of the module’s user-defined Exception subclasses, if such 
other relationships exist.

What readers of the tutorial pay this cost? Those who are still learning the 
language. And those who are following pattern and convention - note that the 
tutorial contains only one example of user-defined Exception subclasses, and… 
an unfortunate fact of life of tutorials is that readers are invited to 
generalize from single examples. And, as I think we’ve seen in this 
conversation, those who just picked up the practice at one point and have kept 
it going.

The Exception subclass hierarchy of sqlite3 that was mentioned earlier in this 
conversation demonstrates exactly this bloat and misapplication - there’s 
Warning, which is a direct subclass of Exception, and there’s Error, which is 
also a direct subclass of Exception and has the erroneous specification “The 
base class of the other exceptions in this module”, and there’s DatabaseError, 
which is a subclass of Error, and then there are IntegrityError, 
ProgrammingError, OperationalError, and NotSupportedError, which inherit from 
DatabaseError. What’s the use of Error? There are no code elements in the 
module specified as raising Error. There’s example code in the module showing 
“except sqlite3.Error”, but why shouldn’t that be “except 
sqlite3.DatabaseError”?

It’s a red herring is that the practice appears widely applied in existing 
Python code - well of course; it’s been exemplified in the tutorial for 
seventeen years! :-P

One last thing to consider: look at the example specifically - InputError and 
TransitionError. There’s no elsewhere-in-the-module example code showing a 
function that has “Error” in its “Raises:” specification and could raise either 
an InputError or a TransitionError, and there’s no outside-of-the-module 
example code showing a user of the module calling a module function and saving 
duplicated lines of code because they want to respond to InputErrors and 
TransitionErrors in exactly the same way.

We should remove the “Base class for exceptions in this module” Error class 
from the tutorial’s example because it just isn’t beneficial enough, in enough 
applicable modules, to enough authors, and it’s more than costly enough, in 
enough modules to which it doesn’t apply, and to enough authors, even just as 
noise and API bloat. I don’t know that this could have been calculated from 
first principles seventeen years ago; I think perhaps it took the experience of 
having the guidance out there, so rarely merited and so widely 

[issue34635] inspect: add tools for inspecting subclasses

2018-09-11 Thread Benjamin Mintz


Change by Benjamin Mintz :


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

___
Python tracker 

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



[issue34635] inspect: add tools for inspecting subclasses

2018-09-11 Thread Benjamin Mintz


New submission from Benjamin Mintz :

Adds inspect.getsubclasses, inspect.getallsubclasses (recursive), and 
inspect.getsubclasstree (recursive, maintains structure).

See documentation for more details.

--
components: Library (Lib)
messages: 325068
nosy: bmintz
priority: normal
severity: normal
status: open
title: inspect: add tools for inspecting subclasses
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



[issue34365] datetime's documentation refers to "comparison [...] falling back to the default scheme of comparing object addresses"

2018-09-11 Thread miss-islington


miss-islington  added the comment:


New changeset 8a2c2d4e1b6b46a9a982e5c064ca4399ec28d55d by Miss Islington (bot) 
in branch '3.6':
bpo-34365: Update date object documentation (GH-8814)
https://github.com/python/cpython/commit/8a2c2d4e1b6b46a9a982e5c064ca4399ec28d55d


--

___
Python tracker 

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



[issue34365] datetime's documentation refers to "comparison [...] falling back to the default scheme of comparing object addresses"

2018-09-11 Thread miss-islington


miss-islington  added the comment:


New changeset e2b40f4ce954ea3d35a73541029b2253abd9d245 by Miss Islington (bot) 
in branch '3.7':
bpo-34365: Update date object documentation (GH-8814)
https://github.com/python/cpython/commit/e2b40f4ce954ea3d35a73541029b2253abd9d245


--

___
Python tracker 

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



[issue34633] Simplify __reduce__ for ordered dict.

2018-09-11 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue34634] New asyncio streams API

2018-09-11 Thread Andrew Svetlov


Change by Andrew Svetlov :


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

___
Python tracker 

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



[issue34409] Add a way to customize iteration over fields in asdict() for the nested dataclasses

2018-09-11 Thread mkurnikov


mkurnikov  added the comment:

Cleanest thing I could think of is:

1. Extract dataclass_to_dict function from _asdict_inner as:

def dataclass_asdict(obj, dict_factory):
result = []
for f in fields(obj):
value = _asdict_inner(getattr(obj, f.name), dict_factory)
result.append((f.name, value))
return dict_factory(result)

2. Add "asdict" parameter to the dataclass decorator (with default value of 
dataclass_to_dict function)

@dataclass(asdict=specific_dcls_dict_factory)
class MyDataclass:
pass

3. Change check to 

def _asdict_inner(obj, dict_factory):
if _is_dataclass_instance(obj):
return getattr(obj, _PARAMS).asdict(obj) 

# ... other code


Other solution could be to add parameter "directly_serializable"(smth like 
that), add check for this parameter

def _asdict_inner(obj, dict_factory):
if _is_dataclass_instance(obj):
if getattr(obj, _PARAMS).directly_serializable: 
return dict_factory(obj)

# ... other code

and force user to process everything in dict_factory function.

--

___
Python tracker 

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



[issue34634] New asyncio streams API

2018-09-11 Thread Andrew Svetlov


New submission from Andrew Svetlov :

Currently, we have separate classes: reader and writer.

It is very inconvenient: these classes are tightly coupled internally, there is 
no sense to have two objects to the single logical entity.

The second problem is `writer.write()` synchronous API. To support flow control 
user should call `await writer.drain()` after every `writer.write()` call. But 
he/she can forget about drain() easy.

`writer.write()` should be softly deprecated in favor of `await writer.send()`. 
`writer.writelines()` is not very useful, better to merge all buffers before 
`await stream.send(data)` call. `writelines` should be softly deprecated as 
well without async replacement.

The last issue is `writer.close()` which should always be used in conjunction 
with `await writer.wait_closed()`. Let's return a future from `writer.close()`. 
The encouraged usage becomes `await writer.close()`. 
To immediate closing let's add `writer.abort()` sync function which cleans up 
resources without waiting for actual closing.

--
messages: 325064
nosy: asvetlov
priority: normal
severity: normal
status: open
title: New asyncio streams API

___
Python tracker 

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



[issue34633] Simplify __reduce__ for ordered dict.

2018-09-11 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

The code for __reduce__ in ordered dictionaries can be simplified in the 
similar way issue34573 is treating dict and set objects.

--
components: Interpreter Core
messages: 325063
nosy: pablogsal
priority: normal
severity: normal
status: open
title: Simplify __reduce__ for ordered dict.
type: performance
versions: Python 3.8

___
Python tracker 

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



[issue34365] datetime's documentation refers to "comparison [...] falling back to the default scheme of comparing object addresses"

2018-09-11 Thread Mariatta Wijaya


Mariatta Wijaya  added the comment:

Thanks!

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



[issue26979] The danger of PyType_FromSpec()

2018-09-11 Thread Petr Viktorin


Petr Viktorin  added the comment:

I don't think PEP 384 should be updated. It documents the feature as it was 
added, and shouldn't be used as documentation now.
Instead, Python documentation should be improved to cover all of PEP 389.
I submitted a pull request for that (GH-9154).

For this issue, the fix should be updating C API documentation and, for Pyhon 
3.8+, making {*, NULL} slots override the inherited value.

I think the PyType_Spec/PyType_Slot copying should have its own issue.

--

___
Python tracker 

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



[issue34365] datetime's documentation refers to "comparison [...] falling back to the default scheme of comparing object addresses"

2018-09-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8620

___
Python tracker 

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



[issue34365] datetime's documentation refers to "comparison [...] falling back to the default scheme of comparing object addresses"

2018-09-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8619

___
Python tracker 

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



[issue34365] datetime's documentation refers to "comparison [...] falling back to the default scheme of comparing object addresses"

2018-09-11 Thread miss-islington


miss-islington  added the comment:


New changeset 9c223794c754408644c16349b85dd27fdba8a926 by Miss Islington (bot) 
(Danish Prakash) in branch 'master':
bpo-34365: Update date object documentation (GH-8814)
https://github.com/python/cpython/commit/9c223794c754408644c16349b85dd27fdba8a926


--
nosy: +miss-islington

___
Python tracker 

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



[issue15727] PyType_FromSpecWithBases tp_new bugfix

2018-09-11 Thread Petr Viktorin


Petr Viktorin  added the comment:

Converting static types to heap ones is just one of the reasons to use 
PyType_FromSpec*. Another ones are writing such classes from scratch, and 
converting pure-Python classes to C. I don't think PyObject_FailingNew is a 
good default for either of those.

I think Sehriy's solution in bpo-26979 is better: document this, and allow 
setting a slot to NULL explicitly.

--

___
Python tracker 

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



[issue32502] uuid1() fails if only 64-bit interface addresses are available

2018-09-11 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset d919c60e6936f853ad15040017f2c0bce0f027f8 by Benjamin Peterson 
(Chih-Hsuan Yen) in branch '2.7':
[2.7] bpo-32502: Discard 64-bit (and other invalid) hardware addresses (GH-9125)
https://github.com/python/cpython/commit/d919c60e6936f853ad15040017f2c0bce0f027f8


--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue31608] crash in methods of a subclass of _collections.deque with a bad __new__()

2018-09-11 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 253279c616d4f34287c5749df15e20eb2eb988d6 by Benjamin Peterson in 
branch '2.7':
[2.7] closes bpo-31608: Fix a crash in methods of a subclass of 
_collections.deque with a bad __new__(). (GH-9179)
https://github.com/python/cpython/commit/253279c616d4f34287c5749df15e20eb2eb988d6


--

___
Python tracker 

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



[issue34586] collections.ChainMap should have a get_where method

2018-09-11 Thread Zahari Dim


Zahari Dim  added the comment:

>
> I've discussed this with other core devs and spent a good deal of time 
> evaluating this proposal.  I'm going to pass on the this one but do think it 
> was a inspired suggestion.  Thank you for the proposal.

Thank you for taking the time to consider it. I understand that there
are many proposals.

>
> --
>
> Note, the original get_where() recipe has an issue.  Upon successful lookup, 
> it returns a 2-tuple but on failure it calls __missing__ which typically 
> returns a scalar (if it doesn't raise an exception).

FWIW this was intended to work when `__missing__` was subclassed to
raise a more specific exception. The case where it is made to return a
value clearly doesn't play well with the proposed method, and would
likely need to be subclassed as well. I consider this an acceptable
trade off because I find this use case rather esoteric: the same
functionality could be achieved in an arguably clearer way by passing
a mapping with the desired missing semantics as the outermost scope.

--

___
Python tracker 

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



[issue31608] crash in methods of a subclass of _collections.deque with a bad __new__()

2018-09-11 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset ccbbdd0a1e00ecad6f0005438dd6ff6d84fd9ceb by Benjamin Peterson in 
branch '3.6':
[3.6] closes bpo-31608: Fix a crash in methods of a subclass of 
_collections.deque with a bad __new__(). (GH-9178)
https://github.com/python/cpython/commit/ccbbdd0a1e00ecad6f0005438dd6ff6d84fd9ceb


--

___
Python tracker 

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



  1   2   >