[issue38323] asyncio: MultiLoopWatcher has a race condition (test_asyncio: test_close_kill_running() hangs on AMD64 RHEL7 Refleaks 3.x)

2020-05-08 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

I looked into this a little after reproducing it locally.

What I found is that MultiLoopChildWatcher._sig_chld() *is* called. It's just 
that it's only called immediately after timeout=5 has elapsed. (The timeout=5 
was added by Andrew here: 
https://github.com/python/cpython/blob/7f7e706d78ab968a1221c6179dfdba714860bd12/Lib/test/test_asyncio/test_subprocess.py#L480
 )

Consider this line in asyncio.tasks.wait_for(), which is to trigger the timeout:
https://github.com/python/cpython/blob/7f7e706d78ab968a1221c6179dfdba714860bd12/Lib/asyncio/tasks.py#L476

  timeout_handle = loop.call_later(timeout, _release_waiter, waiter)

I put some debug statements inside _release_waiter, and I found that 
_sig_chld() is called after the timeout has elapsed and before _release_waiter 
starts. So basically, it looks like CPython is holding onto the signal, and 
waiting for the loop to do something more before running the handler and 
calling the _sig_chld().

The code base already has logic to skip running signal handlers in various 
cases, but I don't know whether it relates to this issue:
https://github.com/python/cpython/blob/7f7e706d78ab968a1221c6179dfdba714860bd12/Python/ceval.c#L1410-L1425

It seems like there are a number of issues on the tracker related to signals 
(some solved and others not, e.g. https://bugs.python.org/issue21895 ). So it 
looks to me like this could point to a deeper issue between asyncio and 
CPython's signal handling.

--
nosy: +chris.jerdonek

___
Python tracker 

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



[issue40574] segfault causing regression from PEP 573 implementation

2020-05-08 Thread Thomas Caswell


Thomas Caswell  added the comment:

Sorry, forgot to add this is on Linux.

--

___
Python tracker 

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



[issue40574] segfault causing regression from PEP 573 implementation

2020-05-08 Thread Thomas Caswell

New submission from Thomas Caswell :

https://github.com/python/cpython/commit/e1becf46b4e3ba6d7d32ebf4bbd3e0804766a423
 causes pyqt5 to segfault an accessing an attribute

To reproduce this:


pip install pyqt5
pip install sip
python -c "import PyQt5.QtCore; PyQt5.QtCore.Qt.Key_Control"  # this segfaults

Setting up faulthandler gives:

jupiter@23:54  ➤  python -X faulthandler -c "import PyQt5.QtCore; 
PyQt5.QtCore.Qt.Key_Control"
Fatal Python error: Segmentation fault

Current thread 0x7f52111cd740 (most recent call first):

Segmentation fault (core dumped)

It is likely that this should also be reported to riverbank as a pyqt/sip bug, 
but I'm starting here.  I apologize for not having a simpler reproducing case.




jupiter@00:01  ➤ git bisect log
git bisect start
# good: [2d8757758d0d75882fef0fe0e3c74c4756b3e81e] bpo-40286: Remove C 
implementation of Random.randbytes() (GH-19797)
git bisect good 2d8757758d0d75882fef0fe0e3c74c4756b3e81e
# bad: [d10091aa171250c67a5079abfe26b8b3964ea39a] bpo-40502: Initialize 
n->n_col_offset (GH-19988)
git bisect bad d10091aa171250c67a5079abfe26b8b3964ea39a
# good: [c3f001461d5794c81cf5f70e08ae5435fe935ceb] bpo-40491: Fix typo in 
syntax error for numeric literals (GH-19893)
git bisect good c3f001461d5794c81cf5f70e08ae5435fe935ceb
# good: [c21c51235aa8061da6b0593d6f857f42fd92fd8b] bpo-40355: Improve error 
messages in ast.literal_eval with malformed Dict nodes (GH-19868)
git bisect good c21c51235aa8061da6b0593d6f857f42fd92fd8b
# good: [c1c7d8ead9eb214a6149a43e31a3213c52448877] bpo-40397: Refactor 
typing._GenericAlias (GH-19719)
git bisect good c1c7d8ead9eb214a6149a43e31a3213c52448877
# bad: [c068b53a0ca6ebf740d98e422569d2f705e54f93] bpo-38787: Update 
structures.rst docs (PEP 573) (GH-19980)
git bisect bad c068b53a0ca6ebf740d98e422569d2f705e54f93
# good: [4638c6429575bd6de26b12b2af5df74d6568b553] bpo-40334: Error message for 
invalid default args in function call (GH-19973)
git bisect good 4638c6429575bd6de26b12b2af5df74d6568b553
# bad: [8963a7f1f84a05412178b56629508b660d38861b] bpo-40545: Export 
_PyErr_GetTopmostException() function (GH-19978)
git bisect bad 8963a7f1f84a05412178b56629508b660d38861b
# bad: [e1becf46b4e3ba6d7d32ebf4bbd3e0804766a423] bpo-38787: C API for module 
state access from extension methods (PEP 573) (GH-19936)
git bisect bad e1becf46b4e3ba6d7d32ebf4bbd3e0804766a423
# first bad commit: [e1becf46b4e3ba6d7d32ebf4bbd3e0804766a423] bpo-38787: C API 
for module state access from extension methods (PEP 573) (GH-19936)

--
components: C API
messages: 368499
nosy: tcaswell
priority: normal
severity: normal
status: open
title: segfault causing regression from PEP 573 implementation
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



[issue40573] inspect.iscorutinefunction() returns False for unittest.mock.AsyncMock instances

2020-05-08 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I couldn't reproduce the change in result for consecutive calls on master 
branch. They should return the same value.

./python   
Python 3.9.0a6+ (heads/master:7f7e706d78, May  9 2020, 04:00:36) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import unittest.mock
>>> import inspect
>>> import asyncio
>>> inspect.iscoroutinefunction(unittest.mock.AsyncMock())
False
>>> inspect.iscoroutinefunction(unittest.mock.AsyncMock())
False
>>> inspect.iscoroutinefunction(unittest.mock.AsyncMock())
False

--
components: +Library (Lib) -Tests

___
Python tracker 

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



[issue40573] inspect.iscorutinefunction() returns False for unittest.mock.AsyncMock instances

2020-05-08 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +lisroach, xtreak

___
Python tracker 

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



[issue40573] inspect.iscorutinefunction() returns False for unittest.mock.AsyncMock instances

2020-05-08 Thread Moriyoshi Koizumi


New submission from Moriyoshi Koizumi :

inspect.iscoroutinefunction() returns False for unittest.mock.AsyncMock 
instances while asyncio.iscoroutinefunction() returns True.

```
>>> import unittest.mock
>>> import inspect
>>> import asyncio
>>> inspect.iscoroutinefunction(unittest.mock.AsyncMock())
False
>>> asyncio.iscoroutinefunction(unittest.mock.AsyncMock())
True
```

Confirmed with 3.8.2 and 3.9dev

--
components: Tests
messages: 368497
nosy: moriyoshi
priority: normal
severity: normal
status: open
title: inspect.iscorutinefunction() returns False for unittest.mock.AsyncMock 
instances
type: behavior
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



[issue40551] PRs should be rebased on top of master before running the build/tests

2020-05-08 Thread Inada Naoki


Inada Naoki  added the comment:

>  See also 
> https://mail.python.org/archives/list/python-committ...@python.org/thread/WEU5CQKIA4LIHWHT53YA7HHNUY5H2FUT/.
>   This was a problem with other CI GitHub actions when a change had to be 
> merged to master with which all PRs need to be manually rebased to pass.

This is an example of "master branch grow after PR is created anyway."

This issue proposes " this only works at the time the pull request is created." 
 It doesn't help that case.

--

___
Python tracker 

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



[issue40551] PRs should be rebased on top of master before running the build/tests

2020-05-08 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

See also 
https://mail.python.org/archives/list/python-committ...@python.org/thread/WEU5CQKIA4LIHWHT53YA7HHNUY5H2FUT/.
  This was a problem with other CI GitHub actions when a change had to be 
merged to master with which all PRs need to be manually rebased to pass.

--
nosy: +xtreak

___
Python tracker 

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



[issue40551] PRs should be rebased on top of master before running the build/tests

2020-05-08 Thread Inada Naoki


Inada Naoki  added the comment:

I don't think this is a real issue we should solve:

* Travis-CI, at least, does test against "merge commit", not HEAD of PR branch.
* As you said already, master branch grow after PR is created anyway.
* We run CI and buildbots against master branch too.  So we can find breakage 
soon when something go wrong.

--
nosy: +inada.naoki

___
Python tracker 

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



[issue40553] Python 3.8.2 Mac freezing/not responding when saving new programs

2020-05-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

What is acting up here is the Catalina system SaveAs dialog on some systems 
with some settings when closing after being asked to display the current 
contents of the target location, allow the content to be variously filtered or 
not, and add a default extension.  (I use all of these features.)  I looked at 
3 Apple apps, Safari, Maps, and they omit the content display, and hence 
filtering. It it is only the display that is bugged, they would not show the  
problem.

--

___
Python tracker 

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



[issue40550] Popen.terminate fails with ProcessLookupError under certain conditions

2020-05-08 Thread Alexander Overvoorde


Alexander Overvoorde  added the comment:

I understand that it's not a perfect solution, but at least it's a little bit 
closer. Thanks for your patch :)

--

___
Python tracker 

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



[issue40570] len(platform.uname()) has changed in Python 3.9

2020-05-08 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Thanks David for the report and the draft PR (which helped me validate my 
thinking on the matter). In PR 20015, I've included additional tests. I've also 
re-written the compatibility functions to rely on the main `__iter__` override.

Another situation that's likely to be incompatible is pickleability. Is that 
important?

I'm tempted to make deprecated the use of `uname_result` for anything other 
than attribute access (maybe with the ability to cast to a tuple, i.e. 
`tuple(res)`). The problem with namedtuples is that although they provide 
backward-compatibility for legacy behavior which returned tuples, they also 
bring that legacy as debt. By deprecating "access by index", that would 
constrain the interface to two basic usages: attribute access and `iter()` of 
all values.

--

___
Python tracker 

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



[issue39791] New `files()` api from importlib_resources.

2020-05-08 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

I've merged PR 19722. Some follow up actions I'd like to do:

- Add hooks for `.files()` on built-in loaders.
- Replace `loader.get_resource_reader()` with adapters around `.files()` for 
built-in loaders.

--

___
Python tracker 

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



[issue40570] len(platform.uname()) has changed in Python 3.9

2020-05-08 Thread Jason R. Coombs


Change by Jason R. Coombs :


--
pull_requests: +19326
pull_request: https://github.com/python/cpython/pull/20015

___
Python tracker 

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



[issue40553] Python 3.8.2 Mac freezing/not responding when saving new programs

2020-05-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

When I click Full Disk Access in Mohave, I see an empty box with a Header 
something like "All app to access Mail, ..., and all user data".  None of it 
has anything obviously to do with the user Documents folder.  Nor does it seem 
appropriate for a non-top-admin user on a multiuser machine.  Below the box are 
[+][-] buttons.  [+] opens the standard open dialog to select an app to add.  
There is nothing like 
  [ ] Add Python and IDLE

Ned, is Catalina known to have tightened up some security settings?

--

___
Python tracker 

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



[issue40553] Python 3.8.2 Mac freezing/not responding when saving new programs

2020-05-08 Thread Zain Said


Zain Said  added the comment:

Ned, I do not use DropBox nor do i have Desktop & Documents Folders checked 
under my iCloud settings. 

Someone else in the community reached out to me and suggested that if IDLE is 
acting up its not worth the hassle. And that they're alternatives. I came a 
across an editor called Atom. Seems interesting. Might give it a try.

--

___
Python tracker 

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



[issue40570] len(platform.uname()) has changed in Python 3.9

2020-05-08 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

If it is important to retain the `len`, it's probably also important to retain 
the `[-N]` accesses and possibly other behaviors of a length 6 tuple.

--

___
Python tracker 

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



[issue40570] len(platform.uname()) has changed in Python 3.9

2020-05-08 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

It was intentional to address issue35967, although it was meant to remain 
compatible.

Is len(uname()) an important behavior to retain? It feels like an 
implementation detail to me.

--

___
Python tracker 

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



[issue40553] Python 3.8.2 Mac freezing/not responding when saving new programs

2020-05-08 Thread Ned Deily


Ned Deily  added the comment:

That enabling FullDiskAccess makes a difference makes some sense but that is 
not something we should be recommending without better understanding what's 
going on here. We still need a reproducible test case; I still am not able to 
reproduce. Raymond, your hint about Dropbox is promising; can you say more, 
i.e. do you see hangs if you the folder you are saving to is within your 
Dropbox folder hierarchy? Zain, do you use Dropbox?  And do either of you have 
your Documents folder stored in iCloud:

System Preferences -> Apple ID (top right) -> iCloud -> iCloud Drive (Options) 
-> Documents -> Desktop & Documents Folders (checked)

--

___
Python tracker 

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



[issue40425] Refleak in CDataObject

2020-05-08 Thread Filipe Laíns

Change by Filipe Laíns :


--
nosy: +FFY00

___
Python tracker 

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



[issue39791] New `files()` api from importlib_resources.

2020-05-08 Thread Jason R. Coombs


Jason R. Coombs  added the comment:


New changeset 7f7e706d78ab968a1221c6179dfdba714860bd12 by Jason R. Coombs in 
branch 'master':
bpo-39791: Add files() to importlib.resources (GH-19722)
https://github.com/python/cpython/commit/7f7e706d78ab968a1221c6179dfdba714860bd12


--

___
Python tracker 

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



[issue40569] Add optional weights to random.sample()

2020-05-08 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue40553] Python 3.8.2 Mac freezing/not responding when saving new programs

2020-05-08 Thread Zain Said


Zain Said  added the comment:

I posted my issue on Experts Exchange and they suggested to go to system 
preferences>Security>go to privacy tab on the top>scroll down to Full 
Disk Access>Add IDLE and Python>then check off the box next to it> 

Since then my issue with IDLE not being able to save (save as) new programs has 
gone away. 

Maybe try this and let me know if this solves you're issue. 

Also I'm fairly new to python and coding in general and i rarely use terminal.

--

___
Python tracker 

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



[issue38323] asyncio: MultiLoopWatcher has a race condition (test_asyncio: test_close_kill_running() hangs on AMD64 RHEL7 Refleaks 3.x)

2020-05-08 Thread Kyle Stanley


Change by Kyle Stanley :


--
pull_requests: +19324
pull_request: https://github.com/python/cpython/pull/20013

___
Python tracker 

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



[issue40561] Provide docstrings for public-facing webbrowser functions

2020-05-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Missing docstrings are almost a bug, but I am not sure if we backport additions.

This needs the attention of a coredev to review, approve, and merge, but there 
is no particular 'webbrowser' maintainer.  If no one shows up, you might use 
git to find those who have most recently committed to the module and request 
reviews on the PR.

--
nosy: +terry.reedy
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



[issue30250] StringIO module truncate behavior of current position

2020-05-08 Thread Zachary Ware


Change by Zachary Ware :


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



[issue40557] Move captured_stdin(), captured_stdout(), and captured_stderr() to the public API.

2020-05-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The proposal should include the idea that the functions in test.support be 
replaced with

from unittest.helpers import *  # or
from unittest.helpers import captured_stdin, ...

so that a) no other changes need be made to existing tests and b) the 
possibility remains of someday wrapping or replacing the public version, again 
without necessarily changing existing tests.

--

___
Python tracker 

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



[issue40425] Refleak in CDataObject

2020-05-08 Thread Zachary Ware


Zachary Ware  added the comment:

This looks like a simple reference cycle, as far as I can tell; I don't see an 
actual refleak.  Reproducing using Mark's code from StackOverflow (adjusted):

$ ./python.exe -X showrefcount
Python 3.9.0a6+ (heads/master-dirty:d10091aa17, May  8 2020, 17:43:51) 
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 
[48551 refs, 15489 blocks]
>>> from ctypes import *
[53774 refs, 17227 blocks]
>>> s = create_string_buffer(1<<30);del s
[53832 refs, 17254 blocks]
>>> s = create_string_buffer(1<<30);del s
[53832 refs, 17255 blocks]
>>> s = create_string_buffer(1<<30);del s
[53832 refs, 17254 blocks]
>>> s = create_string_buffer(1<<30);s = cast(s, c_void_p);del s
[53839 refs, 17258 blocks]
>>> s = create_string_buffer(1<<30);s = cast(s, c_void_p);del s
[53844 refs, 17262 blocks]
>>> import gc
[54078 refs, 17315 blocks]
>>> gc.collect()
13
[54030 refs, 17182 blocks]
>>> 
[54030 refs, 17199 blocks]
>>> s = create_string_buffer(1<<30);del s
[54077 refs, 17227 blocks]
>>> gc.collect()
9
[54030 refs, 17182 blocks]
>>> s = create_string_buffer(1<<30);s = cast(s, c_void_p);del s;gc.collect()
11
[54030 refs, 17182 blocks]
>>> s = create_string_buffer(1<<30);s = cast(s, c_void_p);del s;gc.collect()
11
[54030 refs, 17182 blocks]



I'll freely admit that I'm way out of my depth here, but this doesn't look like 
a bug as far as I can tell.  `ctypes` seems to be creating some cyclic 
references internally, but a collection clears them right up.

--
nosy: +zach.ware

___
Python tracker 

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



[issue30250] StringIO module truncate behavior of current position

2020-05-08 Thread Zackery Spytz


Zackery Spytz  added the comment:

Python 2 is EOL.

--
nosy: +ZackerySpytz

___
Python tracker 

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



[issue40557] Move captured_stdin(), captured_stdout(), and captured_stderr() to the public API.

2020-05-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I am rather sure that test.support is going to remain private.  So the concrete 
proposal should be to move them into the unittest package somewhere, perhaps in 
a new unittest.utils/support/helpers module, for battle-tested helper functions.

I strongly suggest that you make such a proposal on the python-ideas list, both 
to get support from users and also from a coredev that might review and merge 
if approved.

A new module should require a PEP, which should include some criteria for what 
might go into such a module.  What some coredevs will rightly fear is an 
avalanche of proposals to various person's favorite thing from test.support, or 
even elsewhere.  Why these 3 things and not other things or even everything?  
Take a look at PEP 1 for what should be covered even in a pre-PEP.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue40426] Unable to use lowercase hexadecimal digits for percent encoding

2020-05-08 Thread Christian Heimes


Christian Heimes  added the comment:

There is no need to add a new flag to quote. You can easily archive your goal 
with a simple regular expression substitution:

>>> import re, urllib.parse
>>> s = urllib.parse.quote("Example|#?")
>>> s
'Example%7C%23%3F'
>>> re.sub("%[0-9A-F]{2}", lambda q: q.group(0).lower(), s)
'Example%7c%23%3f'

--

___
Python tracker 

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



[issue40572] Support basic asynchronous cross-interpreter operations.

2020-05-08 Thread Eric Snow


Change by Eric Snow :


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

___
Python tracker 

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



[issue1944] Document PyUnicode_* API

2020-05-08 Thread Furkan Onder


Change by Furkan Onder :


--
nosy: +furkanonder
nosy_count: 8.0 -> 9.0
pull_requests: +19322
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/20011

___
Python tracker 

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



[issue40572] Support basic asynchronous cross-interpreter operations.

2020-05-08 Thread Eric Snow


New submission from Eric Snow :

(This is a continuation of the work from bpo-33608.  That issue ended up with a 
lot of baggage and clutter (due to problems that have since been resolved), so 
we closed it.  This issue is where we're picking it up fresh.)

When two interpreters are cooperating, there are sometimes operations that one 
of them needs the other to perform.  Thus far this is limited to mutation or 
release of data/objects owned by that "other" interpreter.  We need safe, 
reliable public C-API to facilitate such operations.

All the necessary machinery already exists ("pending calls"), exposed in the 
internal C-API: _Py_AddPendingCall().  (There is a public Py_AddPendingCall(), 
but it should be removed.)  That API adds a function to a per-interpreter 
queue, from which it is executed later (asynchronously) by the ceval loop of 
the interpreter's main thread.  The challenge is that the repercussions of such 
async operations within the eval loop are not fully explored.  We have some 
confidence because this is the same machinery used to handle signals.  However, 
it's better avoid as much complexity in those async operations as possible.  
That is why we don't just expose `_Py_AddPendingCall()` in the public C-API.

Instead the plan is to add a small number of public C-API functions that are 
each specific to a focused use case, ideally with with little/no chance of 
errors or other side effects.  Initially we will target `Py_DECREF()`, 
`PyMem_Free()`, and `PyBuffer_Release()`.  If we need more then we can assess 
those needs later.

--
assignee: eric.snow
components: C API
messages: 368476
nosy: eric.snow, vstinner
priority: normal
severity: normal
stage: needs patch
status: open
title: Support basic asynchronous cross-interpreter operations.
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



[issue40553] Python 3.8.2 Mac freezing/not responding when saving new programs

2020-05-08 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Zain, do you happen to be working in a Dropbox synced directory when you 
observe the failure?

--

___
Python tracker 

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



[issue38728] Update PC/pyconfig.h to support disabling auto linking

2020-05-08 Thread Jean-Christophe Fillion-Robin


Jean-Christophe Fillion-Robin  added the comment:

Associated pull request has been updated, CLA signed and it is ready for final 
review and integration.

Thanks so much for your time,

--

___
Python tracker 

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



[issue40546] Inconsistencies between PEG parser and traceback SyntaxErrors

2020-05-08 Thread Guido van Rossum


Guido van Rossum  added the comment:

@Terry: Thanks for confirming the bug in the old parser.

Regarding whether column offsets should be 0-based or 1-based: I agree with Tk, 
but my hand was forced for SyntaxError: we found that it was already using 
1-based offsets and we found correct-looking code elsewhere that depended on 
this, so we had to change the few cases where it was using 0-based offsets, 
alas.

I think I also looked at how vim and Emacs interpret column numbers, and found 
that both expect 1-based offsets in compiler error messages of the form 
"file:line:col: message". IIRC I had to do a deep-dive on this subject when we 
added column offsets to mypy error messages.

But it's a pain!

@Lysandros:

I wonder if this is the fix we're looking for?

diff --git a/Lib/traceback.py b/Lib/traceback.py
index bf34bbab8a..0e286f60bc 100644
--- a/Lib/traceback.py
+++ b/Lib/traceback.py
@@ -582,7 +582,7 @@ class TracebackException:
 yield '{}\n'.format(badline.strip())
 if offset is not None:
 caretspace = badline.rstrip('\n')
-offset = min(len(caretspace), offset) - 1
+offset = min(len(caretspace) + 1, offset) - 1
 caretspace = caretspace[:offset].lstrip()
 # non-space whitespace (likes tabs) must be kept for alignment
 caretspace = ((c.isspace() and c or ' ') for c in caretspace)

--

___
Python tracker 

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



[issue40547] 2to3 raise can silently remove code from old 2.4 string exceptions

2020-05-08 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue40544] Formatter exception when using logging.config.fileConfig

2020-05-08 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue40546] Inconsistencies between PEG parser and traceback SyntaxErrors

2020-05-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I verified that 3.8 puts the caret under '|', and agree that this is bug that 
should be fixed at least in a new version.  Other such bugs have been fixed in 
the past.

tk Text widgets have 1-based line numbers and 0-based column numbers. The 
latter is appropriate since column indexes mostly serve as slice positions 
rather than as character positions.  IDLE changes the background of the error 
character to red, so it must be subtracting 1 to get the beginning of the slice 
to be colored.  There was once a bug about this, so having the CPython behavior 
be consistent and documented would be good even if not a language feature.  
(For some reason I have not yet tracked down, IDLE colors the \n in 3.8 as well 
as 3.9, but is also correct and consistent for other exceptions where the two 
versions report the same column.)

On a related note: Since the exceptions raised by compile are not restricted to 
SyntaxError (or Warning), it would be nice to have them restricted to a 
definite list that is documented.  Both code.InteractiveInterpreter and IDLE 
have try-compile-except with (different) tuples extended as uncaught exceptions 
are reported.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue40571] Make lru_cache(maxsize=None) more discoverable

2020-05-08 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

FWIW, this doesn't preclude the other proposal if it ever gains traction and 
moves forward.  This just takes existing functionality and improves clarity and 
discoverability.

The core issue is that if you only want a simple unbounded cache, it isn't 
obvious that that behavior is buried in the lru_cache() API.  In hindsight, 
this always should have been separate functionality.  And some day we may 
deprecate the maxsize=None option which is somewhat opaque.

--

___
Python tracker 

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



[issue40550] Popen.terminate fails with ProcessLookupError under certain conditions

2020-05-08 Thread Filipe Laíns

Filipe Laíns  added the comment:

I submitted a patch. As explained above, this only mitigates the 
time-of-check/time-of-action issue in case the process doesn't exist, it *is 
not* a proper fix for the issue. But don't see any way to properly fix it.

--

___
Python tracker 

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



[issue40571] Make lru_cache(maxsize=None) more discoverable

2020-05-08 Thread Raymond Hettinger


New submission from Raymond Hettinger :

The recent discussions on python-ideas showed that people have a hard time 
finding the infinity-cache option for lru_cache().  Also, in the context of 
straight caching without limits, the name *lru_cache()* makes the tool seem 
complex and heavy when in fact, it is simple, lightweight, and fast (doing no 
more than a simple dictionary lookup).

We could easily solve both problems with a helper function:

def cache(func):
'Simple unbounded cache.  Sometimes called "memoize".'
return lru_cache(maxsize=None, typed=False)

It would be used like this:

 @cache
 def configure_server():
 ...
 return server_instance

There was some discussion about a completely new decorator with different 
semantics (holding a lock across a call to an arbitrary user function and being 
limited to zero argument functions).  It all the examples that were presented, 
this @cache decorator would suffice.  None of examples presented actually 
locking behavior.

--
components: Library (Lib)
messages: 368469
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Make lru_cache(maxsize=None) more discoverable
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



[issue38323] asyncio: MultiLoopWatcher has a race condition (test_asyncio: test_close_kill_running() hangs on AMD64 RHEL7 Refleaks 3.x)

2020-05-08 Thread Kyle Stanley


Kyle Stanley  added the comment:

> What other MultiLoopWatcher tests are currently having random hangs?

Oh, never mind. I see `test_stdin_stdout` is also hanging in 
https://bugs.python.org/issue38182. I would like to take a closer look at that 
one before skipping it as well.

--

___
Python tracker 

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



[issue40550] Popen.terminate fails with ProcessLookupError under certain conditions

2020-05-08 Thread Filipe Laíns

Change by Filipe Laíns :


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

___
Python tracker 

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



[issue40570] len(platform.uname()) has changed in Python 3.9

2020-05-08 Thread Zachary Ware


Change by Zachary Ware :


--
nosy: +jaraco, lemburg

___
Python tracker 

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



[issue38323] asyncio: MultiLoopWatcher has a race condition (test_asyncio: test_close_kill_running() hangs on AMD64 RHEL7 Refleaks 3.x)

2020-05-08 Thread Kyle Stanley


Kyle Stanley  added the comment:

> There are more MultiLoopWatcher tests which hang randomly, it's not only 
> test_close_kill_running().

What other MultiLoopWatcher tests are currently having random hangs? From 
searching "MultiLoopWatcher" on bpo, I'm only finding this issue. For now, I'll 
just work on a PR to temporarily skip `test_close_kill_running()` until we can 
find a fix.

--

___
Python tracker 

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



[issue40550] Popen.terminate fails with ProcessLookupError under certain conditions

2020-05-08 Thread Filipe Laíns

Filipe Laíns  added the comment:

This is a simple time-of-check - time-of-action issue, which is why I suggested 
that it shouldn't be fixed. I was not aware send_signal did have this check, 
which tells us it is supposed to be suported(?). Anyway, to fix it we need to 
catch the exception and check for errno == 3 so that we can ignore it.

Optimally we would want to have an atomic operation here, but no such thing 
exists. There is still the very faint possibility that after your process exits 
a new process will take its id and we kill it instead.

We should keep the returncode check and just ignore the exception when errno == 
3. This is the best option.

--

___
Python tracker 

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



[issue40568] Modify -c command-line option to accept multiple inputs

2020-05-08 Thread Zachary Ware


Zachary Ware  added the comment:

This can be accomplished already by just including newlines in the string:

$ cat multiline_python_bash_script.sh 
#!/bin/bash

python3 -c '
from math import *
print(e**(1j * pi))
import sys
print(sys.argv)'

echo "here's some random text" > somefile.txt

python3 -c '
with open("somefile.txt") as f:
print(len(f.read()))

import sys
print(sys.argv)'


python3 - << EOF
import sys

print("Here's another way to do it, without restrictions on quotes")
print(sys.argv)
EOF
$ ./multiline_python_bash_script.sh 
(-1+1.2246467991473532e-16j)
['-c']
24
['-c']
Here's another way to do it, without restrictions on quotes
['-']
$ python3 -c "
> print('Interactive test:')
> print('Multi-line works')
> "
Interactive test:
Multi-line works



None of these options is particularly *pretty*, but if it's at the point the 
ugliness bothers you it should probably be its own file to be executed :).  On 
the other hand, none of these options really works on Windows, as far as I know.

--
nosy: +zach.ware

___
Python tracker 

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



[issue40502] PyNode_New() does not initialize n->n_col_offset

2020-05-08 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


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

___
Python tracker 

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



[issue40502] PyNode_New() does not initialize n->n_col_offset

2020-05-08 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:


New changeset d10091aa171250c67a5079abfe26b8b3964ea39a by Joannah Nanjekye in 
branch 'master':
bpo-40502: Initialize n->n_col_offset (GH-19988)
https://github.com/python/cpython/commit/d10091aa171250c67a5079abfe26b8b3964ea39a


--

___
Python tracker 

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



[issue40397] Refactor typing._GenericAlias

2020-05-08 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

The most recent change here caused a regression. The following file:

```
from typing import Generic, TypeVar, Union

class CannotTransform(Exception): pass

T = TypeVar("T")
E = TypeVar("E", bound=Exception)

class Ok(Generic[T]): pass
class Err(Generic[E]): pass

Result = Union[Ok[T], Err[E]]
TResult = Result[T, CannotTransform]
TMatchResult = TResult[int]
```

Now fails with:

```
Traceback (most recent call last):
  File "/Users/jzijlstra-mpbt/py/cpython/Lib/../../black/black.py", line 22, in 

TMatchResult = TResult[int]
  File "/Users/jzijlstra-mpbt/py/cpython/Lib/typing.py", line 244, in inner
return func(*args, **kwds)
  File "/Users/jzijlstra-mpbt/py/cpython/Lib/typing.py", line 704, in 
__getitem__
arg = arg[subargs]
  File "/Users/jzijlstra-mpbt/py/cpython/Lib/typing.py", line 244, in inner
return func(*args, **kwds)
  File "/Users/jzijlstra-mpbt/py/cpython/Lib/typing.py", line 695, in 
__getitem__
_check_generic(self, params)
  File "/Users/jzijlstra-mpbt/py/cpython/Lib/typing.py", line 194, in 
_check_generic
raise TypeError(f"{cls} is not a generic class")
TypeError: __main__.Err[__main__.CannotTransform] is not a generic class
```

Before commit c1c7d8ead9eb214a6149a43e31a3213c52448877 it was fine. This was 
found when we added 3.9-dev to CI for Black 
(https://github.com/psf/black/pull/1393).

--
nosy: +Jelle Zijlstra
priority: normal -> release blocker

___
Python tracker 

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



[issue40550] Popen.terminate fails with ProcessLookupError under certain conditions

2020-05-08 Thread Alexander Overvoorde


Alexander Overvoorde  added the comment:

I'm not sure that it is expected since Popen.send_signal does contain the 
following check:

```
def send_signal(self, sig):
"""Send a signal to the process."""
# Skip signalling a process that we know has already died.
if self.returncode is None:
os.kill(self.pid, sig)
```

Additionally, the following program does not raise a ProcessLookupError despite 
the program already having exited:

```
import subprocess
import time

proc = subprocess.Popen(["sh", "-c", "exit 0"])

time.sleep(5)

proc.terminate()
```

--

___
Python tracker 

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



[issue40503] PEP 615: Add zoneinfo module

2020-05-08 Thread Paul Ganssle

Paul Ganssle  added the comment:

I've separated this into two separate PRs, one for docs and one for 
tests/implementation.

I have not yet implemented the logic for the ability to configure the TZPATH at 
compile time because I'm not quite sure how to start on that. How are other 
compile-time options implemented? Do I need to do something special to handle 
both Windows and POSIX systems? Is there already a configuration file somewhere 
that I should use for this? Adding Thomas to the nosy list because he's the 
only one listed for "autoconf/makefiles" – don't know if that extends to the 
Windows build as well.

--
nosy: +twouters

___
Python tracker 

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



[issue40543] Tamil locale is using outdated encoding

2020-05-08 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +benjamin.peterson, ezio.melotti, lemburg, vstinner
stage:  -> needs patch
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



[issue40570] len(platform.uname()) has changed in Python 3.9

2020-05-08 Thread David Tucker


Change by David Tucker :


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

___
Python tracker 

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



[issue40481] Add include and exclude filters to zipapp cli

2020-05-08 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +paul.moore

___
Python tracker 

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



[issue40474] Code coverage report not entirely accurate

2020-05-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Use git to find out who previously edited the file and request reviews from at 
least a couple.  The 2 recommendations on the PR may be based on that, but good 
to check.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue34790] Deprecate passing coroutine objects to asyncio.wait()

2020-05-08 Thread jack1142


Change by jack1142 :


--
nosy: +jack1142
nosy_count: 7.0 -> 8.0
pull_requests: +19319
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20008

___
Python tracker 

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



[issue40570] len(platform.uname()) has changed in Python 3.9

2020-05-08 Thread David Tucker


New submission from David Tucker :

https://github.com/python/cpython/commit/518835f3354d6672e61c9f52348c1e4a2533ea00#diff-47c8e5750258a08a6dd9de3e9c3774acL741-R804

That diff changed len(platform.uname()) to 5 (from 6).

I noticed because we have some code that checks for 6 strs (arguably 
unnecessary),
but I can also think of contrived examples that would break (e.g. 
platform.uname()[-3]).
Interestingly, platform.uname()[5] still works.

Was this effect intentional?

--
components: Library (Lib)
messages: 368459
nosy: tucked
priority: normal
severity: normal
status: open
title: len(platform.uname()) has changed in Python 3.9
type: behavior
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



[issue40569] Add optional weights to random.sample()

2020-05-08 Thread Raymond Hettinger


New submission from Raymond Hettinger :

Weighted sampling without replacement isn't easy for a user to do with the 
current tooling. There is a StackOverflow question about how to do it.  Also, 
this service is currently offered by numpy.

Use it like this:

>>> sample(['katniss', 'prim', 'gale', 'peeta'] , weights=[20, 1, 42, 10], 
k=2)
['prim', 'peeta']

Here's an efficient implementation similar to how numpy does it:

--- a/Lib/random.py
+++ b/Lib/random.py
@@ -331,7 +331,7 @@ class Random(_random.Random):
 j = _int(random() * (i+1))
 x[i], x[j] = x[j], x[i]

-def sample(self, population, k, *, counts=None):
+def sample(self, population, k, *, counts=None, weights=None):
 """Chooses k unique random elements from a population sequence or set.

 Returns a new list containing elements from the population while
@@ -392,6 +392,18 @@ class Random(_random.Random):
 if not isinstance(population, _Sequence):
 raise TypeError("Population must be a sequence.  For dicts or 
sets, use sorted(d).")
 n = len(population)
+if weights is not None:
+if counts is not None:
+raise TypeError('Cannot specify both counts and weights')
+weights = list(weights)
+positions = range(n)
+indices = []
+while (needed := k - len(indices)):
+for i in choices(positions, weights, k=needed):
+if weights[i]:
+weights[i] = 0.0
+indices.append(i)
+return [population[i] for i in indices]
 if counts is not None:
 cum_counts = list(_accumulate(counts))
 if len(cum_counts) != n:

--
components: Library (Lib)
messages: 368458
nosy: mark.dickinson, rhettinger, tim.peters
priority: normal
severity: normal
status: open
title: Add optional weights to random.sample()
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



[issue40565] is comparison returns False while ids are the same.

2020-05-08 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

python-list mailing list, mail.python.org, is one good place to ask "Is this a 
bug?"

--
nosy: +terry.reedy

___
Python tracker 

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



[issue40503] PEP 615: Add zoneinfo module

2020-05-08 Thread Paul Ganssle


Change by Paul Ganssle :


--
pull_requests: +19318
pull_request: https://github.com/python/cpython/pull/20006

___
Python tracker 

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



[issue40568] Modify -c command-line option to accept multiple inputs

2020-05-08 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

@rhettinger can you clarify how does this arguments act on argv? Should they be 
hidden like the first argument, or should they remain visible as a passing 
argument? 
 $ python -c 'import sys;print(sys.argv)'   
['-c']

 $ python -c 'import sys;print(sys.argv)' 'print("another")' 'print("another1")'
['-c', 'print("another")', 'print("another1")']

--
nosy: +BTaskaya

___
Python tracker 

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



[issue40426] Unable to use lowercase hexadecimal digits for percent encoding

2020-05-08 Thread Eisuke Kawashima


Eisuke Kawashima  added the comment:

> Why do you require a lower case string here?

Well, I want to use urllib.parse.quote to escape special characters, such as 
()[]#*/\, in filenames, and for visibility lower hex digits are preferable.
PR 19766 does not break compatibility.

--

___
Python tracker 

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



[issue40568] Modify -c command-line option to accept multiple inputs

2020-05-08 Thread Raymond Hettinger


New submission from Raymond Hettinger :

It would be nice to write this:

$ python -c 'from math import *' 'print(e**(1j * pi))'

Instead of this:

$ python -c 'from math import *; print(e**(1j * pi))'
(-1+1.22464679915e-16j)

That would also make it possible input an indented block:

$ python -c 'with open("somefile.txt") as f:'  '  s = f.read()' '  
print(len(s))'

This feature would be especially useful in bash scripts.

FWIW, the timeit module already supports this convenience:

$ python -m timeit -s 'from math import sqrt' -s 'x = 5' 'y = x ** 2' 'z = 
sqrt(y)'
1000 loops, best of 3: 0.0819 usec per loop

--
components: Interpreter Core
messages: 368454
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Modify -c command-line option to accept multiple inputs
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



[issue40567] asyncio.StreadReader `async for line in reader` is not documented

2020-05-08 Thread Марк Коренберг

Change by Марк Коренберг :


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

___
Python tracker 

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



[issue40567] asyncio.StreadReader `async for line in reader` is not documented

2020-05-08 Thread Марк Коренберг

New submission from Марк Коренберг :

Actually it works. But it is not documented. Please ad docs.

--
components: asyncio
messages: 368453
nosy: asvetlov, socketpair, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.StreadReader `async for line in reader` is not documented
versions: Python 3.7, 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



[issue40564] Using zipfile.Path with several files prematurely closes zip

2020-05-08 Thread Brett Cannon


Change by Brett Cannon :


--
nosy: +jaraco

___
Python tracker 

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



[issue40566] Apply PEP 573 to abc module

2020-05-08 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue40566] Apply PEP 573 to abc module

2020-05-08 Thread Dong-hee Na


New submission from Dong-hee Na :

Since PEP 573 is landed, we can apply the PEP 573 to abc module.

--
assignee: corona10
components: Interpreter Core
messages: 368452
nosy: corona10, vstinner
priority: normal
severity: normal
status: open
title: Apply PEP 573 to abc module
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



[issue40565] is comparison returns False while ids are the same.

2020-05-08 Thread Eric V. Smith


Eric V. Smith  added the comment:

This isn't doing what you think. Because you throw away the object after 
computing its id, the same memory is reused and you get the same id.  Consider:

>>> a = [1,2,3]
>>> b = [3,4,5]
>>> id(a[:]) == id(b[:])
True

There's no problem here, but it does show that you need to be careful with "is" 
and "id".

--
nosy: +eric.smith
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



[issue31861] add aiter() and anext() functions to operator module

2020-05-08 Thread rb


Change by rb :


--
nosy: +rb

___
Python tracker 

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



[issue40565] is comparison returns False while ids are the same.

2020-05-08 Thread halil ibrahim yıldırım

New submission from halil ibrahim yıldırım :

While id(a[:]) and id(a[0:3]) are the same however is comparison returns False. 
I thought it could be a bug.

>>> a = [1, 2, 3]
>>> id(a[:]) == id(a[0:3])
True
>>> a[:] is a[0:3]
False

--
files: 2020-05-07_16-47-56-afa654f51735fad98b3a593a2ea539fd.png
messages: 368450
nosy: ihalil95
priority: normal
pull_requests: 19316
severity: normal
status: open
title: is comparison returns False while ids are the same.
type: behavior
versions: Python 3.8
Added file: 
https://bugs.python.org/file49143/2020-05-07_16-47-56-afa654f51735fad98b3a593a2ea539fd.png

___
Python tracker 

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



[issue40564] Using zipfile.Path with several files prematurely closes zip

2020-05-08 Thread Xavier


New submission from Xavier :

Given a .zip file with more than one inner file, when reading those inner files 
using zipfile.Path the zip module closes the .zip file prematurely, causing an 
error.

Given the following code (example zipfile is attached, but any should work).

with zipfile.ZipFile('foo.zip') as file:
for name in ['file-1.txt', 'file-2.txt']:
p = zipfile.Path(file, name)
with p.open() as inner:
print(list(inner)) # ValueError: seek of closed file

But the following code does not fail:

with zipfile.ZipFile('foo.zip') as file:
for name in ['file-1.txt', 'file-2.txt']:
with file.open(name) as inner:
print(list(inner)) # Works!


Python 3.8.2 macOS 10.15.4.

--
components: IO
files: zipfile.zip
messages: 368449
nosy: bustawin
priority: normal
severity: normal
status: open
title: Using zipfile.Path with several files prematurely closes zip
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file49142/zipfile.zip

___
Python tracker 

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



[issue40562] SEO: differentiate between Python 2 and Python 3 docs on Google SERP

2020-05-08 Thread Simon Willison


Simon Willison  added the comment:

I asked about this on Twitter and got a couple of tips from Google engineers: 
https://twitter.com/simonw/status/1258767730263552000

It sounds like a good solution would be to explicitly design the breadcrumbs 
using this mechanism: 
https://developers.google.com/search/docs/data-types/breadcrumb?hl=en#json-ld

Maybe "docs.python.org > Python 3.8 > sqlite3" would be a good fix here?

--

___
Python tracker 

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



[issue40562] SEO: differentiate between Python 2 and Python 3 docs on Google SERP

2020-05-08 Thread Ned Deily


Change by Ned Deily :


--
nosy: +mdk, willingc

___
Python tracker 

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



[issue40563] Support pathlike objects on dbm/shelve

2020-05-08 Thread Hakan


Hakan  added the comment:

I work on this issue to fix it.

--
nosy: +hakancelik

___
Python tracker 

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



[issue40334] PEP 617: new PEG-based parser

2020-05-08 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


--
pull_requests: +19315
pull_request: https://github.com/python/cpython/pull/20003

___
Python tracker 

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



[issue40563] Support pathlike objects on dbm/shelve

2020-05-08 Thread Batuhan Taskaya


New submission from Batuhan Taskaya :

>>> dbm.open("/tmp/x.db", "n").close()
>>> from pathlib import Path
>>> tmp = Path("/tmp")
>>> dbm.open(tmp / "x.db", "n").close()
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.9/dbm/__init__.py", line 95, in open
return mod.open(file, flag, mode)
TypeError: open() argument 1 must be str, not PosixPath

--
components: Library (Lib)
keywords: easy
messages: 368446
nosy: BTaskaya
priority: normal
severity: normal
status: open
title: Support pathlike objects on dbm/shelve
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



[issue40541] Add optional weights parameter to random.sample()

2020-05-08 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue40541] Add optional weights parameter to random.sample()

2020-05-08 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 81a5fc38e81b424869f4710f48e9371dfa2d3b77 by Raymond Hettinger in 
branch 'master':
bpo-40541: Add optional *counts* parameter to random.sample() (GH-19970)
https://github.com/python/cpython/commit/81a5fc38e81b424869f4710f48e9371dfa2d3b77


--

___
Python tracker 

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



[issue40426] Unable to use lowercase hexadecimal digits for percent encoding

2020-05-08 Thread Christian Heimes


Christian Heimes  added the comment:

No, they are not required. RFC 3986 recommends upper case and says that upper 
and lower case percent encoding are equivalent:

   The uppercase hexadecimal digits 'A' through 'F' are equivalent to
   the lowercase digits 'a' through 'f', respectively.  If two URIs
   differ only in the case of hexadecimal digits used in percent-encoded
   octets, they are equivalent.  For consistency, URI producers and
   normalizers should use uppercase hexadecimal digits for all percent-
   encodings.

--

___
Python tracker 

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



[issue40426] Unable to use lowercase hexadecimal digits for percent encoding

2020-05-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

But they are not required, right?

--

___
Python tracker 

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



[issue40562] SEO: differentiate between Python 2 and Python 3 docs on Google SERP

2020-05-08 Thread Simon Willison

New submission from Simon Willison :

When I search Google for a Python related term (e.g. "sqlite3 row" - see 
attached screenshot) I get back two results - one for the Python 2 
documentation and one for the Python 3 documentation.

There is currently no indicator which result is for which version of Python.

Comparing https://docs.python.org/3/library/sqlite3.html with 
https://docs.python.org/2/library/sqlite3.html I think the problem is the way 
the title elements are designed:

sqlite3 — DB-API 2.0 interface for SQLite databases — Python 3.8.3rc1 
documentation

v.s.

11.13. sqlite3 — DB-API 2.0 interface for SQLite databases - Python 2.7.18 
documentation

As you can see in the attached screenshot, Google (at least in my desktop 
browser) chooses to truncate those titles before they get to the bit indicating 
the version of Python.

It may be worth consulting with Google directly about the best way to address 
this. Moving the Python version indicator to the start of the title may or may 
not be the best approach.

--
assignee: docs@python
components: Documentation
files: sqlite3_row_-_Google_Search.png
messages: 368442
nosy: docs@python, simonw
priority: normal
severity: normal
status: open
title: SEO: differentiate between Python 2 and Python 3 docs on Google SERP
versions: Python 3.9
Added file: https://bugs.python.org/file49141/sqlite3_row_-_Google_Search.png

___
Python tracker 

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



[issue40426] Unable to use lowercase hexadecimal digits for percent encoding

2020-05-08 Thread Christian Heimes


Christian Heimes  added the comment:

I'm -0 on the new argument. Why do you require a lower case string here?

--
nosy: +christian.heimes

___
Python tracker 

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



[issue39645] Expand concurrent.futures.Future's public API

2020-05-08 Thread Big Stone


Big Stone  added the comment:

it seems this feature would interest Dask team.
 https://github.com/dask/distributed/issues/3695

--
nosy: +Big Stone

___
Python tracker 

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



[issue40426] Unable to use lowercase hexadecimal digits for percent encoding

2020-05-08 Thread Eisuke Kawashima


Eisuke Kawashima  added the comment:

I require lower hex digits for percent encoding, which is allowed by the RFC.  
Small modifications of the codes can achieve it.

--

___
Python tracker 

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



[issue39685] Python 3.8 regression Socket operation on non-socket

2020-05-08 Thread Christian Heimes


Christian Heimes  added the comment:

I don't consider this a regression. socket.fromfd() and socket(fd) never 
supported non-socket fds. It just happens to work in some cases by chance.

It looks like sshuttle got lucky in the past. It never called a function that 
ultimately requires a socket fd.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue40506] add support for os.Pathlike filenames in zipfile.ZipFile.writestr

2020-05-08 Thread Domenico Ragusa


Change by Domenico Ragusa :


--
pull_requests: +19314
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20002

___
Python tracker 

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



[issue40532] Persmission error

2020-05-08 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'm going to close this. @Coder436: If you have more information that points to 
a python bug, please attach it and reopen this issue.

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



[issue40558] update CONTRIBUTING.rst docs

2020-05-08 Thread hai shi


hai shi  added the comment:

> That redirect just didn't exist yet :).  It now does, and I went ahead and 
> added it for 3.9 ahead of time.


Thanks, Zachary. It worked.

--

___
Python tracker 

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



[issue34431] Docs does not eval allows code object as argument

2020-05-08 Thread Furkan Onder


Change by Furkan Onder :


--
keywords: +patch
nosy: +furkanonder
nosy_count: 4.0 -> 5.0
pull_requests: +19313
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/2

___
Python tracker 

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



[issue40561] Provide docstrings for public-facing webbrowser functions

2020-05-08 Thread Brad Solomon


Change by Brad Solomon :


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

___
Python tracker 

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



[issue40561] Provide docstrings for public-facing webbrowser functions

2020-05-08 Thread Brad Solomon


New submission from Brad Solomon :

Currently 'pydoc webbrowser.open' simply displays the function signature 
without a useful explanation of what 'new' does (and the parameter name/value 
set is not intuitive by name alone).

--
assignee: docs@python
components: Documentation
messages: 368435
nosy: bsolomon1124, docs@python
priority: normal
severity: normal
status: open
title: Provide docstrings for public-facing webbrowser functions
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue40559] Missing Py_DECREF in task_step_impl() in _asynciomodule.c

2020-05-08 Thread Chris Jerdonek


Change by Chris Jerdonek :


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

___
Python tracker 

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



[issue40559] Missing Py_DECREF in task_step_impl() in _asynciomodule.c

2020-05-08 Thread Chris Jerdonek


Chris Jerdonek  added the comment:


New changeset 25014289887cb521c1041df4773c839d3fbf784e by Miss Islington (bot) 
in branch '3.7':
[3.7] bpo-40559: Add Py_DECREF to _asynciomodule.c:task_step_impl() (GH-19990)
https://github.com/python/cpython/commit/25014289887cb521c1041df4773c839d3fbf784e


--

___
Python tracker 

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



[issue40559] Missing Py_DECREF in task_step_impl() in _asynciomodule.c

2020-05-08 Thread Chris Jerdonek


Chris Jerdonek  added the comment:


New changeset 0e4a5e96f011989736bde824ab817146bd7c9cfc by Miss Islington (bot) 
in branch '3.8':
[3.8] bpo-40559: Add Py_DECREF to _asynciomodule.c:task_step_impl() (GH-19990)
https://github.com/python/cpython/commit/0e4a5e96f011989736bde824ab817146bd7c9cfc


--

___
Python tracker 

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



[issue40559] Missing Py_DECREF in task_step_impl() in _asynciomodule.c

2020-05-08 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19311
pull_request: https://github.com/python/cpython/pull/19996

___
Python tracker 

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



[issue40559] Missing Py_DECREF in task_step_impl() in _asynciomodule.c

2020-05-08 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +19310
pull_request: https://github.com/python/cpython/pull/19995

___
Python tracker 

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



  1   2   >