[issue17535] IDLE: Add an option to show line numbers along the left side of the editor window, and have it enabled by default.

2019-07-03 Thread Ma Lin


Ma Lin  added the comment:

I tried PR 14030 today.
By default, the fgcolor is black.
Looks like a black belt always on the left side, this makes me feel a bit 
oppressive.
Of course, the fgcolor can be changed.

--
nosy: +Ma Lin
Added file: https://bugs.python.org/file48455/1.png

___
Python tracker 

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



[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2019-07-03 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


--
nosy: +Jeffrey.Kintscher

___
Python tracker 

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



[issue37495] socket.inet_aton parsing issue on some libc versions

2019-07-03 Thread Aldwin Pollefeyt


Aldwin Pollefeyt  added the comment:

indeed, can confirm that a string starting with valid ip address and a space 
followed with anything, will not trigger the exception.

do_ping('1.1.1.1 1.256.300.1 ; whoami') => no exception

--

___
Python tracker 

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



[issue37495] socket.inet_aton parsing issue on some libc versions

2019-07-03 Thread Aldwin Pollefeyt

Aldwin Pollefeyt  added the comment:

>From : 
>https://docs.python.org/3.9/library/subprocess.html#security-considerations

Security Considerations

Unlike some other popen functions, this implementation will never implicitly 
call a system shell. This means that all characters, including shell 
metacharacters, can safely be passed to child processes. If the shell is 
invoked explicitly, via shell=True, it is the application’s responsibility to 
ensure that all whitespace and metacharacters are quoted appropriately to avoid 
shell injection vulnerabilities.

When using shell=True, the shlex.quote() function can be used to properly 
escape whitespace and shell metacharacters in strings that are going to be used 
to construct shell commands.

--
nosy: +aldwinaldwin

___
Python tracker 

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



[issue37497] Add inspect.Signature.from_text().

2019-07-03 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +yselivanov

___
Python tracker 

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



[issue37459] importlib docs improperly reference get_resource_loader()

2019-07-03 Thread Barry A. Warsaw


Barry A. Warsaw  added the comment:


New changeset 070d3d928d20ccb4790dd077f3794af3c2932e5c by Barry Warsaw (Miss 
Islington (bot)) in branch '3.8':
bpo-37459: importlib docs improperly reference get_resource_loader() (GH-14568) 
(GH-14580)
https://github.com/python/cpython/commit/070d3d928d20ccb4790dd077f3794af3c2932e5c


--

___
Python tracker 

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



[issue37459] importlib docs improperly reference get_resource_loader()

2019-07-03 Thread Barry A. Warsaw


Barry A. Warsaw  added the comment:


New changeset d7d9c9f7c22113a405f1a340d050edfa2d024dff by Barry Warsaw (Miss 
Islington (bot)) in branch '3.7':
bpo-37459: importlib docs improperly reference get_resource_loader() (GH-14568) 
(GH-14581)
https://github.com/python/cpython/commit/d7d9c9f7c22113a405f1a340d050edfa2d024dff


--

___
Python tracker 

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



[issue37459] importlib docs improperly reference get_resource_loader()

2019-07-03 Thread Barry A. Warsaw


Change by Barry A. Warsaw :


--
resolution:  -> fixed
stage: patch review -> backport needed
status: open -> closed

___
Python tracker 

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



[issue37459] importlib docs improperly reference get_resource_loader()

2019-07-03 Thread Barry A. Warsaw


Barry A. Warsaw  added the comment:


New changeset b607d992e76e485f20be3bfd6b311525123f936b by Barry Warsaw 
(aldwinaldwin) in branch 'master':
bpo-37459: importlib docs improperly reference get_resource_loader() (#14568)
https://github.com/python/cpython/commit/b607d992e76e485f20be3bfd6b311525123f936b


--

___
Python tracker 

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



[issue37459] importlib docs improperly reference get_resource_loader()

2019-07-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14400
pull_request: https://github.com/python/cpython/pull/14581

___
Python tracker 

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



[issue37459] importlib docs improperly reference get_resource_loader()

2019-07-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14399
pull_request: https://github.com/python/cpython/pull/14580

___
Python tracker 

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



[issue37497] Add inspect.Signature.from_text().

2019-07-03 Thread Eric Snow


Eric Snow  added the comment:

Note that there has been a little discussion of this in the past, particularly 
around the time that argument clinic was introduced:  
https://bugs.python.org/issue23967#msg241140.

--

___
Python tracker 

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



[issue37497] Add inspect.Signature.from_text().

2019-07-03 Thread Eric Snow


New submission from Eric Snow :

In early 2014 (3.3), when argument clinic was added, we added support for 
turning func.__text_signature__ into an inspect.Signature object.  However, the 
functionality to convert a string into a Signature was never exposed publicly.  
Here's a patch to do so.

Note that inspect.signature() will also support taking a string.

--
assignee: eric.snow
components: Library (Lib)
messages: 347250
nosy: eric.snow
priority: normal
pull_requests: 14398
severity: normal
stage: needs patch
status: open
title: Add inspect.Signature.from_text().
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue32179] Empty email address in headers triggers an IndexError

2019-07-03 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Closing this per @maxking's comment.  If it can be recreated, please reopen.

--
nosy: +cheryl.sabella
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



[issue32178] Some invalid email address groups cause an IndexError instead of a HeaderParseError

2019-07-03 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Based on @maxking's comment, I'm going to close this issue.  Thank you!

--
nosy: +cheryl.sabella
resolution:  -> out of date
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



[issue37496] Support annotations in signature strings.

2019-07-03 Thread Eric Snow


New submission from Eric Snow :

In early 2014 (3.3), when argument clinic was added, we added support for 
turning func.__text_signature__ into an inspect.Signature object.  However, at 
that time we did not add support for annotations (see the nested "parse_name()" 
in _signature_fromstr().  Annotations should be supported.

I'd expect that PEP 563 (Postponed Evaluation of Annotations) could be 
leveraged.

--
components: Library (Lib)
messages: 347247
nosy: eric.snow
priority: normal
severity: normal
stage: needs patch
status: open
title: Support annotations in signature strings.
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue15500] Python should support exporting thread names to the OS

2019-07-03 Thread Zackery Spytz


Change by Zackery Spytz :


--
nosy: +ZackerySpytz
versions: +Python 3.9 -Python 3.6

___
Python tracker 

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



[issue15500] Python should support exporting thread names to the OS

2019-07-03 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
pull_requests: +14397
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/14578

___
Python tracker 

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



[issue27452] IDLE: Cleanup config code

2019-07-03 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
versions: +Python 3.8, Python 3.9 -Python 3.6

___
Python tracker 

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



[issue27452] IDLE: Cleanup config code

2019-07-03 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
pull_requests: +14396
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/14577

___
Python tracker 

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



[issue35605] backported patch requires new sphinx, minimum sphinx version was not bumped

2019-07-03 Thread Ned Deily


Ned Deily  added the comment:

Thanks for the additional PR.  Accepted for post-3.6.9 (PR 14576, commit 
a6d97e200863e7e5fc60bbc8f121b86a2098ef2d - message AWOL?)

--

___
Python tracker 

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



[issue35605] backported patch requires new sphinx, minimum sphinx version was not bumped

2019-07-03 Thread Ned Deily


Change by Ned Deily :


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

___
Python tracker 

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



[issue35605] backported patch requires new sphinx, minimum sphinx version was not bumped

2019-07-03 Thread Anthony Sottile


Anthony Sottile  added the comment:

yes, as was the original PR

--

___
Python tracker 

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



[issue35605] backported patch requires new sphinx, minimum sphinx version was not bumped

2019-07-03 Thread Steve Dower


Steve Dower  added the comment:

Your PR is against 3.6 - is that intentional?

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

___
Python tracker 

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



[issue35605] backported patch requires new sphinx, minimum sphinx version was not bumped

2019-07-03 Thread Anthony Sottile


Change by Anthony Sottile :


--
pull_requests: +14395
pull_request: https://github.com/python/cpython/pull/14576

___
Python tracker 

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



[issue37495] socket.inet_aton parsing issue on some libc versions

2019-07-03 Thread Dominik Czarnota


Change by Dominik Czarnota :


--
type:  -> security

___
Python tracker 

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



[issue37495] socket.inet_aton parsing issue on some libc versions

2019-07-03 Thread Dominik Czarnota

New submission from Dominik Czarnota :

The socket.inet_aton Python function uses libc's inet_aton function. This, on 
some implementations, for example the latest GNU C Library (glibc 2.29 as of 
today), accepts whitespace with trailing characters after a valid IP.

An example can be seen below:
```
In [1]: import socket

In [2]: socket.inet_aton('1.1.1.1 this shall not pass')
Out[2]: b'\x01\x01\x01\x01'

In [3]: socket.inet_aton('1.1.1.1this shall not pass')
---
OSError   Traceback (most recent call last)
> 1 socket.inet_aton('1.1.1.1this shall not pass')

OSError: illegal IP address string passed to inet_aton
```

The problem is, some users might use this function to also validate whether a 
given host or ip string is valid, especially taking into account Python's "ask 
for forgiveness and not permission" motto (or a coding style?).

This will introduce security vulnerabilities, like command injections, if it is 
used with insecure os.system or subprocess.* functions. For example, an ip of 
"1.1.1.1 ; whoami" will result in returning an output of both ping and whoami 
commands.
```
def do_ping(request):
"""This is an insecure example, DO NOT REUSE THIS CODE"""
ip = request['ip']

# Try to parse as ipv4 and save to db as just 4 bytes
try:
   ip_bytes = socket.inet_aton(ip)
except OSError:
   return 'IP is not a valid IPv4.'

save_ping_request_to_db(ip_bytes)

return subprocess.check_output('ping -c1 %s' % ip, shell=True)  # an ip of 
"1.1.1.1 ; whomai" triggers a command injection vulnerability here
```

An initial report sent with this issue contains an example and potential 
security issue in ssl builtin module which has been already fixed 
(https://bugs.python.org/issue37463).
The socket.inet_aton function is also used in requests library utility 
functions, which I am also going to report just after sending this issue.


It is also worth mentioning that the inet_aton documentation - 
https://docs.python.org/3/library/socket.html#socket.inet_aton - states that 
the validation depends on the underlying implementation:
> inet_aton() also accepts strings with less than three dots; see the Unix 
> manual page inet(3) for details.
> If the IPv4 address string passed to this function is invalid, OSError will 
> be raised. Note that exactly what is valid depends on the underlying C 
> implementation of inet_aton().

Which is nice but:
1. The inet(3) doesn't say that inet_aton shouldn't be used to validate whether 
the input is and only is an IP address or that it accepts trailing whitespace 
with garbage.
It only states that "inet_aton() returns nonzero if the address is valid, zero 
if not". I added the relevant "DESCRIPTION" part from my `man 3 inet` on an 
Ubuntu 18.04.1 LTS host at the end.

2. The help(socket.inet_aton) doesn't forewarn about it. For example IPython 
users might miss the docs and just read the help from the shell:
> Help on built-in function inet_aton in module _socket:
> 
> inet_aton(...)
> inet_aton(string) -> bytes giving packed 32-bit IP representation
> 
> Convert an IP address in string format (123.45.67.89) to the 32-bit packed
> binary format used in low-level network functions.

3. "If the IPv4 address string passed to this function is invalid, OSError will 
be raised." vs "Note that exactly what is valid depends on (...)" is weird 
since "1.1.1.1 blabla" string *is just not a valid IPv4 address string*.


Ideally, the problem should be fixed on the libc side, but I don't know if it 
is going to be. The first comment from a similar issue on glibc bugtracker - 
https://sourceware.org/bugzilla/show_bug.cgi?id=20018 - states:
> For historic reasons, inet_addr and inet_aton accept trailing garbage.  Some 
> parsers rely on this (for example, libresolv when it parses “nameserver” 
> directives in /etc/resolv.conf).
> 
> (...)
> 
> We should add a check for trailing garbage and relegate the old behavior to a 
> compatibility symbol.

However I am not sure if it won't be fixed or if it was simply forgotten during 
fixing the linked issue as it probably wasn't reported as a separate one.

Because of that I think Python should add an additional validation of inet_aton 
input: raise a validation error when the input contains a whitespace.

In case this solution would be rejected because of a need/want to be consistent 
with C's inet_aton, we should add a security warning that using this function 
to validate IP addresses is dangerous on some libc version, along with a 
description/example what exactly is wrong with it.


--- man 3 inet, the relevant description part below ---
DESCRIPTION
   inet_aton() converts the Internet host address cp from the IPv4 
numbers-and-dots notation into binary form (in network byte order) and stores 
it in the struc‐
   ture that inp points to.  inet_aton() returns nonzero if the address is 

[issue35605] backported patch requires new sphinx, minimum sphinx version was not bumped

2019-07-03 Thread Anthony Sottile


Anthony Sottile  added the comment:

This has regressed again -- I'll make another patch

--

___
Python tracker 

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



[issue37355] SSLSocket.read does a GIL round-trip for every 16KB TLS record

2019-07-03 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
nosy: +asvetlov, yselivanov
versions: +Python 3.9

___
Python tracker 

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



[issue31517] MainThread association logic is fragile

2019-07-03 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
nosy: +aldwinaldwin, fabioz, int19h, vstinner

___
Python tracker 

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



[issue31517] MainThread association logic is fragile

2019-07-03 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
versions: +Python 3.8, Python 3.9 -Python 3.6, Python 3.7

___
Python tracker 

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



[issue37416] If threading is not imported from the main thread it sees the wrong thread as the main thread.

2019-07-03 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

This is a duplicate of #31517.

--
nosy: +pitrou
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> MainThread association logic is fragile

___
Python tracker 

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



[issue18748] io.IOBase destructor silence I/O error on close() by default

2019-07-03 Thread Yhojann Aguilera


Yhojann Aguilera  added the comment:

Same problem using Python 3.6.8 on Ubuntu 18.04 LTS.

For now, solve this using

LD_PRELOAD=libgcc_s.so.1 python3 ...

For more details and pocs: https://github.com/WHK102/wss/issues/2

--
nosy: +Yhojann Aguilera
versions: +Python 3.6

___
Python tracker 

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



[issue33408] Enable AF_UNIX support in Windows

2019-07-03 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


--
nosy: +Jeffrey.Kintscher

___
Python tracker 

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



[issue22107] tempfile module misinterprets access denied error on Windows

2019-07-03 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


--
nosy: +Jeffrey.Kintscher

___
Python tracker 

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



[issue37366] Add an "onitem" callback parameter to shutil.rmtree()

2019-07-03 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


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



[issue37366] Add an "onitem" callback parameter to shutil.rmtree()

2019-07-03 Thread Jeffrey Kintscher


Change by Jeffrey Kintscher :


--
resolution:  -> rejected

___
Python tracker 

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



[issue34896] Unable to install Python 3.5

2019-07-03 Thread Hobs


Hobs  added the comment:

I'd suggest using Anaconda to install python and all python packages that
you need. Once you have Anaconda installed you can type `conda install
django` and that should work. Also I'd suggest sticking with the lastest
version of python (3.7) that installs with anaconda rather than using
python 3.5. Django (and other packages) may not be compatible with python
3.5.
--Hobson

On Thu, Oct 4, 2018 at 9:52 AM Ruchir Jha  wrote:

>
> New submission from Ruchir Jha :
>
> Hi, I was trying to install Danjo to work on Python. However it was not
> working fine hence I uninstalled the version 3.5 which I installed and
> tried to install it again as the earlier version was used for Anaconda.
> However even after multiple attempts to install Python its throws and error
> 0x80070643 fatal error during python installation. I have restarted the
> system and have also cleared the cache. I am working under strict deaadline
> hence an urgent help will be highly appreciated
>
> --
> components: Installation
> files: Python 3.5.0rc3 (64-bit)_20181004220550_000_core_JustForMe.log
> messages: 327067
> nosy: ruchirjha
> priority: normal
> severity: normal
> status: open
> title: Unable to install Python 3.5
> type: crash
> versions: Python 3.5
> Added file: https://bugs.python.org/file47849/Python 3.5.0rc3
> (64-bit)_20181004220550_000_core_JustForMe.log
>
> ___
> Python tracker 
> 
> ___
> ___
> New-bugs-announce mailing list
> new-bugs-annou...@python.org
> https://mail.python.org/mailman/listinfo/new-bugs-announce
>

--
nosy: +Hobson.Lane

___
Python tracker 

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



[issue17535] IDLE: Add an option to show line numbers along the left side of the editor window, and have it enabled by default.

2019-07-03 Thread Ned Deily


Ned Deily  added the comment:

Tal, I took a quick look at the results with the current PR and, as someone who 
doesn't use IDLE other than to smoke test, It looks fine to me.  The concerns I 
raised previously about the interaction between changing the state of 
Options->Line Numbers and multiple windows still stands, though.  Perhaps not 
previously mentioned, this may be an issue specific to macOS where, per macOS 
interface guidelines (and as provided by Tk), there is only one instance of a 
menu bar (at the top of the screen) per app, not a menu bar per app window.  
Also, since my original review comments, we have eliminated the use on macOS of 
Tk versions older than 8.6 so previous concerns are no longer relevant.

--

___
Python tracker 

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



[issue37489] pickling instance which inherited from Exception with keyword only parameter

2019-07-03 Thread liugang


Change by liugang :


--
nosy: +alexandre.vassalotti

___
Python tracker 

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



[issue37494] Call asyncio Future in scope

2019-07-03 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

It doesn't.
Loop is executed by asyncio.run() (recommended) or low-level 
loop.run_until_complete() / loop.run_forever() calls.

Please note, this tracker is for working on Python itself, not for teaching 
Python usage.
Please use other resources like forums or stack overflow.

I'm closing the issue as there is no bug here but improper usage example.

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread Jeroen Demeyer


Change by Jeroen Demeyer :


--
pull_requests: +14394
pull_request: https://github.com/python/cpython/pull/14575

___
Python tracker 

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



[issue19696] Merge all (non-syntactic) import-related tests into test_importlib

2019-07-03 Thread miss-islington


miss-islington  added the comment:


New changeset 56ec4f1fdedd5b38deb06d94d51dd1a540262e90 by Miss Islington (bot) 
(Kyle Stanley) in branch 'master':
bpo-19696: Replace deprecated method in "test_import_pkg.py" (GH-14466)
https://github.com/python/cpython/commit/56ec4f1fdedd5b38deb06d94d51dd1a540262e90


--

___
Python tracker 

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



[issue37494] Call asyncio Future in scope

2019-07-03 Thread Fourcade


Fourcade  added the comment:

Here's the file with an example. The get_progress function always outputs 0.

--
Added file: https://bugs.python.org/file48454/test_progress.py

___
Python tracker 

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



[issue37494] Call asyncio Future in scope

2019-07-03 Thread Fourcade


Fourcade  added the comment:

If I add a simple print inside long_task, the print is executed correctly. So 
it seems this code actually runs the loop. 

(I'm on python 3.6.8).

--

___
Python tracker 

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



[issue37494] Call asyncio Future in scope

2019-07-03 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Your code doesn't run the event loop, only creates it.
What do you expect?

--

___
Python tracker 

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



[issue37494] Call asyncio Future in scope

2019-07-03 Thread Fourcade


New submission from Fourcade :

I'm trying to get the progession of my asyncIO Futures. For some reason, I 
can't get value updates inside any other scope.

For example:

```
import concurrent.futures
import time
import asyncio
import random

def get_progress(futures):
return sum([f.done() for f in futures])

def long_task(t):
time.sleep(1.5)
return t

loop = asyncio.get_event_loop()
executor = concurrent.futures.ProcessPoolExecutor(max_workers=4)
inputs = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
futures_ = [loop.run_in_executor(executor, long_task, i) for i in inputs]

for i in range(5):
time.sleep(1)
print(get_progress(futures_))
```

It prints only 0. However, if I run this inside a terminal and call 
get_progress(futures_) it prints 7 as expected.

Am I missing something here ?

--
components: asyncio
messages: 347232
nosy: RobinFrcd, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Call asyncio Future in scope
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

Test of stack usage:

from _testcapi import stack_pointer
class D(dict):
def __missing__(self, key):
sp = stack_pointer()
print(f"stack usage = {TOP - sp}")
return None
d = D()
TOP = stack_pointer()
d[0]


**before**: stack usage = 1296
**after**: stack usage = 976

--

___
Python tracker 

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



[issue37493] Use _PyObject_CallNoArg() in a few more places

2019-07-03 Thread Jeroen Demeyer


Change by Jeroen Demeyer :


--
keywords: +patch
pull_requests: +14393
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/14575

___
Python tracker 

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



[issue37493] Use _PyObject_CallNoArg() in a few more places

2019-07-03 Thread Jeroen Demeyer


New submission from Jeroen Demeyer :

Try to use _PyObject_CallNoArg in all places where a function is called without 
arguments.

--
components: Interpreter Core
messages: 347230
nosy: jdemeyer
priority: normal
severity: normal
status: open
title: Use _PyObject_CallNoArg() in a few more places
versions: Python 3.9

___
Python tracker 

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



[issue37233] Use _PY_FASTCALL_SMALL_STACK for method_vectorcall

2019-07-03 Thread miss-islington


miss-islington  added the comment:


New changeset 1099e343e88ddfb46b84ba4ffc6ecc449b7f7891 by Miss Islington (bot) 
in branch '3.8':
bpo-37233: optimize method_vectorcall in case of totalargs == 0 (GH-14550)
https://github.com/python/cpython/commit/1099e343e88ddfb46b84ba4ffc6ecc449b7f7891


--
nosy: +miss-islington

___
Python tracker 

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



[issue37474] Should Py_Initialize() control the floating point mode?

2019-07-03 Thread Mark Dickinson


Mark Dickinson  added the comment:

The current FreeBSD documentation for fedisableexcept says:

> All exceptions are masked by default.

Source: 
https://www.freebsd.org/cgi/man.cgi?query=fedisableexcept=0=0=FreeBSD+12.0-RELEASE+and+Ports=default=html

So it looks as though it may be safe to remove this.

--

___
Python tracker 

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



[issue37233] Use _PY_FASTCALL_SMALL_STACK for method_vectorcall

2019-07-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14392
pull_request: https://github.com/python/cpython/pull/14574

___
Python tracker 

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



[issue37233] Use _PY_FASTCALL_SMALL_STACK for method_vectorcall

2019-07-03 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset c7570d402e3ee8717615ffa020eb9e2215a77660 by Inada Naoki in branch 
'3.8':
[3.8] bpo-37233: use _PY_FASTCALL_SMALL_STACK in method_vectorcall (GH-13974)
https://github.com/python/cpython/commit/c7570d402e3ee8717615ffa020eb9e2215a77660


--

___
Python tracker 

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



[issue37474] Should Py_Initialize() control the floating point mode?

2019-07-03 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +tim.peters

___
Python tracker 

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



[issue37474] Should Py_Initialize() control the floating point mode?

2019-07-03 Thread Mark Dickinson


Mark Dickinson  added the comment:

> What is the behavior on FreeBSD when fedisableexcept(FE_OVERFLOW) is not 
> called?

That's an excellent question, that I'd love to have an answer to for currently 
supported FreeBSD versions.

I think the old behaviour is that anything that you'd expect to raise an FPE 
(e.g., `math.sqrt(-1.0)` would segfault the interpreter). It may be that that's 
no longer an issue with FreeBSD versions that we care about.

That code comment dates from over 16 years ago (see 
https://github.com/python/cpython/commit/4643bd9a9cf43332992d10982c52debf3f0d980c),
 so there's some hope that the situation's changed since then.

--

___
Python tracker 

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



[issue37492] should email.utils.parseaddr treat a@b. as invalid email ?

2019-07-03 Thread jpic


jpic  added the comment:

Thanks a heap Eric, I feel a bit silly I missed it.

Closing the issue as not a bug, please feel free to reopen if necessary.

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

Victor, what's your opinion on adding PyObject_CallOneArg() to the limited API?

--

___
Python tracker 

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



[issue37233] Use _PY_FASTCALL_SMALL_STACK for method_vectorcall

2019-07-03 Thread Inada Naoki


Change by Inada Naoki :


--
pull_requests: +14391
pull_request: https://github.com/python/cpython/pull/14573

___
Python tracker 

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



[issue34155] email.utils.parseaddr mistakenly parse an email

2019-07-03 Thread jpic


jpic  added the comment:

Thanks for the kind words Cyril, sorry that this patch doesn't address exactly 
the issue that you have described initially, but rather the security issue 
related to it.

The exception depending on the parsing issue is already supported by the new 
API, although it's just "Invalid Domain" for now. For user interfaces it would 
be nice to detail parse errors indeed. Again I wonder if this should be a 
separate issue.

Concerning the default behavior, @maxking will know but I would try to defend 
the "secure by default" paradigm if necessary, especially in the deprecated 
API. Meanwhile, I think it would create more value for Python to invest in 
feature development in the new API, that has a very nice private API but 
apparently lacks unit tests and documentation before becoming available to 
users.

--

___
Python tracker 

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread Inada Naoki


Inada Naoki  added the comment:

I don't want to add many functions to limited/public APIs.
Note that public APIs defined outside of cpython/ are considered mandatory for 
all Python implementations supporting Python/C API.

When portability is more important than performance, there are many APIs 
already.
Please keep _PyObject_CallOneArg() as just an easy wrapper of 
_PyObject_Vectorcall which is CPython specific in this issue.

Candidate of revert: _csv, _decimal, _sqlite, pyexpat, _testbuffer, _xxtestfuzz
They doesn't use much private APIs, or they are tests which is useful for other 
interpreters.

--

___
Python tracker 

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



[issue37492] should email.utils.parseaddr treat a@b. as invalid email ?

2019-07-03 Thread Eric V. Smith


Eric V. Smith  added the comment:

Counterpoint: I just sent an email to "info@info.", and Thunderbird and my MTA 
(postfix) and my mail relay all accepted it. I guess it's possible that a TLD 
(especially one of the newer ones) could accept email addresses in the TLD 
itself.

It turns out that "info@info." isn't a mailbox as of right now, but I think 
it's a valid and accepted address, at least by the software listed above. And 
it could be a valid mailbox, just isn't in this particular case.

Maybe the more conservative approach is to say that "info@info." (and "a@b.", 
etc.) should be considered valid email addresses.

If you were actually trying to send email to a mailbox in the "info" TLD, I 
think most resolvers would resolve "info" as a relative domain name, which 
isn't what we'd want to happen: you'd have to specify the domain as "info.".

--

___
Python tracker 

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

Stefan: I used an underscore by analogy with 
PyObject_CallNoArgs()/_PyObject_CallNoArg(), where the first is in the limited 
API and the second is an inline function in the cpython API.

But maybe we could revisit that decision.

--

___
Python tracker 

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



[issue37492] should email.utils.parseaddr treat a@b. as invalid email ?

2019-07-03 Thread Eric V. Smith


Eric V. Smith  added the comment:

RFC 1034 defines absolute domain names as ending with dot:


When a user needs to type a domain name, the length of each label is omitted 
and the labels are separated by dots (".").  Since a complete domain name ends 
with the root label, this leads to a printed form which ends in a dot.  We use 
this property to distinguish between:

   - a character string which represents a complete domain name
 (often called "absolute").  For example, "poneria.ISI.EDU."

   - a character string that represents the starting labels of a
 domain name which is incomplete, and should be completed by
 local software using knowledge of the local domain (often
 called "relative").  For example, "poneria" used in the
 ISI.EDU domain.


I'll admit that it isn't common to specify absolute domain names, and many 
resolvers treat a domain name with an internal dot, but no terminal dot, as an 
absolute name.

I doubt in practice there are any email addresses that have a TLD name. 

There's some bpo issue where this was discussed in reference to the ipaddress 
module. I think the issues was canonicalizing names, and it was decided not to 
add trailing dot to make them absolute. I realize that logic doesn't directly 
apply here.

In spite of "com." being a valid domain name, I think it's reasonable to reject 
it as the domain part of an email address. But there should be a comment in the 
code as such.

--
nosy: +eric.smith

___
Python tracker 

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> Is there any benchmark showing if it's faster

Here is one example:

class D(dict):
def __missing__(self, key):
return None
d = D()

and now benchmark d[0]

**before**: Mean +- std dev: 173 ns +- 1 ns
**after**: Mean +- std dev: 162 ns +- 1 ns

To be precise, I ran: ./python -m perf timeit --duplicate 200 -s 'class 
D(dict):' -s ' def __missing__(self, key):' -s '  return None' -s 'd = D()' 
'd[0]'

--

___
Python tracker 

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



[issue37233] Use _PY_FASTCALL_SMALL_STACK for method_vectorcall

2019-07-03 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 53c214344038341ce86fcf7efa12dc33be9d5b45 by Inada Naoki (Jeroen 
Demeyer) in branch 'master':
bpo-37233: optimize method_vectorcall in case of totalargs == 0 (GH-14550)
https://github.com/python/cpython/commit/53c214344038341ce86fcf7efa12dc33be9d5b45


--

___
Python tracker 

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread Stefan Krah


Stefan Krah  added the comment:

> Or do you care about *using* API with underscore?  If so, I'm OK to stop 
> changing some callers which are not tightly coupled with Python.

I care about this one.  Indeed I think underscore functions should be used in 
strategic places inside the core interpreter and not sprinkled across the whole 
code base by default.


But in general I also care about not having too many new functions to avoid 
churn.

--

___
Python tracker 

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



[issue37484] Use PY_VECTORCALL_ARGUMENTS_OFFSET for __exit__

2019-07-03 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 469d1a70cecc918499c288fc0e5e3d79711bc5e5 by Inada Naoki (Jeroen 
Demeyer) in branch 'master':
bpo-37484: use _PyObject_Vectorcall for __exit__ (GH-14557)
https://github.com/python/cpython/commit/469d1a70cecc918499c288fc0e5e3d79711bc5e5


--

___
Python tracker 

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



[issue37421] Some tests leak temporary files

2019-07-03 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +14390
pull_request: https://github.com/python/cpython/pull/14572

___
Python tracker 

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread Inada Naoki


Inada Naoki  added the comment:

> It adds yet another special case underscore function that one cannot use in 
> external projects. So I would not say that is simpler.

I don't get what you mean.

Do you care about *adding* API with underscore?  If so, it doesn't make caller 
code complex.  It can not be a reason to reject changing many files.

Or do you care about *using* API with underscore?  If so, I'm OK to stop 
changing some callers which are not tightly coupled with Python.  (e.g. sqlite)

--

___
Python tracker 

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread STINNER Victor


STINNER Victor  added the comment:

> Exactly. I see no reason to prefer PyObject_CallFunctionObjArgs(func, arg, 
> NULL) over _PyObject_CallOneArg(func, arg)

In this case, maybe the whole idea of _PyObject_CallOneArg() is not worth it?

Is there any benchmark showing if it's faster or use less stack?

--

___
Python tracker 

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



[issue37490] poor documentation for .startswith, .endswith

2019-07-03 Thread Glenn Linderman


Glenn Linderman  added the comment:

Thanks for the explanations and suggestions. Now that I think I know what those 
parameters are used for...

Sorry, my first example was tweaked on the fly, and doesn't make as much sense 
as it could because it wound up being a mix of pre-tweaked and tweaked text, as 
Steven points out at the beginning of msg347194.

But the text he suggests in msg347195 would be an immense clarification to the 
existing text. The existing text is worded in such a way that it is not clear 
how the start and end parameters affect the search, except by analogy with 
other slicing operations in other parts of Python. Steven may be willing to 
draw such analogies to perceive that the current startswith documentation is 
clear, but if you go in with an open mind, uncluttered with the 
better-specified behavior of other Python operations, there are lots of 
possible interpretations. Describing the start/end parameters with defaults and 
explaining the whole operation as referring to the slice specified by those 
parameters makes it far less open to other interpretations.

The text Aldwin suggests in msg347188 (from re) is better than the original for 
startswith/endswith, but is not as clear as Steven's wording. I would actually 
suggest that Steven's wording could be the basis for an improvement for the re 
docs as quoted.

The second part, the "prefix can also be a tuple of prefixes to look for" could 
also be improved... neither prefix nor tuple of prefixes is defined as being a 
string.

Further, if the parameter syntax is shown with the defaults, then the 
parethetical comments about (defaults to...) are not really necessary, 
simplifying the description to:

The prefix parameter can be a single string, or a tuple of strings.
Return True if the slice of string specified by [start:end] starts with any 
complete string supplied as part of the prefix parameter, otherwise return 
False.

--

___
Python tracker 

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> It adds yet another special case underscore function that one cannot use in 
> external projects. So I would not say that is simpler.

If you're worried about the underscore, I will make a separate PR to add a 
non-underscored version, similar to PyObject_CallNoArgs()

--

___
Python tracker 

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread Stefan Krah


Stefan Krah  added the comment:

It adds yet another special case underscore function that one cannot use in 
external projects. So I would not say that is simpler.


Has there been any performance measurement at all?

--

___
Python tracker 

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

Exactly. I see no reason to prefer PyObject_CallFunctionObjArgs(func, arg, 
NULL) over _PyObject_CallOneArg(func, arg)

--

___
Python tracker 

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread Inada Naoki


Inada Naoki  added the comment:

This change doesn't make caller code complicated.  It makes caller little 
simpler.

Choosing performance sensitive code is much hard than replace all occurrences.
So I'm OK to change all callers except code owner opposed at once.

--

___
Python tracker 

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



[issue37492] should email.utils.parseaddr treat a@b. as invalid email ?

2019-07-03 Thread jpic

New submission from jpic :

Following up bpo-34155[0] PR#13079[1], which changes:

>>> parseaddr('a@malicious@good')

>From returning:

('', 'a@malicious')

To return:

('', '')

As such, parseaddr behaves more like documented:

email.utils.parseaddr(address)
Parse address – which should be the value of some address-containing field such 
as To or Cc – into its constituent realname and email address parts. Returns a 
tuple of that information, unless the parse fails, in which case a 2-tuple of 
('', '') is returned.

The pull request discussion suggested that it would be good to open a new bpo 
to discuss changing the following behaviour:

parseaddr('a@b.')

>From returning:

('', 'a@b.')

To return a tuple of empty strings as well.

We have not found RFC to back up that `a@b.` was not a valid email, however RFC 
1034 states that dots separate labels:

When a user needs to type a domain name, the length of each label is
omitted and the labels are separated by dots (".").

As such, my understanding is that a valid domain must not end with a dot.

[0] https://bugs.python.org/issue34155
[1] https://github.com/python/cpython/pull/13079

--
components: email
messages: 347207
nosy: barry, jpic, r.david.murray
priority: normal
severity: normal
status: open
title: should email.utils.parseaddr treat a@b. as invalid email ?
type: behavior

___
Python tracker 

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread Stefan Krah


Stefan Krah  added the comment:

The motivation for this PR is "it would be convenient to have this function".

This is probably true, but generally I would not change 47 files at once.

Most of the locations are probably not performance sensitive.

--
nosy: +skrah

___
Python tracker 

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread Inada Naoki


Inada Naoki  added the comment:

> Macros cannot be used in all C extensions. For the PEP 587, I was asked to 
> replace macros with functions.

This is just an helper inline function / macro to ease calling 
_PyObject_Vectorcall.
Extensions can port this helper inline function / macro to ease calling 
_PyObject_Vectorcall.

I don't want to make this non-inline function.

--

___
Python tracker 

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



[issue37421] Some tests leak temporary files

2019-07-03 Thread miss-islington


miss-islington  added the comment:


New changeset 0aefba7f99f0fd9bcb3328a5919e07f9e03676b0 by Miss Islington (bot) 
in branch '3.8':
bpo-37421: Fix test_distutils.test_build_ext() (GH-14564)
https://github.com/python/cpython/commit/0aefba7f99f0fd9bcb3328a5919e07f9e03676b0


--

___
Python tracker 

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> PEP 7 uses C99 since Python 3.6: 
> https://www.python.org/dev/peps/pep-0007/#c-dialect

That's not what the PEP says: "Python versions greater than or equal to 3.6 use 
C89 with several select C99 features"

"several select C99 features" is not the same of using C99.

Plus, I'm also worried about C++. We also support compiling C++ extensions with 
the same header files, so it must be C++ compatible also.

--

___
Python tracker 

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> _PyObject_CALL_WITH_ARGS(func, PyDict_GetItem(d, key)); // PyDict_GetItem(d, 
> key) is called twice.

Actually, it's not a problem: sizeof() is special, it only looks at the type of 
its argument, it doesn't execute the code.

--

___
Python tracker 

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



[issue36881] isinstance raises TypeError for metaclass with metaclass=ABCMeta

2019-07-03 Thread myungsekyo


Change by myungsekyo :


--
nosy: +myungsekyo

___
Python tracker 

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



[issue37421] Some tests leak temporary files

2019-07-03 Thread miss-islington


miss-islington  added the comment:


New changeset 79665c698fb8f97475e03c4231067db1ae47addb by Miss Islington (bot) 
in branch '3.8':
bpo-37421: test_concurrent_futures cleans up multiprocessing (GH-14563)
https://github.com/python/cpython/commit/79665c698fb8f97475e03c4231067db1ae47addb


--

___
Python tracker 

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> _PyObject_CALL_WITH_ARGS(func, PyDict_GetItem(d, key)); // PyDict_GetItem(d, 
> key) is called twice.

That's pretty bad and in my opinion a good reason to reject this idea.

> If two or more arguments are not common, I prefer _PyObject_CallOneArg to 
> macro.

I posted some counts at 
https://mail.python.org/archives/list/capi-...@python.org/message/3I76R27YMFSKB5JQIM3E4NA3BECVTZHP/

--

___
Python tracker 

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



[issue37421] Some tests leak temporary files

2019-07-03 Thread miss-islington


miss-islington  added the comment:


New changeset a2a807f75dc162dfb45fb297aee4961de8008f84 by Miss Islington (bot) 
in branch '3.8':
bpo-37421: test_winconsoleio doesn't leak temp file anymore (GH-14562)
https://github.com/python/cpython/commit/a2a807f75dc162dfb45fb297aee4961de8008f84


--

___
Python tracker 

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread Inada Naoki


Inada Naoki  added the comment:

AFAIK, gcc, clang, and MSVC support it.

Another cons is, general pitfall of macro:

  _PyObject_CALL_WITH_ARGS(func, PyDict_GetItem(d, key)); // PyDict_GetItem(d, 
key) is called twice.

If two or more arguments are not common, I prefer _PyObject_CallOneArg to macro.

--

___
Python tracker 

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



[issue37411] testEnviron (test.test_wsgiref.HandlerTests) fails when environment variable X is set

2019-07-03 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests:  -14383

___
Python tracker 

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread STINNER Victor


STINNER Victor  added the comment:

> Variadic macros are not part of C89, so that would require changing PEP 7.

PEP 7 uses C99 since Python 3.6:
https://www.python.org/dev/peps/pep-0007/#c-dialect

> What do you think about macro like this?

Macros cannot be used in all C extensions. For the PEP 587, I was asked to 
replace macros with functions.

I would prefer a PyObject_CallOneArg() function than yet another ugly and 
dangerous macro. Sometimes, a regular function is better for stack consumption: 
it doesn't increase the stack consumption in the call site, stack memory is 
"released" once PyObject_CallOneArg() exit. In the past, I had to disable 
inlining in some functions to reduce the stack consumption. (I'm not sure if 
this optimization is still around.)

--

___
Python tracker 

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



[issue37483] Add PyObject_CallOneArg()

2019-07-03 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> Cons: readability...

It's a single relatively short macro. I'm not worried about that. I'm more 
about compiler support for such macros. I'll make a PR with this idea and see 
what CI says.

--

___
Python tracker 

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



[issue37490] poor documentation for .startswith, .endswith

2019-07-03 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Perhaps it would help if we spelled out the behaviour more explicitly?


str.startswith(prefix[, start=0[, end=len(string)]])

Return True if the slice of string between start (defaults to the beginning 
of the string) and end (defaults to the end of the string) starts with the 
prefix, otherwise return False. prefix can also be a tuple of prefixes to look 
for.


(To be frank, I don't think we need to do this, I think the docs are fine 
as-is, but if others disagree perhaps this is an improvment.)

--

___
Python tracker 

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



[issue37421] Some tests leak temporary files

2019-07-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14389
pull_request: https://github.com/python/cpython/pull/14571

___
Python tracker 

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



[issue37490] poor documentation for .startswith, .endswith

2019-07-03 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Here are links to the relevant docs:

https://docs.python.org/3/library/stdtypes.html#str.startswith
https://docs.python.org/3/library/stdtypes.html#str.endswith

Both say:

"With optional *start*, test string beginning at that position. With optional 
*end*, stop comparing string at that position."

That seems perfectly clear to me: if you pass a starting position, the *starts 
with* test (or ends with) considers the substring starting at that position. If 
you pass an ending position, the starts with test considers the substring 
ending at that position.

That makes it equivalent to text[start:end].startswith(prefix) except that no 
copying is done.

It seems that you are reading the start and end positions as somehow requiring 
that the prefix be an exact match for the given slice, e.g. when you ask:

> must it fail because it doesn't match all of text[2:8] ?

and later:

> can only year match because of the start and end?

These questions imply you think that the methods require the specified slice 
*equals* the given affix (prefix/suffix) rather than *start* or *end* with. 
That seems to me to be an unjustified interpretation of what the docs say.

In the absence of any evidence to the contrary, we are surely entitled to 
assume that the *startswith* method remains *startswith* regardless of whether 
a slice (start/end positions) is specified or not. Or to put it another way, it 
goes without saying that specifying a slice (start and/or end positions) 
doesn't change the semantics of the method, it only changes the starting and 
ending positions, precisely as already documented.


Glenn asked:

> text = "Now the day is over"
> text.startswith('the', 2, 8)
> Does it produce True because 'w the' is at the beginning of the text[2:] ?

No, it produces False, because text[2:8] does not start with "the", it starts 
with "w".

> Maybe. Or because there is an ending position, must it fail because it 
> doesn't match all of text[2:8] ?

If fails, but that's not why it fails. If fails because the substring doesn't 
start with the prefix, not because it doesn't equal the prefix.

> text.startswith('day', 8, 10)
> Does this produce True because everything in day matches text[8:10] 

No, it produces False because the substring in the half-open slice 8:10 does 
not start with "day".

> or must it always produce false for any value of text because the
> match is never as long as the prefix string?

Correct, since the slice is only 2 characters long, and the prefix is 3 
characters long, hence the slice can never begin with that prefix.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue37421] Some tests leak temporary files

2019-07-03 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 74c9dd57771f4f061ee83b069c8e7b37de41246b by Victor Stinner in 
branch 'master':
bpo-37421: Fix test_distutils.test_build_ext() (GH-14564)
https://github.com/python/cpython/commit/74c9dd57771f4f061ee83b069c8e7b37de41246b


--

___
Python tracker 

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



[issue37421] Some tests leak temporary files

2019-07-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14388
pull_request: https://github.com/python/cpython/pull/14570

___
Python tracker 

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



[issue37421] Some tests leak temporary files

2019-07-03 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 684cb47fffb7af3ac50cb077f6d2a095c9ce20b4 by Victor Stinner in 
branch 'master':
bpo-37421: test_concurrent_futures cleans up multiprocessing (GH-14563)
https://github.com/python/cpython/commit/684cb47fffb7af3ac50cb077f6d2a095c9ce20b4


--

___
Python tracker 

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



[issue37421] Some tests leak temporary files

2019-07-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14387
pull_request: https://github.com/python/cpython/pull/14569

___
Python tracker 

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



[issue37421] Some tests leak temporary files

2019-07-03 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b71d8d67959f3b5efbdfe00066589ac0d8f98aad by Victor Stinner in 
branch 'master':
bpo-37421: test_winconsoleio doesn't leak temp file anymore (GH-14562)
https://github.com/python/cpython/commit/b71d8d67959f3b5efbdfe00066589ac0d8f98aad


--

___
Python tracker 

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



[issue37491] IndexError in get_bare_quoted_string

2019-07-03 Thread Abhilash Raj


New submission from Abhilash Raj :

from email.parser import BytesParser, Parser
from email.policy import default

payload = 'Content-Type:x;\x1b*="\'G\'\\"'
msg = Parser(policy=default).parsestr(payload)
print(msg.get('content-type'))


When trying to review PR for BPO 37461, I found another bug where an IndexError
is raised if there aren't closing quote characters in the input message:

Suggested patch:

@@ -1191,7 +1192,7 @@ def get_bare_quoted_string(value):
 "expected '\"' but found '{}'".format(value))
 bare_quoted_string = BareQuotedString()
 value = value[1:]
-if value[0] == '"':
+if value and value[0] == '"':
 token, value = get_qcontent(value)
 bare_quoted_string.append(token)
 while value and value[0] != '"':

--
components: email
messages: 347190
nosy: barry, maxking, r.david.murray
priority: normal
severity: normal
status: open
title: IndexError in get_bare_quoted_string
type: crash
versions: Python 3.8, Python 3.9

___
Python tracker 

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



[issue37490] poor documentation for .startswith, .endswith

2019-07-03 Thread Aldwin Pollefeyt


Aldwin Pollefeyt  added the comment:

correction:

... otherwise, text.startswith(prefix, start, end) gives the same result as 
text[start:end].startswith(prefix).

--

___
Python tracker 

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



  1   2   >