[issue34397] remove redundant overflow checks in tuple and list implementations

2019-01-24 Thread Windson Yang


Windson Yang  added the comment:

I reviewed the patch months ago, maybe we need a core developer review this 
path?

--

___
Python tracker 

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



[issue35823] Use vfork() in subprocess on Linux

2019-01-24 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Issue #34663 contains some earlier discussion about vfork, in the context of 
supporting a specific posix_spawn flag on Linux.

W.r.t. closing all file descriptors > 2: posix_spawn_file_actions_addclose can 
do this when using posix_spawn. That would have a performance cost, you'd 
basically have to resort to closing all possible file descriptors and cannot 
use the smarter logic used in _posixsubprocess. However, the smarter closing 
code in _posixsubprocess is not safe w.r.t. vfork according to the comment 
above _close_open_fds_maybe_unsafe: that function uses some functions that 
aren't async-safe and one of those calls malloc.

--
nosy: +ronaldoussoren

___
Python tracker 

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



[issue35666] Update design FAQ about assignment expression

2019-01-24 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Ah sorry I think this could be a duplicate of issue34237 where you have added 
an update.

--

___
Python tracker 

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



[issue35666] Update design FAQ about assignment expression

2019-01-24 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

> I believe a spot where assignment expressions are explicitly mentioned as not 
> being included in the language, which is no longer the case

Emily, I guess you were referring to this issue in 
https://bugs.python.org/issue35224#msg334331 . Now that PEP 572 implementation 
is merged this can be updated.

Thanks

--
nosy: +emilyemorehouse, xtreak

___
Python tracker 

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



[issue35821] Clarify when logging events are propagated when propagate is true

2019-01-24 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

Thanks for the diagram. How about the following as a replacement?

"If this attribute is true and the event isn't rejected by the logger's level 
and filters, an event passed to this logger will recursively be passed to its 
parent logger and handled by the parent logger's handlers (after being handled 
by the original logger's handlers). The logger level and filters only come into 
play for the very first logger in this chain. For subsequent loggers, only the 
propagate attribute determines whether the event is passed to the parent."

--

___
Python tracker 

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



[issue35224] PEP 572: Assignment Expressions

2019-01-24 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

I don't know if this is the correct issue for questions/clarifications but it 
seems parens are mandatory while using named expressions in while statement 
which makes some of the examples invalid like 
https://www.python.org/dev/peps/pep-0572/#sysconfig-py . From my limited 
knowledge while statement Grammar was not modified at 
https://github.com/python/cpython/pull/10497/files#diff-cb0b9d6312c0d67f6d4aa1966766ceddR73
 and no tests for while statement which made me assume it's intentional. I 
haven't followed the full discussion about PEP 572 so feel free to correct me 
if it's a conscious decision and in that case the PEP 572 can be updated.

# python info

➜  cpython git:(master) ./python.exe
Python 3.8.0a0 (heads/bpo35113-dirty:49329a217e, Jan 25 2019, 09:57:53)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

# Example as in PEP 572 to create a simple file that reads itself and prints 
lines that matches "foo"

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

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

# Wrapping named expression with parens for while makes this valid

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

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


As a user I think parens shouldn't be mandatory in while statement since if 
statement works fine. Parens can cause while statement to be superfluous in 
some cases and an extra case to remember while teaching.

--

___
Python tracker 

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



[issue35821] Clarify when logging events are propagated when propagate is true

2019-01-24 Thread Vinay Sajip


Vinay Sajip  added the comment:

I believe the information is clear from this link in the documentation:

https://docs.python.org/3/howto/logging.html#logging-flow

However, if you can suggest alternative wording which you think is clearer, 
I'll certainly take a look at it. Perhaps a link could be added to this section 
from the logging.Logger.propagate section.

--

___
Python tracker 

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



[issue35824] http.cookies._CookiePattern modifying regular expressions

2019-01-24 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks for the MDN cookie directive link. I didn't know it links to Date link 
in the GitHub PR. I don't see space optional in the sane-date format specified 
for expires attribute. I could be reading the grammar wrong. I will wait for 
others thoughts on this.

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



[issue35824] http.cookies._CookiePattern modifying regular expressions

2019-01-24 Thread MeiK


New submission from MeiK :

http.cookies.BaseCookie[1] can't parse Expires in this format like 
Expires=Thu,31 Jan 2019 05:56:00 GMT;(Less space after Thu,).

I encountered this problem in actual use, Chrome, IE and Firefox can parse this 
string normally. Many languages, such as JavaScript, can also parse this data 
automatically.

I built a test site using Flask: https://paste.ubuntu.com/p/K7Z4K4KH7Z/, Use 
curl and requests to get cookies correctly, but not with aiohttp (because it 
uses http.cookies.BaseCookie).

Looking at MDN[2] and rfc[3](Thanks tirkarthi), this doesn't seem to be a 
canonical behavior, But some Java WEB frameworks will produce this behavior 
(such as the one that caused me to find the problem).

This problem can be solved by modifying a regular expression[4], but I don't 
know if it should be compatible with this non-standard way of writing.

English is not my native language; please excuse typing errors.


[1] https://github.com/python/cpython/blob/master/Lib/http/cookies.py#L457
[2] 
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#Directives
[3] https://tools.ietf.org/html/rfc6265#section-4.1.1
[4] https://github.com/python/cpython/blob/master/Lib/http/cookies.py#L444

--

___
Python tracker 

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



[issue35824] http.cookies._CookiePattern modifying regular expressions

2019-01-24 Thread MeiK


Change by MeiK :


--
components: Extension Modules
nosy: MeiK
priority: normal
severity: normal
status: open
title: http.cookies._CookiePattern modifying regular expressions
type: enhancement

___
Python tracker 

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



[issue35814] Syntax quirk with variable annotations

2019-01-24 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8 -Python 3.7

___
Python tracker 

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



[issue35537] use os.posix_spawn in subprocess

2019-01-24 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

> Is sys.platform equal to 'linux' on WSL? Sorry, I don't know WSL. If it's 
> equal, is it possible to explicitly exclude WSL in the subprocess test, 
> _use_posix_spawn()?

I don't have immediate access to WSL right now, but I'll try to get one and 
investigate what we have there wrt. posix_spawn() and vfork().

> So the bug only affects "QEMU User Space". I never used that before. 

Yes, I was specifically referring to QEMU user-space. One use case that heavily 
relies on it is Tizen. Its packages are built in a chroot jail containing the 
build environment with binaries native to the target architecture, making an 
illusion that packages are built on the target system and are not 
cross-compiled. So the binaries are run under QEMU user-space emulation. But in 
reality, because of unacceptable performance of binary translation, many 
frequently-used binaries, like coreutils and compilers, are replaced with 
host-native binaries in a way transparent to the build system (so it has no 
idea whether it runs host-native or target-native binaries).

> Does the difference matters? The bug only occurs in some very specific cases:

> * WSL
> * QEMU User Emulation

> Are these use cases common enough to block the whole idea of using 
> posix_spawn() on Linux. I don't think so. I really want to use posix_spawn() 
> for best performances! Moreover, I expect that glibc implementation of 
> posix_spawn() is safer than Python _posixsubprocess. The glibc has access to 
> low-level stuff like it's internal signals, cancellation points, etc. 
> _posixsubprocess is more generic and doesn't worry about such low-level 
> stuff, whereas they might cause bad surprised.

It's true that a C library is in a better position to implement something like 
posix_spawn(), but I still think that vfork()/exec() is worth to consider at 
least on Linux. See bpo-35823, which should also work under QEMU user-mode and 
WSL (but needs testing).

--

___
Python tracker 

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



[issue35823] Use vfork() in subprocess on Linux

2019-01-24 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


--
keywords: +patch, patch
pull_requests: +11484, 11485
stage:  -> patch review

___
Python tracker 

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



[issue35823] Use vfork() in subprocess on Linux

2019-01-24 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


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

___
Python tracker 

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



[issue35823] Use vfork() in subprocess on Linux

2019-01-24 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


--
keywords: +patch, patch, patch
pull_requests: +11484, 11485, 11486
stage:  -> patch review

___
Python tracker 

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



[issue35823] Use vfork() in subprocess on Linux

2019-01-24 Thread Alexey Izbyshev


New submission from Alexey Izbyshev :

This issue is to propose a (complementary) alternative to the usage of 
posix_spawn() in subprocess (see bpo-35537).

As mentioned by Victor Stinner in msg332236, posix_spawn() has the potential of 
being faster and safer than fork()/exec() approach. However, some of the 
currently available implementations of posix_spawn() have technical problems 
(this mostly summarizes discussions in bpo-35537):

* In glibc < 2.24 on Linux, posix_spawn() doesn't report errors to the parent 
properly, breaking existing subprocess behavior.

* In glibc >= 2.25 on Linux, posix_spawn() doesn't report errors to the parent 
in certain environments, such as QEMU user-mode emulation and Windows subsystem 
for Linux.

* In FreeBSD, as of this writing, posix_spawn() doesn't block signals in the 
child process, so a signal handler executed between vfork() and execve() may 
change memory shared with the parent [1].

Regardless of implementation, posix_spawn() is also unsuitable for some 
subprocess use cases:

* posix_spawnp() can't be used directly to implement file searching logic of 
subprocess because of different semantics, requiring workarounds.

* posix_spawn() has no standard way to specify the current working directory 
for the child.

* posix_spawn() has no way to close all file descriptors > 2 in the child, 
which is the *default* mode of operation of subprocess.Popen().

May be even more importantly, fundamentally, posix_spawn() will always be less 
flexible than fork()/exec() approach. Any additions will have to go through 
POSIX standardization or be unportable. Even if approved, a change will take 
years to get to actual users because of the requirement to update the C 
library, which may be more than a decade behind in enterprise Linux distros. 
This is in contrast to having an addition implemented in CPython. For example, 
a setrlimit() action for posix_spawn() is currently rejected in POSIX[2], 
despite being trivial to add.

I'm interested in avoiding posix_spawn() problems on Linux while still 
delivering comparable performance and safety. To that end I've studied 
implementations of posix_spawn() in glibc[3] and musl[4], which use 
vfork()/execve()-like approach, and investigated challenges of using vfork() 
safely on Linux (e.g. [5]) -- all of that for the purpose of using 
vfork()/exec() instead of fork()/exec() or posix_spawn() in subprocess where 
possible.

The unique property of vfork() is that the child shares the address space 
(including heap and stack) as well as thread-local storage with the parent, 
which means that the child must be very careful not to surprise the parent by 
changing the shared resources under its feet. The parent is suspended until the 
child performs execve(), _exit() or dies in any other way.

The most safe way to use vfork() is if one has access to the C library 
internals and can do the the following:

1) Disable thread cancellation before vfork() to ensure that the parent thread 
is not suddenly cancelled by another thread with pthread_cancel() while being 
in the middle of child creation.

2) Block all signals before vfork(). This ensures that no signal handlers are 
run in the child. But the signal mask is preserved by execve(), so the child 
must restore the original signal mask. To do that safely, it must reset 
dispositions of all non-ignored signals to the default, ensuring that no signal 
handlers are executed in the window between restoring the mask and execve().

Note that libc-internal signals should be blocked too, in particular, to avoid 
"setxid problem"[5].

3) Use a separate stack for the child via clone(CLONE_VM|CLONE_VFORK), which 
has exactly the same semantics as vfork(), but allows the caller to provide a 
separate stack. This way potential compiler bugs arising from the fact that 
vfork() returns twice to the same stack frame are avoided.

4) Call only async-signal-safe functions in the child.

In an application, only (1) and (4) can be done easily.

One can't disable internal libc signals for (2) without using syscall(), which 
requires knowledge of the kernel ABI for the particular architecture.

clone(CLONE_VM) can't be used at least before glibc 2.24 because it corrupts 
the glibc pid/tid cache in the parent process[6,7]. (As may be guessed, this 
problem was solved by glibc developers when they implemented posix_spawn() via 
clone()). Even now, the overall message seems to be that clone() is a low-level 
function not intended to be used by applications.

Even with the above, I still think that in context of subprocess/CPython the 
sufficient vfork()-safety requirements are provided by the following.

Despite being easy, (1) seems to be not necessary: CPython never uses 
pthread_cancel() internally, so Python code can't do that. A non-Python thread 
in an embedding app could try, but cancellation, in my knowledge, is not 
supported by CPython in any case (there is no way for an app to cleanup after 
the 

[issue35814] Syntax quirk with variable annotations

2019-01-24 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset 62c35a8a8ff5854ed470b1c16a7a14f3bb80368c by Ivan Levkivskyi in 
branch 'master':
bpo-35814: Allow same r.h.s. in annotated assignments as in normal ones 
(GH-11667)
https://github.com/python/cpython/commit/62c35a8a8ff5854ed470b1c16a7a14f3bb80368c


--

___
Python tracker 

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



[issue35224] PEP 572: Assignment Expressions

2019-01-24 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 1396d8fab4d0ae830d45f4937322bbb43ce0c30e by Victor Stinner in 
branch 'master':
bpo-35224: Add support for NamedExpr to unparse.py (GH-11670)
https://github.com/python/cpython/commit/1396d8fab4d0ae830d45f4937322bbb43ce0c30e


--

___
Python tracker 

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



[issue35821] Clarify when logging events are propagated when propagate is true

2019-01-24 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

Also, does "logged to this logger" include events propagated to it from a child 
logger? For example, if an event is logged to logger "A.B.C" and propagated to 
"A.B", will the propagate attribute of the latter effect whether logger "A" (or 
its handlers) sees it?

--

___
Python tracker 

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



[issue35224] PEP 572: Assignment Expressions

2019-01-24 Thread STINNER Victor


STINNER Victor  added the comment:

> @vstinner Is there something I could/should have checked other than the CI 
> displayed in GitHub before merging? Let me know if I can help.

It wasn't your fault. Our pre-commit checks on pull requests is incomplete on 
purpose: it has to be fast. It's fine to break buildbots sometimes. It's a 
tradeoff.

If you want to help, please merge https://github.com/python/cpython/pull/11670 
as soon as the CI test pass since I'm going to bed :-)

You are the victim of a very very specific annoying test, test_unparse with its 
annoying "randomly pick 10 files from the stdlib" feature...

--

___
Python tracker 

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



[issue35224] PEP 572: Assignment Expressions

2019-01-24 Thread Emily Morehouse


Emily Morehouse  added the comment:

@vstinner Is there something I could/should have checked other than the CI 
displayed in GitHub before merging? Let me know if I can help.



Here's a brief summary of the differences between the PEP spec and 
implementation:

>From the "Scope of the target" section of the PEP, there are two cases that 
>should raise a TargetScopeError: when an assignment expression is used in a 
>comprehension inside a class body or for special cases in comprehensions.

Invalid examples for the latter include:

[i := i+1 for i in range(5)]
[[(j := j) for i in range(5)] for j in range(5)]
[i := 0 for i, j in stuff]
[i+1 for i in i := stuff]

However, the following work in the implementation,though the PEP states they 
should be invalid:

>>> [i := i+1 for i in range(5)]
[1, 2, 3, 4, 5]
>>> i
5

>>> [i := 0 for i, j in [(1, 2)]]
[0]

The following does not work in the implementation (as desired), but does not 
throw a TargetScopeError as defined in the PEP:

>>> [i+1 for i in i := range(5)]
File "", line 1
[i+1 for i in i := range(5)]
^
SyntaxError: invalid syntax


IMO, I was leaning towards advocating for changing the PEP to match the 
implementation. I think the error messages are clear and expected, and 
restricting what already works would require significant special cases. I'm 
open to discussion though.

There's also documentation that should certainly be added (and I believe a spot 
where assignment expressions are explicitly mentioned as not being included in 
the language, which is no longer the case)

--

___
Python tracker 

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



[issue35224] PEP 572: Assignment Expressions

2019-01-24 Thread STINNER Victor


STINNER Victor  added the comment:

The change broke most buildbots: congrats Emily, each core dev has to do their 
as part of their training ;-) Don't worry, it's fine.

I wrote PR #11670 which should fix test_tools.

--
nosy: +vstinner

___
Python tracker 

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



[issue35224] PEP 572: Assignment Expressions

2019-01-24 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +11481, 11482

___
Python tracker 

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



[issue35224] PEP 572: Assignment Expressions

2019-01-24 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +11481, 11482, 11483

___
Python tracker 

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



[issue35224] PEP 572: Assignment Expressions

2019-01-24 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +11481

___
Python tracker 

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



[issue35821] Clarify when logging events are propagated when propagate is true

2019-01-24 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +vinay.sajip, xtreak

___
Python tracker 

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



[issue35822] _queue _queuemodule.c is missing inside the Setup file

2019-01-24 Thread Igor Z


New submission from Igor Z :

I had to install manually new urllib3 (zip archive) module inside python 3.7 
and got and error that module "_queue" is missing.
I did not find anything related to such module inside the Setup file.
Then I found this module in the github and manually added:
_queue _queuemodule.c and did "make" once again to get new 
"libpython3.7m.so.1.0" that I needed for the project. The problem was solved.

--
assignee: docs@python
components: Build, Documentation, Library (Lib)
messages: 334329
nosy: Igor Z, docs@python
priority: normal
severity: normal
status: open
title: _queue _queuemodule.c is missing inside the Setup file
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



[issue35224] PEP 572: Assignment Expressions

2019-01-24 Thread Guido van Rossum


Guido van Rossum  added the comment:

This is huge!

I do recall there are some minor edge cases where the implementation currently 
doesn't match the PEP. Could you summarize those here, and add your 
recommendation (e.g. change the PEP, fix the code, wait and see) with 
motivation?

--

___
Python tracker 

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



[issue3430] httplib.HTTPResponse documentations inconsistent

2019-01-24 Thread Demian Brecht


Change by Demian Brecht :


--
nosy:  -demian.brecht

___
Python tracker 

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



[issue17251] LWPCookieJar load() set domain_specifed wrong

2019-01-24 Thread Demian Brecht


Change by Demian Brecht :


--
nosy:  -demian.brecht

___
Python tracker 

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



[issue20911] urllib 'headers' is not a well defined data type

2019-01-24 Thread Demian Brecht


Demian Brecht  added the comment:

>>> urlopen('https://example.com').info()

>>> urlopen('http://example.com').info()

>>> urlopen('ftp://speedtest.tele2.net').info()

>>> urlopen('file:///path/to/setup.py').info()


I've taken a look at the rest of the handlers in urllib.request and they all 
build headers consistently with email.message_from_string().

Closing as out of date.

--
resolution:  -> out of date
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



[issue35819] Fatal Python error

2019-01-24 Thread Abdallah


Abdallah  added the comment:

Thank you alot

On Thu, 24 Jan 2019, 19:37 Zachary Ware 
> Zachary Ware  added the comment:
>
> Hi Abdallah,
>
> This tracker is for reporting bugs in the CPython interpreter or standard
> library, not for general help; as such I'm closing this issue.  For help,
> it's better to ask on the main python mailing list (python-l...@python.org),
> in the #python IRC channel on Freenode, or in the #general/help stream on
> python.zulipchat.com.
>
> That said, this is usually caused by having the PYTHONHOME or PYTHONPATH
> environment variables set incorrectly; try unsetting *all* environment
> variables that start with PYTHON and see if that helps.
>
> If that doesn't fix it, ask for help on one of the forums I mentioned
> above, but include more details about what you're actually doing and what's
> not working so that folks can help you effectively.  Also include your
> operating system, OS version, Python version, and anything else that you
> feel might be relevant.
>
> --
> nosy: +zach.ware
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue35224] PEP 572: Assignment Expressions

2019-01-24 Thread Emily Morehouse


Emily Morehouse  added the comment:


New changeset 8f59ee01be3d83d5513a9a3f654a237d77d80d9a by Emily Morehouse in 
branch 'master':
bpo-35224: PEP 572 Implementation (#10497)
https://github.com/python/cpython/commit/8f59ee01be3d83d5513a9a3f654a237d77d80d9a


--

___
Python tracker 

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



[issue15248] Better explain "TypeError: 'tuple' object is not callable"

2019-01-24 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



[issue15248] Better explain "TypeError: 'tuple' object is not callable"

2019-01-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I am not sure what you could do at the moment.  We have not yet settled whether 
this is a documentation or interpreter core issue.

I posted "Add more SyntaxWarnings?" to pydev to get more comments on Serhiy's 
patch, especially for other core developers.  Depending on what people think, 
that *might* result in someone converting the diff (with the typo corrected) 
into a PR.

I already posted here a prototype doc entry for TypeError messages.  I decided 
that I should take time out from IDLE to post my idea for a separate error 
message doc.  I will include a fleshed-out TypeError entry (with code example) 
as an example entry.

--

___
Python tracker 

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



[issue35820] Inconsistent behavior when parsing IP address

2019-01-24 Thread Eric V. Smith

Eric V. Smith  added the comment:

>From the documentation of IPv4Address:

The following constitutes a valid IPv4 address:

1. A string in decimal-dot notation, consisting of four decimal integers in the 
inclusive range 0–255, separated by dots (e.g. 192.168.0.1). Each integer 
represents an octet (byte) in the address. Leading zeroes are tolerated only 
for values less than 8 (as there is no ambiguity between the decimal and octal 
interpretations of such strings).

21 is not less than 8, so you get this error. I think this is working as it's 
documented.

--
nosy: +eric.smith

___
Python tracker 

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



[issue35811] py.exe should unset the __PYVENV_LAUNCHER__ environment variable

2019-01-24 Thread Steve Dower


Steve Dower  added the comment:

I think that snippet may have to change to accommodate the multiprocessing 
issue, where we need to stop replacing sys.executable with the venv launcher 
and have it point to the base python.exe (and then anyone launching 
sys.executable needs to preserve __PYVENV_LAUNCHER__, which is the default 
behavior).

Having done a code scan, there are quite a few places where we explicitly 
choose __PYVENV_LAUNCHER__ on macOS over sys.executable, so I guess we need to 
do those on Windows now as well. But that's a discussion for issue 35797

--

___
Python tracker 

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



[issue35686] BufferError with memory.release()

2019-01-24 Thread Thomas Waldmann


Thomas Waldmann  added the comment:

https://github.com/borgbackup/borg/pull/4247/files

this is the current code i have for this (it is not as simple there as in the 
minimal code samples i attached here).

i meanwhile think i can not use a contextmanager there.

do you think this is as good as it gets for this kind of code?

if you all think this is expected behaviour for the python contextmanagers and 
can't be done better, this issue can be closed.

--

___
Python tracker 

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



[issue35821] Clarify when logging events are propagated when propagate is true

2019-01-24 Thread Chris Jerdonek


New submission from Chris Jerdonek :

Currently, the logging docs are a bit ambiguous or at least not completely 
clear as to when events are propagated when Logger.propagate is true. The docs 
currently say [1]--

"If [the `propagate`] attribute evaluates to true, events logged to this logger 
will be passed to the handlers of higher level (ancestor) loggers, in addition 
to any handlers attached to this logger."

But it's not clear if "logged to this logger" means (1) a log method like 
info() or error() was called on the logger, or (2) the event was passed to the 
logger's handlers (i.e. satisfied the logger's log level threshold and any 
filters).

Empirically, I found that the meaning is (2).

[1]: https://docs.python.org/3/library/logging.html#logging.Logger.propagate

--
assignee: docs@python
components: Documentation
messages: 334320
nosy: chris.jerdonek, docs@python
priority: normal
severity: normal
stage: needs patch
status: open
title: Clarify when logging events are propagated when propagate is true
type: enhancement
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



[issue35820] Inconsistent behavior when parsing IP address

2019-01-24 Thread Tinu Tomson


Change by Tinu Tomson :


--
type:  -> behavior

___
Python tracker 

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



[issue35820] Inconsistent behavior when parsing IP address

2019-01-24 Thread Tinu Tomson


New submission from Tinu Tomson :

ip = '23.00.021.002'
ipaddress.IPv4Address(ip)
throw error:
  File "/usr/lib/python3.4/ipaddress.py", line 1271, in __init__
 
self._ip = self._ip_int_from_string(addr_str)   
 
  File "/usr/lib/python3.4/ipaddress.py", line 1122, in _ip_int_from_string 
 
raise AddressValueError("%s in %r" % (exc, ip_str)) from None   
 
ipaddress.AddressValueError: Ambiguous (octal/decimal) value in '021' not 
permitted in '23.00.021.002'  


ip = '23.00.21.002'
ipaddress.IPv4Address(ip)

parses correctly.

--
components: Library (Lib)
messages: 334319
nosy: tinutomson
priority: normal
severity: normal
status: open
title: Inconsistent behavior when parsing IP address

___
Python tracker 

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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11478, 11479, 11480

___
Python tracker 

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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11478, 11479

___
Python tracker 

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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11478

___
Python tracker 

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



[issue35717] enum.Enum error on sys._getframe(2)

2019-01-24 Thread miss-islington

miss-islington  added the comment:


New changeset 1fd06f1eca80dcbf3a916133919482a8327f3da4 by Miss Islington (bot) 
(Rémi Lapeyre) in branch 'master':
bpo-35717: Fix KeyError exception raised when using enums and compile (GH-11523)
https://github.com/python/cpython/commit/1fd06f1eca80dcbf3a916133919482a8327f3da4


--
nosy: +miss-islington

___
Python tracker 

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



[issue35811] py.exe should unset the __PYVENV_LAUNCHER__ environment variable

2019-01-24 Thread Eryk Sun


Eryk Sun  added the comment:

> But if I understood what Steve said, only if path\to\python.exe is 
> a *relative* pathname?

I believe Steve is referring to behavior changes for applications that relied 
on a virtual environment's "Scripts" directory always being in the EXE and 
default DLL and generic search paths because it was the application directory 
(i.e. "%__APPDIR__%"), which I had discussed in a follow-up note. I suggested 
that this could be mitigated by having the new venv launchers also prepend 
their directory to PATH. It wouldn't help in all cases, but it's the best we 
can do. 

The issue with __PYVENV_LAUNCHER__ and the py.exe and entry-point launchers is 
unrelated to relative paths. Perhaps it will clarify the situation to show how 
this variable is actually used in PC/getpathp.c. It's a pretty simple change:

/* The launcher may need to force the executable path to a
 * different environment, so override it here. */
pyvenv_launcher = _wgetenv(L"__PYVENV_LAUNCHER__");
if (pyvenv_launcher && pyvenv_launcher[0]) {
wcscpy_s(program_full_path, MAXPATHLEN+1, pyvenv_launcher);
} else if (!GetModuleFileNameW(NULL, program_full_path, MAXPATHLEN)) {
/* GetModuleFileName should never fail when passed NULL */
return _Py_INIT_ERR("Cannot determine program path");
}

https://github.com/python/cpython/blob/v3.7.2/PC/getpathp.c#L535

--

___
Python tracker 

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



[issue34857] IDLE: SyntaxWarning not handled properly

2019-01-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

In 3.7.2, the statement in a file results in the SyntaxError being printed in 
Shell *before* the restart.  It should be after, but before the code object is 
sent to the restarted execution process.

--

___
Python tracker 

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



[issue35811] py.exe should unset the __PYVENV_LAUNCHER__ environment variable

2019-01-24 Thread Paul Moore


Paul Moore  added the comment:

> The script executable redirects to run `"path\to\python.exe" 
> "path\to\.exe"`.

But if I understood what Steve said, only if path\to\python.exe is a *relative* 
pathname?

--

___
Python tracker 

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



[issue35811] py.exe should unset the __PYVENV_LAUNCHER__ environment variable

2019-01-24 Thread Eryk Sun


Eryk Sun  added the comment:

> 1. Is there a possibility that 3rd party applications like pip 
> could see bugs with Python 3.7.2?

A bug occurs when running an entry-point script, such as pip.exe, for a system- 
or user-installed Python 3.7.2+ from the context of a virtual environment for 
3.7.2+. The script executable redirects to run `"path\to\python.exe" 
"path\to\.exe"`. This will inherit __PYVENV_LAUNCHER__ and thus 
run in the virtual environment. The environment doesn't have to be activated. 
People use inactive virtual environments for various purposes, so it doesn't 
defy my expectations that someone may have a problem. I think the distlib 
launchers should make the same change to unset __PYVENV_LAUNCHER__, which is 
why I nosied Vinay.

--

___
Python tracker 

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



[issue35811] py.exe should unset the __PYVENV_LAUNCHER__ environment variable

2019-01-24 Thread Paul Moore


Paul Moore  added the comment:

Steve - thanks for the clarification. If it's only affecting launching with 
relative paths, then agreed it's minor (although I do recall recent discussions 
somewhere about using launchers with relative paths - that use case may need 
checking, but we can deal with that when it comes up).

And I hadn't appreciated that __PYVENV_LAUNCHER__ was MACOS only before now. So 
again, thanks forthe reassurance there.

--

___
Python tracker 

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



[issue35817] IDLE 2.713 on debian 9.6 over WSL W10 IdentationError

2019-01-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

In the Debian screenshot with the traceback, you run interactive Python, not 
IDLE, in the system terminal, with the command-line entry 'python'.  Notice the 
secondary ... prompt.

The bug in the code you entered is indicated by the error message.  In 
interactive Python you have to indent the bodies of compound statements 
yourself.  (IDLE does this for you with its 'smart indent' feature.)  In the 
future, please ask questions about exception messages (and Python in general) 
on python-list or elsewhere.  Perhaps you should also reread the Python 
Tutorial.

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

___
Python tracker 

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



[issue35819] Fatal Python error

2019-01-24 Thread Zachary Ware


Zachary Ware  added the comment:

Hi Abdallah,

This tracker is for reporting bugs in the CPython interpreter or standard 
library, not for general help; as such I'm closing this issue.  For help, it's 
better to ask on the main python mailing list (python-l...@python.org), in the 
#python IRC channel on Freenode, or in the #general/help stream on 
python.zulipchat.com.

That said, this is usually caused by having the PYTHONHOME or PYTHONPATH 
environment variables set incorrectly; try unsetting *all* environment 
variables that start with PYTHON and see if that helps.

If that doesn't fix it, ask for help on one of the forums I mentioned above, 
but include more details about what you're actually doing and what's not 
working so that folks can help you effectively.  Also include your operating 
system, OS version, Python version, and anything else that you feel might be 
relevant.

--
nosy: +zach.ware
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue35767] unittest loader doesn't work with partial test functions

2019-01-24 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 841387dd43e67b1800d10e4d7ce1f8cedc9f3706 by Łukasz Langa (Miss 
Islington (bot)) in branch '3.7':
bpo-35767: Fix unittest.loader to allow partials as test_functions (GH-11600) 
(#11662)
https://github.com/python/cpython/commit/841387dd43e67b1800d10e4d7ce1f8cedc9f3706


--

___
Python tracker 

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



[issue35520] Python won't build with dtrace enabled on some systems.

2019-01-24 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 5c8f537669d3379fc50bb0a96accac756e43e281 by Łukasz Langa (Jakub 
Kulík) in branch 'master':
bpo-35520: Fix build with dtrace support on certain systems. (#11194)
https://github.com/python/cpython/commit/5c8f537669d3379fc50bb0a96accac756e43e281


--

___
Python tracker 

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



[issue35819] Fatal Python error

2019-01-24 Thread Abdallah


New submission from Abdallah :

,He,
i am having this problem for about 2 weeks , I can't do anything , so please 
give me some instructions so i can solve .it

Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'

:Current thread 0x3c7c (most recent call first

Process finished with exit code -1073740791 (0xC409)

 Thanks

--
messages: 334308
nosy: abdallahadham
priority: normal
severity: normal
status: open
title: Fatal Python error

___
Python tracker 

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



[issue31982] 8.3. collections — Container datatypes

2019-01-24 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

This is a duplicate of issue 31075, which was closed as 'Not a bug'.

--
nosy: +cheryl.sabella

___
Python tracker 

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



[issue15248] Better explain "TypeError: 'tuple' object is not callable"

2019-01-24 Thread Mayank Singhal


Mayank Singhal <17mayanksing...@gmail.com> added the comment:

Hey, if nobody is working on this can I go for it?

--
nosy: +storymode7

___
Python tracker 

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



[issue35537] use os.posix_spawn in subprocess

2019-01-24 Thread STINNER Victor


STINNER Victor  added the comment:

I wrote PR 11668 to propose to *document* the subtle behavior change when 
posix_spawn() is used on QEMU User Emulation and WSL platforms, rather than 
trying to opt-out for posix_spawn() on these platforms.

--

___
Python tracker 

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



[issue35537] use os.posix_spawn in subprocess

2019-01-24 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +11476, 11477

___
Python tracker 

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



[issue35537] use os.posix_spawn in subprocess

2019-01-24 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +11476

___
Python tracker 

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



[issue35811] py.exe should unset the __PYVENV_LAUNCHER__ environment variable

2019-01-24 Thread Steve Dower


Steve Dower  added the comment:

It might be worth adding a summary of that to the porting notes, but I think 
the actual impact will be minimal. Launching processes by relative path has 
been a bad decision for long enough now that I'd expect it to be rare, and the 
Scripts directory layout being slightly different helps.

The launcher scripts used by pip also changed somewhat recently (between 12.x 
and 18.x IIRC) with something along these lines without causing significant 
issues.

Ultimately, there isn't much of an alternative. Those who have been following 
good practices and supported patterns in their code will be okay, and those who 
have not (e.g. Numpy putting DLLs on PATH) will be bitten sooner or later 
anyway. 

So let's suppress the variable in the launcher to deal with that particular 
issue. It's fairly minor compared to the multiprocessing one.

For Paul: Yes, there's a chance of pip issues. This is why I sent you all a 
heads-up email before anything was released. But pip is certainly the best 
tested package and I've even been doing pip development using the Store package 
and a venv without trouble. Everything here is severe edge cases.

Also, the __PYVENV_LAUNCHER__ variable is totally new - previously it only ever 
existed on macOS (since some of the same launch restrictions apply there). It's 
not the same as the VIRTUALENV variable that you added support to py.exe to 
detect. That one is fine.

--

___
Python tracker 

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



[issue33342] urllib IPv6 parsing fails with special characters in passwords

2019-01-24 Thread Terrence Brannon


Terrence Brannon  added the comment:

Also note, if SQLAlchemy gives any guidance, then note that SA unquotes both 
the username and password of the URL:

https://github.com/sqlalchemy/sqlalchemy/blob/master/lib/sqlalchemy/engine/url.py#L274

--

___
Python tracker 

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



[issue33342] urllib IPv6 parsing fails with special characters in passwords

2019-01-24 Thread Terrence Brannon


Terrence Brannon  added the comment:

Regarding "RFC 2396 explicitly excludes the use of [ and ] in URLs. RFC 2732 
 defines the syntax for IPv6 URLs, and 
allows [ and ] ONLY in the host part.

So I'd say that the behaviour is arguably correct (if somewhat unfortunate)"

I would say that a square bracket CAN be used in the password, but that it 
should be urlencoded and that this library should perform a urldecode for both 
username and password, just as SQLAlchemy does.

--

___
Python tracker 

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



[issue35811] py.exe should unset the __PYVENV_LAUNCHER__ environment variable

2019-01-24 Thread Paul Moore


Paul Moore  added the comment:

I'm not particularly happy with the statement that "However, the latter is out 
of scope here since the entry-point launchers are in distlib."

If Python is changing the semantics of __PYVENV_LAUNCHER__ in such a way that 
it breaks 3rd party code, it seems to me that this is a bug, which should be 
addressed by reverting or fixing the change so that the 3rd party code does not 
need to change. Either that, or the change is publicised as a backward 
compatibility break, so that tools are given a chance to update.

Having said all of that, I appreciate that __PYVENV_LAUNCHER__ is not exactly a 
public API, so there should be some leeway here. But I think that whatever 
solution we propose here needs to address how we manage the change required of 
third parties.

I still need to fully read and understand this discussion - I've not really 
followed any of the work around publishing Python as a Store application, 
taking the view that I won't use it myself, so "it won't affect me". But now 
I'm starting to worry about whether I'll see pip bug reports being filed 
because pip's installing things in the wrong places ("Similarly, pip.exe for an 
installed Python 3.7 will mistakenly install into the virtual environment.") If 
that sort of thing does happen, it harms our credibility and we need to be able 
to clearky explain what's going on, and how to fix it.

Can I clarify 2 things:

1. Is there a possibility that 3rd party applications like pip could see bugs 
with Python 3.7.2?
2. Is there a workaround or fix for those issues, and how are we making sure 
the relevant 3rd parties know what to do?

(Again, apologies if I've misunderstood something here - there's quite a lot of 
technical detail that I haven't had time to understand yet).

--

___
Python tracker 

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



[issue33416] Add endline and endcolumn to every AST node

2019-01-24 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Re-opening to track renaming of potentially public PyNode_AddChild() and 
PyParser_AddToken().

--
nosy: +vstinner
resolution: fixed -> 
stage: resolved -> patch review
status: closed -> open

___
Python tracker 

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



[issue35814] Syntax quirk with variable annotations

2019-01-24 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
keywords: +patch, patch
pull_requests: +11473, 11474
stage:  -> patch review

___
Python tracker 

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



[issue35814] Syntax quirk with variable annotations

2019-01-24 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
keywords: +patch, patch, patch
pull_requests: +11473, 11474, 11475
stage:  -> patch review

___
Python tracker 

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



[issue35814] Syntax quirk with variable annotations

2019-01-24 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


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

___
Python tracker 

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



[issue35814] Syntax quirk with variable annotations

2019-01-24 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

Good catch!

I think it was just overlooked rather than a conscious decision (unlike the 
left hand side, that generated lots of debates)

I will make a PR to allow everything that is allowed on r.h.s. of a normal 
assignment.

--

___
Python tracker 

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



[issue35621] asyncio.create_subprocess_exec() only works with main event loop

2019-01-24 Thread Alexandre Défossez

Alexandre Défossez  added the comment:

Also impacted.

A fix I found is to add `watcher.attach_loop(self)` just after `with 
events.get_child_watcher() as watcher:` in `_make_subprocess_transport` in 
`asyncio/unix_events.py`.

--
nosy: +adfz

___
Python tracker 

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



[issue35818] test_email: test_localtime_daylight_false_dst_true() fails if timezone database is missing

2019-01-24 Thread Andreas Schwab


Andreas Schwab  added the comment:

rpm -e timezone

--

___
Python tracker 

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



[issue35818] test_email: test_localtime_daylight_false_dst_true() fails if timezone database is missing

2019-01-24 Thread STINNER Victor


STINNER Victor  added the comment:

How can I reproduce the issue?

--

___
Python tracker 

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



[issue35816] csv.DictReader, skipinitialspace does not ignore tabs

2019-01-24 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Sorry, I overlooked the patch. The issue reported is the same in issue21297 but 
the patch was about changing whitespace to space in the doc instead of changing 
the behavior as I can see from the discussion.

--

___
Python tracker 

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



[issue35818] test_email: test_localtime_daylight_false_dst_true() fails if timezone database is missing

2019-01-24 Thread Andreas Schwab


New submission from Andreas Schwab :

bpo-35317 solution is incomplete, the test needs to be skipped if the timezone 
database is unavailable.

--
messages: 334294
nosy: barry, miss-islington, p-ganssle, r.david.murray, schwab, vstinner, xtreak
priority: normal
severity: normal
status: open
title: test_email: test_localtime_daylight_false_dst_true() fails if timezone 
database is missing
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



[issue35817] IDLE 2.713 on debian 9.6 over WSL W10 IdentationError

2019-01-24 Thread Audric


New submission from Audric :

Hello,

The screenshot attached is a clear repro.

Environment:
Surface Pro 3 Win 10 1803 Python 2.7.14
WSL Debian 9.6 with Python 2.7.13

Code:
>>elements = []
>>for i in range(0, 6):
>>...elements.append(i)

---

Working:
>>print elements
>>[0, 1, 2, 3, 4, 5]

Non working:
  File "", line 2
elements.append(i)
   ^
IndentationError: expected an indented block

--
assignee: terry.reedy
components: IDLE
files: py27debian9wslw10indentationerror.PNG
messages: 334293
nosy: audricd, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE 2.713 on debian 9.6 over WSL W10 IdentationError
type: behavior
versions: Python 2.7
Added file: 
https://bugs.python.org/file48076/py27debian9wslw10indentationerror.PNG

___
Python tracker 

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



[issue35537] use os.posix_spawn in subprocess

2019-01-24 Thread STINNER Victor


STINNER Victor  added the comment:

I discussed the following issue with Florian Weimer (who works on the glibc):
---
$ cat test.c
#include 

int main(int argc, char *argv[], char *envp[]) {
return posix_spawn(0, "non-existing", 0, 0, argv, envp);
}

$ aarch64-linux-gnu-gcc -static test.c
$ qemu-aarch64 ./a.out
$ echo $?
0
---

While the parent gets a "success", in subprocess we get the pid and later read 
the exit status of the child process. Even if posix_spawn() doesn't report a 
failure, waitpid() will still report a failure. It's a subtle behavior change. 
I'm not sure yet if it's acceptable for Python in term of semantics:

* without posix_spawn(), subprocess.Popen constructor raises FileNotFoundError: 
the parent knows that the execution failed because the program doesn't exist
* with posix_spawn() with the vfork bug, subprocess.Popen succeed but 
Popen.wait() returns something like exit code 127. The parent doesn't know if 
the child process explcitly used exit(127) or if execv() failed.

Does the difference matters? The bug only occurs in some very specific cases:

* WSL
* QEMU User Emulation

Are these use cases common enough to block the whole idea of using 
posix_spawn() on Linux. I don't think so. I really want to use posix_spawn() 
for best performances! Moreover, I expect that glibc implementation of 
posix_spawn() is safer than Python _posixsubprocess. The glibc has access to 
low-level stuff like it's internal signals, cancellation points, etc. 
_posixsubprocess is more generic and doesn't worry about such low-level stuff, 
whereas they might cause bad surprised.

--

___
Python tracker 

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



[issue35317] test_email: test_localtime_daylight_false_dst_true() fails depending on the timezone

2019-01-24 Thread Andreas Schwab


Andreas Schwab  added the comment:

The test still fails if the timezone database is not available.

--
nosy: +schwab

___
Python tracker 

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



[issue35816] csv.DictReader, skipinitialspace does not ignore tabs

2019-01-24 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

https://bugs.python.org/issue21297#msg216907 to be related and has a patch. It 
refers to whitespace as only space ('U+0020') with tabs being ignored.

Current code where only space is taken into account : 
https://github.com/python/cpython/blob/fd628cf5adaeee73eab579393cdff71c8f70cdf2/Modules/_csv.c#L621

--
nosy: +xtreak

___
Python tracker 

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



[issue35816] csv.DictReader, skipinitialspace does not ignore tabs

2019-01-24 Thread André Lehmann

New submission from André Lehmann :

When using the csv.DictReader a dialect can be given to change the behavior of 
interpretation of the csv file.

The Dialect has an option "skipinitialspace" which shall ignore the whitespace 
after the delimiter according to the documentation 
(https://docs.python.org/3/library/csv.html).

Unfortunately this works only for spaces but not for tabs which are also 
whitespaces.

See the following code snippet applied on the attached file:

with open("conf-csv", "r") as csvfile:
csv.register_dialect("comma_and_ws", skipinitialspace=True)
csv_dict_reader = csv.DictReader(csvfile, dialect="comma_and_ws")
for line in csv_dict_reader:
print(line)

The second line shall not contain "\t" chars.

--
files: conf.csv
messages: 334289
nosy: andre.lehmann
priority: normal
severity: normal
status: open
title: csv.DictReader, skipinitialspace does not ignore tabs
type: behavior
versions: Python 3.5
Added file: https://bugs.python.org/file48075/conf.csv

___
Python tracker 

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



[issue35537] use os.posix_spawn in subprocess

2019-01-24 Thread STINNER Victor


STINNER Victor  added the comment:

> Another problem with posix_spawn() on glibc: it doesn't report errors to the 
> parent process when run under QEMU user-space emulation and Windows Subsystem 
> for Linux. This is because starting with commit [1] (glibc 2.25) 
> posix_spawn()  relies on address space sharing semantics of clone(CLONE_VM) 
> to report errors, but it's not implemented in QEMU and WSL, so 
> clone(CLONE_VM) and vfork() behave like fork(). See also [2], [3].

Oh, you know a lot of stuff about vfork and posix_spawn, you are impressive :-)

Is sys.platform equal to 'linux' on WSL? Sorry, I don't know WSL. If it's 
equal, is it possible to explicitly exclude WSL in the subprocess test, 
_use_posix_spawn()?

For QEMU, I was very surprised that a full VM wouldn't implement vfork. So I 
tried Fedora Rawhide and I didn't notice the bug that you described.

---
$ cat test.c
#include 

int main(int argc, char *argv[], char *envp[]) {
return posix_spawn(0, "non-existing", 0, 0, argv, envp);
}

$ gcc test.c
$ ./a.out
$ echo $?
2
---

In the VM, I get exit status 2 as expected.

You wrote:

---
$ aarch64-linux-gnu-gcc -static test.c
$ qemu-aarch64 ./a.out
$ echo $?
0
---

So the bug only affects "QEMU User Space". I never used that before. I 
understand that it's a bug in the glibc and in "QEMU User Emulation" which 
doesn't implement vfork "properly".


> There is no problem with musl (it doesn't rely on address space sharing).

I'm not interested to support musl at this point because I don't see any 
obvious way to detect that we are running musl nor get the musl version.

The history of this issue shows the posix_spawn() only works in some very 
specific cases, so we have to be careful and only opt-in for specific libc, on 
specific platform with specific libc version (read at runtime if possible).

--

___
Python tracker 

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



[issue18078] threading.Condition to allow notify on a specific waiter

2019-01-24 Thread Richard Whitehead

Richard Whitehead  added the comment:

Thanks João.

We are working on a medical prototype, and I wouldn't want to rely on our own 
version of something so fundamental without having a thorough test harness for 
it, which would obviously be quite time-consuming, and something of a dead-end.

I've worked around the issue now (the system pushing to a queue has to be given 
a Condition to set when they push, so that if a system listens on multiple 
queues it can give all the senders the same Condition), but it makes the 
architecture quite messy, just being able to wait on one of several Conditions 
would have been neater and less error-prone.

I suppose I expected to see this method because I'm familiar with the Windows 
API. But I checked and it is not present in the posix threading API, so there 
is some justification for peoples' reluctance to implement it in Python.

Thanks again,

Richard

--

___
Python tracker 

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



[issue27035] Cannot set exit code in atexit callback

2019-01-24 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

You can always set the exit code calling sys.exit from outside the atexit 
handlers. I concur with R. David Murray in that calling sys.exit and expect 
anything sounds like a bad idea and an abuse if the atexit system.

A normal application would call sys.exit, some cleanup code will be called in 
the atexit handlers and finally the program will exit with the code originally 
set in the first call.

How and when your application will be calling sys.exit is an application 
architecture problem, and IMHO it should not be a CPython provided 
functionality to guarantee that you can do this in the atexit handlers.

It also violates the contract that right now is in the documentation: 
SystemExit exceptions are not printed or reraiaed in atexit handlers. Changing 
this (specially the second part) will be backwards incompatible, although that 
is a second order argument.

--

___
Python tracker 

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



[issue27035] Cannot set exit code in atexit callback

2019-01-24 Thread Miroslav Matějů

Miroslav Matějů  added the comment:

I completely support @gwk’s opinion expressed in his comments. My original 
intention has been to set the exit code in an atexit callback. I tried a way 
and found that it was working in Python 2.7 but not in 3.x (without notice), so 
I filed this bug report. (See also the Stack Overflow link in my first post.)

I don’t find this just a documentation issue since it prevents the user from 
setting the exit code, although (as correctly stated by @gwk): “Ultimately, it 
is the responsibility of the application programmer to return an appropriate 
code for all execution paths” and “returning the correct code is the most 
critical behavior of a process”.

My use case is a testing library. The user calls assertions from my library and 
when their script finishes, my library is responsible for deciding whether the 
test has passed (and finishing the log). Before porting the library to Python 
(3.5 initially), I used to indicate successfulness by the exit code. With 
Python 3.x, I am forced to either:
1) print a result message and let the parent process parse it (implemented 
currently), or
2) force the user of my library to include something like
 sys.exit(testlib.result())
   as the last line of their scripts which I find annoying and error-prone.

I cannot decide whether calling sys.exit() in an atexit callback means breaking 
the contract as @r.david.murray states. However, the user shall be able to set 
the exit code of their application when it finishes and atexit should support 
some way to do that.

--

___
Python tracker 

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