[issue34687] asyncio: is it time to make ProactorEventLoop as the default event loop?

2019-10-23 Thread Carlton Gibson


Carlton Gibson  added the comment:

This change causes an issue in asgiref (and so Django) for Windows and Python 
3.8. 

https://github.com/django/asgiref/issues/132
https://code.djangoproject.com/ticket/30900

It looks as if `ProactorEventLoop` needs to check the current thread before 
triggering the signal... 

```
File 
"C:\Jenkins\workspace\django-windows\database\sqlite3\label\windows\python\Python38\.env\lib\site-packages\asgiref\sync.py",
 line 130, in _run_event_loop
File "C:\Python38\lib\asyncio\proactor_events.py", line 679, in close
signal.set_wakeup_fd(-1)
ValueError: set_wakeup_fd only works in main thread
```

... but I'm not familiar with the internals here as yet. 

(I'm guessing I need to create a new issue?)

--
nosy: +carltongibson

___
Python tracker 

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



[issue34687] asyncio: is it time to make ProactorEventLoop as the default event loop?

2019-10-23 Thread STINNER Victor


STINNER Victor  added the comment:

> (I'm guessing I need to create a new issue?)

Please open a new issue.

--

___
Python tracker 

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



[issue38555] Undefined behavior in dictreviter_iternext

2019-10-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 2e3d873d3bd0ef4708c4fa06b6cd6972574cb9af by Serhiy Storchaka in 
branch 'master':
bpo-38555: Fix an undefined behavior. (GH-16883)
https://github.com/python/cpython/commit/2e3d873d3bd0ef4708c4fa06b6cd6972574cb9af


--

___
Python tracker 

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



[issue38555] Undefined behavior in dictreviter_iternext

2019-10-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16436
pull_request: https://github.com/python/cpython/pull/16900

___
Python tracker 

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



[issue38555] Undefined behavior in dictreviter_iternext

2019-10-23 Thread miss-islington


miss-islington  added the comment:


New changeset c5d3ea89ee5244714f221dcfcd3be96de2f1da8d by Miss Skeleton (bot) 
in branch '3.8':
bpo-38555: Fix an undefined behavior. (GH-16883)
https://github.com/python/cpython/commit/c5d3ea89ee5244714f221dcfcd3be96de2f1da8d


--
nosy: +miss-islington

___
Python tracker 

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



[issue38563] Asyncio regression on Windows with Python 3.8

2019-10-23 Thread Carlton Gibson


New submission from Carlton Gibson :

6ea29c5e90dde6c240bd8e0815614b52ac307ea1 for 
https://bugs.python.org/issue34687

"Make asynico use ProactorEventLoop by default"

This introducesd a regression in asgiref, and hence Django 3.0.x. 


https://github.com/django/asgiref/issues/132
https://code.djangoproject.com/ticket/30900


The error from the asgiref issue is clearest: 

```
asgiref\sync.py:97: in __call__
loop_future.result()
..\..\..\AppData\Local\Programs\Python\Python38\lib\concurrent\futures\_base.py:432:
 in result
return self.__get_result()
..\..\..\AppData\Local\Programs\Python\Python38\lib\concurrent\futures\_base.py:388:
 in __get_result
raise self._exception
..\..\..\AppData\Local\Programs\Python\Python38\lib\concurrent\futures\thread.py:57:
 in run
result = self.fn(*self.args, **self.kwargs)
asgiref\sync.py:130: in _run_event_loop
loop.close()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  

self = 

def close(self):
if self.is_running():
raise RuntimeError("Cannot close a running event loop")
if self.is_closed():
return

>   signal.set_wakeup_fd(-1)
E   ValueError: set_wakeup_fd only works in main thread
```

Off the main thread, we use a ThreadPoolExecutor and wait for the future to 
finish. 

It looks as if `ProactorEventLoop` needs to check the current thread before 
triggering the signal in close().

--
components: asyncio
messages: 355214
nosy: asvetlov, carltongibson, yselivanov
priority: normal
severity: normal
status: open
title: Asyncio regression on Windows with Python 3.8
type: crash
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



[issue34687] asyncio: is it time to make ProactorEventLoop as the default event loop?

2019-10-23 Thread Carlton Gibson


Carlton Gibson  added the comment:

Created: https://bugs.python.org/issue38563 

Thanks!

--

___
Python tracker 

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



[issue38555] Undefined behavior in dictreviter_iternext

2019-10-23 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue38563] Asyncio regression on Windows with Python 3.8

2019-10-23 Thread Mariusz Felisiak


Change by Mariusz Felisiak :


--
nosy: +Mariusz Felisiak

___
Python tracker 

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



[issue38563] Asyncio regression on Windows with Python 3.8

2019-10-23 Thread Carlton Gibson


Carlton Gibson  added the comment:

Reproduce steps, on Windows with Python 3.8.0, and a clean venv. 

git clone https://github.com/django/asgiref.git
cd asgiref
pip install -e .[tests]
py.test .

--
nosy:  -Mariusz Felisiak

___
Python tracker 

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



[issue38563] Asyncio regression on Windows with Python 3.8

2019-10-23 Thread Mariusz Felisiak


Change by Mariusz Felisiak :


--
nosy: +Mariusz Felisiak

___
Python tracker 

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



[issue38563] Asyncio regression on Windows with Python 3.8

2019-10-23 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue38563] Asyncio regression on Windows with Python 3.8

2019-10-23 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Pull Request is welcome!

--

___
Python tracker 

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



[issue20443] __code__. co_filename should always be an absolute path

2019-10-23 Thread Nick Coghlan


Nick Coghlan  added the comment:

This change isn't in Python 3.8 though, it's only in Python 3.9 (the PR merge 
date is after the beta 1 branch date).

Unless it was backported in a Python 3.8 PR that didn't link back to this issue 
or the original Python 3.9 PR?

--

___
Python tracker 

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



[issue20443] __code__. co_filename should always be an absolute path

2019-10-23 Thread STINNER Victor


STINNER Victor  added the comment:

> This change isn't in Python 3.8 though, it's only in Python 3.9 (the PR merge 
> date is after the beta 1 branch date).

Oh, you're right. Sorry, I thought that I made the change before 3.8 branch was 
created. In that case, we can do whatever we want :-) (We are free to revert.)

--

___
Python tracker 

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



[issue38563] ProactorEventLoop.close(): set_wakeup_fd() only works in main thread

2019-10-23 Thread STINNER Victor


Change by STINNER Victor :


--
title: Asyncio regression on Windows with Python 3.8 -> 
ProactorEventLoop.close(): set_wakeup_fd() only works in main thread

___
Python tracker 

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



[issue38563] ProactorEventLoop.close(): set_wakeup_fd() only works in main thread

2019-10-23 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue34679] asyncio.add_signal_handler call fails if not on main thread

2019-10-23 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +16437
pull_request: https://github.com/python/cpython/pull/16901

___
Python tracker 

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



[issue38563] ProactorEventLoop.close(): set_wakeup_fd() only works in main thread

2019-10-23 Thread STINNER Victor


STINNER Victor  added the comment:

That's basically the same issue than bpo-34679 but on close() rather than on 
creating the event loop.

--
nosy: +vstinner

___
Python tracker 

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



[issue38563] ProactorEventLoop.close(): set_wakeup_fd() only works in main thread

2019-10-23 Thread STINNER Victor


STINNER Victor  added the comment:

> Thanks for the speedy patch Victor. Great effort!

Can you try to manually test PR 16901?

--

___
Python tracker 

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



[issue37224] test__xxsubinterpreters fails randomly

2019-10-23 Thread STINNER Victor


STINNER Victor  added the comment:

AMD64 FreeBSD Shared 3.x:

https://buildbot.python.org/all/#/builders/371/builds/7

test_subinterpreter (test.test__xxsubinterpreters.IsRunningTests) ... Exception 
in thread Thread-8:
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/threading.py", line 
944, in _bootstrap_inner
self.run()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/threading.py", line 
882, in run
self._target(*self._args, **self._kwargs)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test__xxsubinterpreters.py",
 line 51, in run
interpreters.run_string(interp, dedent(f"""
RuntimeError: unrecognized interpreter ID 46
FAIL

test_already_running (test.test__xxsubinterpreters.RunStringTests) ... 
Exception in thread Thread-9:
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/threading.py", line 
944, in _bootstrap_inner
self.run()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/threading.py", line 
882, in run
self._target(*self._args, **self._kwargs)
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test__xxsubinterpreters.py",
 line 51, in run
interpreters.run_string(interp, dedent(f"""
RuntimeError: interpreter already running
FAIL


==
FAIL: test_subinterpreter (test.test__xxsubinterpreters.IsRunningTests)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test__xxsubinterpreters.py",
 line 492, in test_subinterpreter
self.assertTrue(interpreters.is_running(interp))
AssertionError: False is not true

==
FAIL: test_already_running (test.test__xxsubinterpreters.RunStringTests)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test__xxsubinterpreters.py",
 line 853, in test_already_running
interpreters.run_string(self.id, 'print("spam")')
AssertionError: RuntimeError not raised

--

___
Python tracker 

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



[issue38564] test_asyncio: test_run_coroutine_threadsafe_with_timeout()

2019-10-23 Thread STINNER Victor


New submission from STINNER Victor :

AMD64 FreeBSD Shared 3.x:
https://buildbot.python.org/all/#/builders/371/builds/7

This buildbot worker is known to be very slow.

test_run_coroutine_threadsafe_with_timeout 
(test.test_asyncio.test_tasks.RunCoroutineThreadsafeTests)
Test coroutine submission from a thread to an event loop ... FAIL

FAIL: test_run_coroutine_threadsafe_with_timeout 
(test.test_asyncio.test_tasks.RunCoroutineThreadsafeTests)
Test coroutine submission from a thread to an event loop
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test_asyncio/test_tasks.py",
 line 3210, in test_run_coroutine_threadsafe_with_timeout
self.loop.run_until_complete(future)
AssertionError: TimeoutError not raised

--
components: Tests
messages: 355223
nosy: vstinner
priority: normal
severity: normal
status: open
title: test_asyncio: test_run_coroutine_threadsafe_with_timeout()
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



[issue38563] ProactorEventLoop.close(): set_wakeup_fd() only works in main thread

2019-10-23 Thread Carlton Gibson


Carlton Gibson  added the comment:

Thanks for the speedy patch Victor. Great effort!

--

___
Python tracker 

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



[issue38563] ProactorEventLoop.close(): set_wakeup_fd() only works in main thread

2019-10-23 Thread Carlton Gibson


Carlton Gibson  added the comment:

OK, that seems fair :) Will do that tomorrow AM.

--

___
Python tracker 

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



[issue38565] Expose the value passed of typed passed to functools.lru_cache

2019-10-23 Thread Scott Sanderson


New submission from Scott Sanderson :

In some circumstances, it's useful to be able in inspect the parameters with 
which an instance of functools.lru_cache was instantiated. It's currently 
possible to recover the cache's maxsize via the .cache_info() method, but 
there's no way to recover the value passed for `typed`, which controls whether 
the lru_cache's cache is partitioned by input type.

This came up in the context of cloudpickle, a library that tries to extend 
pickle to support more types (in particular, interactively-defined functions 
and classes) for use-cases like cluster computing. 

It's currently not possible to pickle an lru-cache decorated function that's 
defined in __main__ (which includes, e.g. a Jupyter Notebook). We can 
**almost** fix this with a pure library solution (see 
https://github.com/cloudpipe/cloudpickle/pull/309), but we're currently blocked 
by the fact that there's no way to recover the value that was passed for 
`typed`. Exposing a .typed attribute on the extension type for lru_cached 
functions fixes this

For more discussion, see the above linked PR, along with 
https://github.com/cloudpipe/cloudpickle/issues/178.

--
components: Library (Lib)
messages: 355226
nosy: Scott Sanderson2
priority: normal
severity: normal
status: open
title: Expose the value passed of typed passed to functools.lru_cache
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



[issue38564] test_asyncio: test_run_coroutine_threadsafe_with_timeout()

2019-10-23 Thread STINNER Victor


STINNER Victor  added the comment:

test_run_coroutine_threadsafe_with_timeout() has a race condition. It relies on 
"await asyncio.sleep(0.05)" synchronization primitive. That's not reliable.

async def add(self, a, b, fail=False, cancel=False):
"""Wait 0.05 second and return a + b."""
await asyncio.sleep(0.05)
if fail:
raise RuntimeError("Fail!")
if cancel:
asyncio.current_task(self.loop).cancel()
await asyncio.sleep(0)
return a + b

--

___
Python tracker 

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



[issue38564] test_asyncio: test_run_coroutine_threadsafe_with_timeout()

2019-10-23 Thread STINNER Victor


STINNER Victor  added the comment:

I can reproduce the issue with this patch:

diff --git a/Lib/test/test_asyncio/test_tasks.py 
b/Lib/test/test_asyncio/test_tasks.py
index dde84b84b1..c94113712a 100644
--- a/Lib/test/test_asyncio/test_tasks.py
+++ b/Lib/test/test_asyncio/test_tasks.py
@@ -3160,7 +3160,7 @@ class RunCoroutineThreadsafeTests(test_utils.TestCase):
 
 async def add(self, a, b, fail=False, cancel=False):
 """Wait 0.05 second and return a + b."""
-await asyncio.sleep(0.05)
+await asyncio.sleep(1e-9)
 if fail:
 raise RuntimeError("Fail!")
 if cancel:

and the command:

./python -m test test_asyncio -m test_run_coroutine_threadsafe_with_timeout -v 
-F

--

___
Python tracker 

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



[issue38564] test_asyncio: test_run_coroutine_threadsafe_with_timeout() has a race condition

2019-10-23 Thread STINNER Victor


Change by STINNER Victor :


--
title: test_asyncio: test_run_coroutine_threadsafe_with_timeout() -> 
test_asyncio: test_run_coroutine_threadsafe_with_timeout() has a race condition

___
Python tracker 

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



[issue34172] multiprocessing.Pool and ThreadPool leak resources after being deleted

2019-10-23 Thread STINNER Victor


STINNER Victor  added the comment:

What's the status of this issue?

--

___
Python tracker 

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



[issue34679] asyncio.add_signal_handler call fails if not on main thread

2019-10-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 1b53a24fb4417c764dd5933bce505f5c94249ca6 by Victor Stinner in 
branch 'master':
bpo-34679: ProactorEventLoop only uses set_wakeup_fd() in main thread (GH-16901)
https://github.com/python/cpython/commit/1b53a24fb4417c764dd5933bce505f5c94249ca6


--
nosy: +vstinner

___
Python tracker 

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



[issue34679] asyncio.add_signal_handler call fails if not on main thread

2019-10-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16439
pull_request: https://github.com/python/cpython/pull/16902

___
Python tracker 

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



[issue38563] ProactorEventLoop.close(): set_wakeup_fd() only works in main thread

2019-10-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16440
pull_request: https://github.com/python/cpython/pull/16902

___
Python tracker 

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



[issue38563] ProactorEventLoop.close(): set_wakeup_fd() only works in main thread

2019-10-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 1b53a24fb4417c764dd5933bce505f5c94249ca6 by Victor Stinner in 
branch 'master':
bpo-34679: ProactorEventLoop only uses set_wakeup_fd() in main thread (GH-16901)
https://github.com/python/cpython/commit/1b53a24fb4417c764dd5933bce505f5c94249ca6


--

___
Python tracker 

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



[issue34028] Python 3.7.0 wont compile with SSL Support 1.1.0 > alledged missing X509_VERIFY_PARAM_set1_host() support

2019-10-23 Thread Malek Ghantous


Malek Ghantous  added the comment:

I'm having a similar problem.  I'm trying to compile on Red Hat 6.9 using a 
locally installed OpenSSL library.  I've tried everything here (I think) and I 
still get this error:

checking for openssl/ssl.h in /home/mf/dp/mpma/ghantousm/apptron/local/... yes  
 
checking whether compiling and linking against OpenSSL works... no  
 
checking for --with-ssl-default-suites... python
 

I've ensured the libssl.* files are all present or linked to in 
/home/mf/dp/mpma/ghantousm/apptron/local/lib and .../lib64, the include files 
are present, the OpenSSL build seemed fine, and I compiled version 1.1.1d of 
openssl.  I've tried setting LDFLAGS and rpath and still no dice; the setup.py 
module doesn't seem to have any hard-coded paths so I'm really at a loss to 
understand what is wrong.  I've tried both versions 3.8.0 and 3.7.3 of python 
with the --with-openssl=/home/mf/dp/mpma/ghantousm/apptron/local option set, 
and version 3.6.8 (which doesn't accept any ssl related options).

This bug seems to have been preserved for a number of versions, so I'd like to 
help squash it if I can, but not sure where to go to from here.  I notice that 
some of the reports here suggest that they've had success with work-arounds, 
but as I stated none of them seem to work for me and I'm unable to compile with 
ssl support.

--
nosy: +malektronic
type:  -> compile error
versions: +Python 3.8 -Python 3.7

___
Python tracker 

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



[issue34679] asyncio.add_signal_handler call fails if not on main thread

2019-10-23 Thread miss-islington


miss-islington  added the comment:


New changeset cbf474c98e702d12c97cd16a1e44ede10ea52b5b by Miss Skeleton (bot) 
in branch '3.8':
bpo-34679: ProactorEventLoop only uses set_wakeup_fd() in main thread (GH-16901)
https://github.com/python/cpython/commit/cbf474c98e702d12c97cd16a1e44ede10ea52b5b


--

___
Python tracker 

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



[issue38563] ProactorEventLoop.close(): set_wakeup_fd() only works in main thread

2019-10-23 Thread miss-islington


miss-islington  added the comment:


New changeset cbf474c98e702d12c97cd16a1e44ede10ea52b5b by Miss Skeleton (bot) 
in branch '3.8':
bpo-34679: ProactorEventLoop only uses set_wakeup_fd() in main thread (GH-16901)
https://github.com/python/cpython/commit/cbf474c98e702d12c97cd16a1e44ede10ea52b5b


--
nosy: +miss-islington

___
Python tracker 

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



[issue38563] ProactorEventLoop.close(): set_wakeup_fd() only works in main thread

2019-10-23 Thread STINNER Victor


STINNER Victor  added the comment:

Yury and Andrew approved my PR 16901, so I merged it.

Thanks for the bug report Carlton Gibson.

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



[issue34028] Python 3.7.0 wont compile with SSL Support 1.1.0 > alledged missing X509_VERIFY_PARAM_set1_host() support

2019-10-23 Thread Christian Heimes


Christian Heimes  added the comment:

Python uses https://www.gnu.org/software/autoconf-archive/ax_check_openssl.html 
to detect and check for OpenSSL. Please check config.log for any errors. The 
log file will contain an error message. 

How did you compile OpenSSL? Did you configure the sources with "./config 
shared" ?

config.log:
...
configure:17184: checking whether compiling and linking against OpenSSL works
Trying link with 
OPENSSL_LDFLAGS=-L/home/heimes/dev/python/multissl/openssl/1.1.0l/lib; 
OPENSSL_LIBS=-lssl -lcrypto; 
OPENSSL_INCLUDES=-I/home/heimes/dev/python/multissl/openssl/1.1.0l/include
configure:17206: gcc -pthread -o conftest  
-I/home/heimes/dev/python/multissl/openssl/1.1.0l/include   
-L/home/heimes/dev/python/multissl/openssl/1.1.0l/lib conftest.c -lssl -lcrypto 
-lcrypt -lpthread -ldl  -lutil -lm >&5
configure:17206: $? = 0
configure:17208: result: yes
configure:17231: checking for X509_VERIFY_PARAM_set1_host in libssl
configure:17260: gcc -pthread -o conftest  
-I/home/heimes/dev/python/multissl/openssl/1.1.0l/include   
-L/home/heimes/dev/python/multissl/openssl/1.1.0l/lib conftest.c -lssl -lcrypto 
-lcrypt -lpthread -ldl  -lutil -lm >&5
configure:17260: $? = 0
configure:17271: result: yes
configure:17288: checking for --with-ssl-default-suites
configure:17317: result: python
...

make:
...
building '_ssl' extension
gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 
-Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter 
-Wno-missing-field-initializers -Werror=implicit-function-declaration 
-I./Include/internal -I/home/heimes/dev/python/multissl/openssl/1.1.0l/include 
-I./Include -I. -I/usr/local/include -I/home/heimes/dev/python/cpython/Include 
-I/home/heimes/dev/python/cpython -c 
/home/heimes/dev/python/cpython/Modules/_ssl.c -o 
build/temp.linux-x86_64-3.9/home/heimes/dev/python/cpython/Modules/_ssl.o
gcc -pthread -shared 
build/temp.linux-x86_64-3.9/home/heimes/dev/python/cpython/Modules/_ssl.o 
-L/home/heimes/dev/python/multissl/openssl/1.1.0l/lib -L/usr/local/lib -lssl 
-lcrypto -o build/lib.linux-x86_64-3.9/_ssl.cpython-39-x86_64-linux-gnu.so
...

./python
>>> import _ssl
>>> _ssl._OPENSSL_API_VERSION
(1, 1, 0, 12, 15)

--

___
Python tracker 

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



[issue32856] Optimize the `for y in [x]` idiom in comprehensions

2019-10-23 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

OOC, rather than optimizing a fairly ugly use case, might another approach be 
to make walrus less leaky? Even if observable leakage is considered desirable, 
it strikes me that use cases for walrus in genexprs and comprehensions likely 
break up into:

1. 90%: Cases where variable is never used outside genexpr/comprehension 
(because functional programming constructs shouldn't have side-effects, gosh 
darn it!)
2. 5%: Cases where variable is used outside genexpr/comprehension and expects 
leakage
3. 5%: Cases where variable is used outside genexpr/comprehension, but never in 
a way that actually relies on the value set in the genexpr/comprehension (same 
name chosen by happenstance)

If the walrus behavior in genexpr/comprehensions were tweaked to say that it 
only leaks if:

1. It's running at global scope (unavoidable, since there's no way to tell if 
it's an intended part of the module's interface)

or

2. A global or nonlocal statement within the function made it clear the name 
was considered stateful (again, like running at global scope, there is no way 
to know for sure if the name will be used somewhere else)

or

3. At some point in the function, outside the genexpr/comprehension, the value 
of the walrus-assigned name was read.

Case #3 could be even more narrow if the Python AST optimizer was fancier, 
potentially something like "if the value was read *after* the 
genexpr/comprehension, but *before* any following *unconditional* writes to the 
same name" (so [leaked := x for x in it] wouldn't bother to leak "leaked" if 
the next line was "leaked = 1" even if "leaked" were read three lines later, or 
the only reads from leaked occurred before the genexpr/comprehension), but I 
don't think the optimizer is up to that; following simple rules similar to 
those the compiler already follows to identify local names should cover 90% of 
cases anyway.

Aside from the dict returned by locals, and the possibility of earlier 
finalizer invocation (which you couldn't rely on outside CPython anyway), 
there's not much difference in behavior between a leaking and non-leaking 
walrus when the value is never referred to again, and it seems like the 90% 
case for cases where unwanted leakage occurs would be covered by this. Sure, if 
my WAG on use case percentages is correct, 5% of use cases would continue to 
leak even though they didn't benefit from it, but it seems like optimizing the 
90% case would do a lot more good than optimizing what's already a 
micro-optimization that 99% of Python programmers would never use (and 
shouldn't really be encouraged, since it would rely on CPython implementation 
details, and produce uglier code).

I was also inspired by this to look at replacing BUILD_LIST with BUILD_TUPLE 
when followed by GET_ITER (so "[y for x in it for y in [derived(x)]]" would at 
least get the performance benefit of looping over a one-element tuple rather 
than a one-element list), thinking it might reduce the overhead of [y for x in 
a for y in [x]] in your unpatched benchmark by making it equivalent to [y for x 
in a for y in (x,)] while reading more prettily, but it turns out you beat me 
to it with issue32925, so good show there! :-)

You should probably rerun your benchmarks though; with issue32925 committed (a 
month after you posted the benchmarks here), the performance discrepancy should 
be somewhat less (estimate based on local benchmarking says maybe 20% faster 
with BUILD_LIST being optimized to BUILD_TUPLE). Still much faster with the 
proposed optimization than without, but I suspect even optimized, few folks 
will think to write their comprehensions to take advantage of it, which is why 
I was suggesting tweaks to the more obvious walrus operator.

--
nosy: +josh.r

___
Python tracker 

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



[issue16381] Introduce option to force the interpreter to exit upon MemoryErrors

2019-10-23 Thread STINNER Victor


STINNER Victor  added the comment:

It is possible to install a custom hook on memory allocators using the PEP 445: 
see for example attached fatalmalloc.c.

I don't see much traction to get this feature since 2013, I reject the feature 
request.

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



[issue38566] Description of '\w' behavior is vague in `re` documentation

2019-10-23 Thread James Gerity

New submission from James Gerity :

The documentation for the `re` library¹ describes the behavior of the specifier 
'\w' as matching "Unicode word characters," which is very vague. The closest 
thing I can find that corresponds to this language is the guidance offered in 
Unicode Technical Standard #18², which defines the class `` to 
include all alphabetic and decimal codepoints, as well as U+200C ZERO WIDTH 
NON-JOINER and U+200D ZERO WIDTH JOINER. This does not appear to be a correct 
description of `re`, however, as these zero-width characters are not counted 
when matching '\w', e.g.:

```
>>> re.match('\w*', 'Auf\u200Clage')

```

It seems from examining the CPython source³ that SRE treats '\w' as meaning any 
alphanumeric character OR U+005F SPACING UNDERSCORE, which does not match any 
Unicode class definition I've been able to find.

Can anyone provide clarification on what part of Unicode this documentation is 
referring to? If there is some other definition, the documentation should be 
more specific about referring to it (and including a link would be preferred). 
If instead the documentation is incorrect, this language should be changed to 
describe the true meaning of \w.

¹ https://docs.python.org/3/library/re.html#index-32
² http://unicode.org/reports/tr18/
³ https://github.com/python/cpython/blob/master/Modules/_sre.c#L125

--
assignee: docs@python
components: Documentation
messages: 355239
nosy: docs@python, snoopjedi
priority: normal
severity: normal
status: open
title: Description of '\w' behavior is vague in `re` documentation

___
Python tracker 

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



[issue38563] ProactorEventLoop.close(): set_wakeup_fd() only works in main thread

2019-10-23 Thread Carlton Gibson


Carlton Gibson  added the comment:

Super turn-around. Thank you all.

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

___
Python tracker 

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



[issue38563] ProactorEventLoop.close(): set_wakeup_fd() only works in main thread

2019-10-23 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue34028] Python 3.7.0 wont compile with SSL Support 1.1.0 > alledged missing X509_VERIFY_PARAM_set1_host() support

2019-10-23 Thread Charalampos Stratakis


Charalampos Stratakis  added the comment:

Have you also tried $ yum install openssl-devel ?

That should work without requiring to compile openssl from source, unless you 
want a later version, which isn't advisable to install system-wide, as it could 
break other things.

--
nosy: +cstratak

___
Python tracker 

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



[issue38567] urllib.parse.unquote_plus raises incorrect errormessage when string parameter is bytes

2019-10-23 Thread stein-k


New submission from stein-k :

urllib.parse.unquote_plus(b'abc%20def')
...
TypeError: a bytes-like object is required, not 'str'

--
components: Library (Lib)
messages: 355242
nosy: stein-k
priority: normal
severity: normal
status: open
title: urllib.parse.unquote_plus raises incorrect errormessage when string 
parameter is bytes
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



[issue38567] urllib.parse.unquote_plus raises incorrect errormessage when string parameter is bytes

2019-10-23 Thread stein-k


Change by stein-k :


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

___
Python tracker 

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



[issue37025] Misleading error message "Python failed to load the default activation context"

2019-10-23 Thread Steve Dower


Steve Dower  added the comment:


New changeset 009a6928727b23344613ab6a9a52b9da56ab905c by Steve Dower (Zackery 
Spytz) in branch '2.7':
bpo-37025: AddRefActCtx() shouldn't be checked for failure (GH-16897)
https://github.com/python/cpython/commit/009a6928727b23344613ab6a9a52b9da56ab905c


--

___
Python tracker 

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



[issue37025] Misleading error message "Python failed to load the default activation context"

2019-10-23 Thread Steve Dower


Steve Dower  added the comment:

Merged the 2.7 fix. Let's just delete the whole block in master.

--

___
Python tracker 

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



[issue30458] [security][CVE-2019-9740][CVE-2019-9947] HTTP Header Injection (follow-up of CVE-2016-5699)

2019-10-23 Thread Riccardo Schirone


Riccardo Schirone  added the comment:

CVE-2019-18348 has been assigned to the issue explained in 
https://bugs.python.org/issue30458#msg347282 . Maybe a separate bug for it 
would be better though. CVE-2019-18348 is about injecting CRLF in HTTP requests 
through the *host* part of a URL.

--

___
Python tracker 

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



[issue34172] multiprocessing.Pool and ThreadPool leak resources after being deleted

2019-10-23 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

Pablo's fix looks like a superset of the original fix applied here, so I'm 
assuming it fixes this issue as well.

--
nosy: +josh.r

___
Python tracker 

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



[issue34172] multiprocessing.Pool and ThreadPool leak resources after being deleted

2019-10-23 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

It should probably be backport to all supported 3.x branches though, so people 
aren't required to move to 3.8 to benefit from it.

--

___
Python tracker 

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



[issue38551] lib2to3 Grammar.txt doesn't have Python 3.8 grammar changes

2019-10-23 Thread Brett Cannon


Brett Cannon  added the comment:

@Peter you can close this if issue36541 will fix your issue (i.e. both 
assignment expressions and positional-only parameters).

--
nosy: +brett.cannon

___
Python tracker 

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



[issue38566] Description of '\w' behavior is vague in `re` documentation

2019-10-23 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

The definition of \w, historically, has corresponded to the set of characters 
that can occur in legal variable names in C (alphanumeric ASCII plus 
underscores, making it equivalent to [a-zA-Z0-9_] for ASCII regex). That's why, 
on top of the definitely wordy alphabetic characters, and the arguably wordy 
numerics, it includes the underscore, _.

That definition predates Unicode entirely, and Python is just building on it by 
expanding the definition of "alphanumeric" to encompass all alphanumeric 
characters in Unicode.

We definitely can't remove underscores from the definition without breaking 
existing code which assumes a common subset of PCRE support (every regex flavor 
I know of includes underscores in \w). Adding the zero width characters seems 
of limited benefit (especially in the non-joiner case; if you're trying to pull 
out words, presumably you don't want to group letters across a non-joining 
boundary?). Basically, you're parsing "Unicode word characters" as "Unicode's 
definition of word characters", when it's really meant to mean "All word 
characters, not just ASCII".

You omitted the clarifying remarks from the documentation though, the full 
description is:

> Matches Unicode word characters; this includes most characters that can be 
> part of a word in any language, as well as numbers and the underscore. If the 
> ASCII flag is used, only [a-zA-Z0-9_] is matched.

That's about as precise as I think we can make it (because technically, some of 
the things that count as "word characters" aren't actually part of an 
"alphabet" in the technical definition). If you think there is a clearer way of 
expressing it, please suggest a better phrasing, and this can be fixed as a 
documentation bug.

--
nosy: +josh.r

___
Python tracker 

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



[issue38560] Allow iterable argument unpacking after a keyword argument?

2019-10-23 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

I'd be +1 on this, but I'm worried about existing code relying on the 
functional use case from your example.

If we are going to discourage it, I think we either have to:

1. Have DeprecationWarning that turns into a SyntaxError, or
2. Never truly remove it, but make it a SyntaxWarning immediately and leave it 
that way indefinitely

--
nosy: +josh.r

___
Python tracker 

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



[issue36541] Make lib2to3 grammar more closely match Python

2019-10-23 Thread Peter Ludemann


Peter Ludemann  added the comment:

Also the Grammar.txt diffs look about the same size as I've seen with other 
upgrades to lib2to3 when the Python grammar changed.

--

___
Python tracker 

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



[issue38551] lib2to3 Grammar.txt doesn't have Python 3.8 grammar changes

2019-10-23 Thread Peter Ludemann


Peter Ludemann  added the comment:

issue36541 and its proposed PR seem to cover my needs.

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



[issue38568] [3.7.5 x86_64 Linux] f-string parsing results in EOL

2019-10-23 Thread Ying Wang


New submission from Ying Wang :

Hey,

I encountered an interesting bug when trying to do string parsing using 
f-strings. I am currently under the impression that within the curly braces is 
any expression that can be successfully evaluated in a REPL. Here's the error:

```bash
yingw787@yingw787-Oryx-Pro:~/src/gpudb-dev-v6.2.0/kio/kio/tests/regression/_data/csv$
 python
Python 3.7.5 (default, Oct 15 2019, 21:38:37) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> blah = '"hi"'
>>> blah
'"hi"'
>>> f'{blah.strip('"')}'
  File "", line 1
f'{blah.strip('"')}'
   ^
SyntaxError: EOL while scanning string literal
>>> '{0}'.format(blah.strip('"'))
'hi'
>>> 
```

I can use '.format()' for now, but it might be nice to align f-string expr 
behavior w/ .format(). Please let me know if you need more reproduction steps, 
or if you need a helping hand :)

Thanks
Ying

--
components: Interpreter Core
messages: 355254
nosy: yingw787
priority: normal
severity: normal
status: open
title: [3.7.5 x86_64 Linux] f-string parsing results in EOL
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue38568] [3.7.5 x86_64 Linux] f-string parsing results in EOL

2019-10-23 Thread Zachary Ware


Zachary Ware  added the comment:

This is because you're trying to use the string's delimiting character (') in 
the string itself, which won't work for fairly apparent reasons :).  Try 
removing the `f` prefix and see what happens.

You can get around this by using a triple-quoted string which will allow you to 
use both quote characters within the string:

>>> blah = '"hi"'
>>> f'''{blah.strip('"')}'''
'hi'

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

___
Python tracker 

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



[issue38568] [3.7.5 x86_64 Linux] f-string parsing results in EOL

2019-10-23 Thread Hobs


Hobs  added the comment:

Not a bug. If you use quotes inside an f-string (or any other kind of
string) they need to be escaped.
--Hobson

On Wed, Oct 23, 2019 at 12:09 PM Ying Wang  wrote:

>
> New submission from Ying Wang :
>
> Hey,
>
> I encountered an interesting bug when trying to do string parsing using
> f-strings. I am currently under the impression that within the curly braces
> is any expression that can be successfully evaluated in a REPL. Here's the
> error:
>
> ```bash
> yingw787@yingw787-Oryx-Pro:~/src/gpudb-dev-v6.2.0/kio/kio/tests/regression/_data/csv$
> python
> Python 3.7.5 (default, Oct 15 2019, 21:38:37)
> [GCC 5.4.0 20160609] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> blah = '"hi"'
> >>> blah
> '"hi"'
> >>> f'{blah.strip('"')}'
>   File "", line 1
> f'{blah.strip('"')}'
>^
> SyntaxError: EOL while scanning string literal
> >>> '{0}'.format(blah.strip('"'))
> 'hi'
> >>>
> ```
>
> I can use '.format()' for now, but it might be nice to align f-string expr
> behavior w/ .format(). Please let me know if you need more reproduction
> steps, or if you need a helping hand :)
>
> Thanks
> Ying
>
> --
> components: Interpreter Core
> messages: 355254
> nosy: yingw787
> priority: normal
> severity: normal
> status: open
> title: [3.7.5 x86_64 Linux] f-string parsing results in EOL
> type: behavior
> versions: Python 3.7
>
> ___
> 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



[issue38566] Description of '\w' behavior is vague in `re` documentation

2019-10-23 Thread James Gerity


James Gerity  added the comment:

Cheers for the additional context. My recommendation would be to change the 
language to avoid confusion with the consortium's formal specifications. 
Describing what SRE does should be fine:

> Matches any alphanumeric Unicode character, as well as '_'. If the ASCII flag 
> is used, only [a-zA-Z0-9_] is matched.

I think it'd also be nice for the term "alphanumeric Unicode character" to link 
to the documentation for `str.isalnum()`, which provides enough clarity for the 
user to work out exactly what Unicode category properties will end up 
qualifying as a match.

--

___
Python tracker 

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



[issue34776] Postponed annotations break inspection of dataclasses

2019-10-23 Thread David Hagen


David Hagen  added the comment:

This PR has been sitting for a while. Any chance we can bring it over the 
finish line?

--

___
Python tracker 

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



[issue38568] [3.7.5 x86_64 Linux] f-string parsing results in EOL

2019-10-23 Thread Hobs


Hobs  added the comment:

It is a limitation of f-strings, though. We're not allowed to use
backslashes within the f-string expression in curly braces. So to do what
you want you have to create another variable containing the quote character:

```
>>> blah = '"hi"'
>>> blah
'"hi"'
>>> q = '"'
>>> f'{blah.strip(q)}'
'hi'
```
--Hobson

On Wed, Oct 23, 2019 at 12:21 PM Hobson Lane  wrote:

> Not a bug. If you use quotes inside an f-string (or any other kind of
> string) they need to be escaped.
> --Hobson
>
>
> On Wed, Oct 23, 2019 at 12:09 PM Ying Wang  wrote:
>
>>
>> New submission from Ying Wang :
>>
>> Hey,
>>
>> I encountered an interesting bug when trying to do string parsing using
>> f-strings. I am currently under the impression that within the curly braces
>> is any expression that can be successfully evaluated in a REPL. Here's the
>> error:
>>
>> ```bash
>> yingw787@yingw787-Oryx-Pro:~/src/gpudb-dev-v6.2.0/kio/kio/tests/regression/_data/csv$
>> python
>> Python 3.7.5 (default, Oct 15 2019, 21:38:37)
>> [GCC 5.4.0 20160609] on linux
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> blah = '"hi"'
>> >>> blah
>> '"hi"'
>> >>> f'{blah.strip('"')}'
>>   File "", line 1
>> f'{blah.strip('"')}'
>>^
>> SyntaxError: EOL while scanning string literal
>> >>> '{0}'.format(blah.strip('"'))
>> 'hi'
>> >>>
>> ```
>>
>> I can use '.format()' for now, but it might be nice to align f-string
>> expr behavior w/ .format(). Please let me know if you need more
>> reproduction steps, or if you need a helping hand :)
>>
>> Thanks
>> Ying
>>
>> --
>> components: Interpreter Core
>> messages: 355254
>> nosy: yingw787
>> priority: normal
>> severity: normal
>> status: open
>> title: [3.7.5 x86_64 Linux] f-string parsing results in EOL
>> type: behavior
>> versions: Python 3.7
>>
>> ___
>> Python tracker 
>> 
>> ___
>> ___
>> New-bugs-announce mailing list
>> new-bugs-annou...@python.org
>> https://mail.python.org/mailman/listinfo/new-bugs-announce
>>
>

--

___
Python tracker 

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



[issue38568] [3.7.5 x86_64 Linux] f-string parsing results in EOL

2019-10-23 Thread Ying Wang


Ying Wang  added the comment:

Oh cool, I didn't know triple quotes can be used as part of f-strings! Thanks 
for the explanation!

--

___
Python tracker 

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



[issue34776] Postponed annotations break inspection of dataclasses

2019-10-23 Thread Gregory P. Smith


Change by Gregory P. Smith :


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



[issue30458] [security][CVE-2019-9740][CVE-2019-9947] HTTP Header Injection (follow-up of CVE-2016-5699)

2019-10-23 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Can you please open a separate issue for CVE-2019-18348?  It is easier to track 
that way.

(META: In general I think the CVE process is being abused and that these really 
did not deserve that treatment.  https://lwn.net/Articles/801157/  is good 
reading and food for thought.)

--

___
Python tracker 

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



[issue38569] Unknown distribution option: 'license_files'

2019-10-23 Thread Marco Sulla


New submission from Marco Sulla :

I tried to add to `setuptools.setup()` the argument license_files. It works, 
but I get this warning:

/usr/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution 
option: 'license_files'

I suppose the warning can be removed.

--
components: Distutils
messages: 355262
nosy: Marco Sulla, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: Unknown distribution option: 'license_files'
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



[issue34384] os.readlink does not accept pathlib.Path on Windows

2019-10-23 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

can this be closed?

--
nosy: +gregory.p.smith
status: pending -> open

___
Python tracker 

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



[issue30618] readlink for pathlib paths

2019-10-23 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
assignee:  -> gregory.p.smith
nosy: +gregory.p.smith

___
Python tracker 

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



[issue34384] os.readlink does not accept pathlib.Path on Windows

2019-10-23 Thread Steve Dower


Steve Dower  added the comment:

Yep

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



[issue38570] Shlex does not parse commands containing single quotes correctly

2019-10-23 Thread timonegk


New submission from timonegk :

Steps to reproduce:
>>> from shlex import split
>>> line = "export F=$'\\''"
>>> split(line)
ValueError: No closing quotation

However, when printing the line

>>> print(line)
export F=$'\''

and pasting the output in bash, no further quotation marks are required.
The behavior of bash is described in its man page (line 497 for me, Chapter 
Quoting) and occurs also when bash is called with --posix. Therefore I guess 
that shlex does not reproduce the posix behavior here.

--
components: Library (Lib)
messages: 355265
nosy: timonegk
priority: normal
severity: normal
status: open
title: Shlex does not parse commands containing single quotes correctly
type: behavior
versions: Python 2.7, Python 3.7

___
Python tracker 

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



[issue30618] readlink for pathlib paths

2019-10-23 Thread miss-islington


miss-islington  added the comment:


New changeset a01ba333affcc0677146dc8af57179bdb808d608 by Miss Skeleton (bot) 
(Girts) in branch 'master':
bpo-30618: add readlink to pathlib.Path (GH-8285)
https://github.com/python/cpython/commit/a01ba333affcc0677146dc8af57179bdb808d608


--
nosy: +miss-islington

___
Python tracker 

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



[issue38560] Allow iterable argument unpacking after a keyword argument?

2019-10-23 Thread Brandt Bucher


Brandt Bucher  added the comment:

I've found one occurrence of this in the CPython codebase, in test_ast.py. 
Basically it makes sure that the following expression parses and compiles 
correctly:

f(1,2,c=3,*d,**e)

I doubt that this is to protect against regressions in this specific syntax. 
More likely it's just trying to create as many of the different argument 
passing AST nodes as possible in one call (it's the only test for function 
calls with arguments). It can probably be slightly refactored:

f(1,2,*c,d=3,**e)

--

___
Python tracker 

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



[issue34776] Postponed annotations break inspection of dataclasses

2019-10-23 Thread Yury Selivanov


Yury Selivanov  added the comment:

FWIW we discussed my patch with Eric at PyCon 2019 and I think he had no issues 
with it.  Eric, can I merge it?  Should we backport to 3.8?

--

___
Python tracker 

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



[issue34776] Postponed annotations break inspection of dataclasses

2019-10-23 Thread Eric V. Smith


Eric V. Smith  added the comment:

Yury: I'm okay with merging. If I recall, you were going to add a comment or 
two about the approach (a closure, if I remember correctly).

I think we should backport to 3.8 and 3.7: it's a bug.

--

___
Python tracker 

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



[issue34776] Postponed annotations break inspection of dataclasses

2019-10-23 Thread Yury Selivanov


Yury Selivanov  added the comment:

> Yury: I'm okay with merging. If I recall, you were going to add a comment or 
> two about the approach (a closure, if I remember correctly).

Sure, I'll rebase and add a comment in a couple of days.  I'll elevate the 
status so that I don't forget before 3.8.1

--
assignee: eric.smith -> yselivanov
priority:  -> deferred blocker

___
Python tracker 

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



[issue30618] readlink for pathlib paths

2019-10-23 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Thanks Girts!

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

___
Python tracker 

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



[issue30064] BaseSelectorEventLoop.sock_{recv, sendall}() don't remove their callbacks when canceled

2019-10-23 Thread Yury Selivanov


Yury Selivanov  added the comment:

I think this broke asyncio a bit.  These two uvloop sock_* API tests no longer 
pass on asyncio 3.8:

* https://github.com/MagicStack/uvloop/blob/master/tests/test_sockets.py#L192

* https://github.com/MagicStack/uvloop/blob/master/tests/test_sockets.py#L238

Andrew, since this was your patch, please take a look.

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



[issue30064] BaseSelectorEventLoop.sock_{recv, sendall}() don't remove their callbacks when canceled

2019-10-23 Thread Yury Selivanov


Yury Selivanov  added the comment:

I'll elevate the status so that we don't forget before 3.8.1 is too close

--
priority: normal -> deferred blocker

___
Python tracker 

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



[issue38571] Segfault with StopIteration

2019-10-23 Thread Kevin Chen


New submission from Kevin Chen :

Unfortunately, I don't currently have a simple test case, but after migrating 
an app from python 3.6 to python 3.7, python frequently (but not always) 
segfaults when running tests for my app in code related to StopIteration 
(perhaps somehow related to the implementation of PEP 479?).

I'm running a self-built (from python.org sources) unpatched build of Python 
3.7.5 on Ubuntu Xenial.

(The output below is edited to redact some path names.)

Core was generated by `./python'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0044cc40 in PyException_GetContext (self=self@entry=0x441cbe0)
at Objects/exceptions.c:338
338 Py_XINCREF(context);

(gdb) py-bt
Traceback (most recent call first):
  File "lib/requests/models.py", line 750, in generate
for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "lib/requests/models.py", line 828, in content
self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b''
  File "lib/requests/sessions.py", line 686, in send
r.content
  File "lib/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
  File "lib/requests/sessions.py", line 546, in get
return self.request('GET', url, **kwargs)
[trace continues with other files specific to my app]

(gdb) bt
#0  0x0044cc40 in PyException_GetContext (
self=self@entry=) at Objects/exceptions.c:338
#1  0x0050b76d in PyErr_SetObject (
exception=, value=StopIteration())
at Python/errors.c:126
#2  0x0050ba17 in PyErr_SetNone (exception=)
at Python/errors.c:163
#3  0x005d254d in gen_send_ex (gen=0x4351b00, arg=, 
exc=, closing=) at Objects/genobject.c:241
#4  0x00429406 in _PyEval_EvalFrameDefault (f=, 
throwflag=) at Python/ceval.c:2809
#5  0x005d20cb in gen_send_ex (gen=0x457c1b0, arg=, 
exc=, closing=) at Objects/genobject.c:221
#6  0x00459679 in list_extend (self=self@entry=0x445a590, 
iterable=iterable@entry=)
at Objects/listobject.c:897
#7  0x0045de55 in _PyList_Extend (self=self@entry=0x445a590, 
iterable=iterable@entry=)
at Objects/listobject.c:937
#8  0x005b76fc in PySequence_List (
v=v@entry=) at Objects/abstract.c:1905
#9  0x005b867d in PySequence_Fast (v=, 
m=m@entry=0x603715 "can only join an iterable") at Objects/abstract.c:1935
#10 0x00438e02 in stringlib_bytes_join (sep=b'', 
iterable=) at Objects/stringlib/join.h:22
#11 0x00445b53 in _PyMethodDef_RawFastCallKeywords (
method=0x8b0cc0 , self=self@entry=b'', 
args=args@entry=0x4322f20, nargs=nargs@entry=1, kwnames=kwnames@entry=0x0)
at Objects/call.c:648
#12 0x005cfabf in _PyMethodDescr_FastCallKeywords (
descrobj=, 
args=args@entry=0x4322f18, nargs=nargs@entry=2, kwnames=kwnames@entry=0x0)
at Objects/descrobject.c:288
#13 0x0042df85 in call_function (kwnames=0x0, oparg=2, 
pp_stack=) at Python/ceval.c:4593
#14 _PyEval_EvalFrameDefault (f=, throwflag=)
at Python/ceval.c:3110
#15 0x004211c5 in function_code_fastcall (co=co@entry=0x3597c30, 
args=, args@entry=0x3ce1f08, nargs=nargs@entry=1, 
globals=globals@entry={'__name__': 'requests.models', '__doc__': 
'\nrequests.models\n~~~\n\nThis module contains the primary objects 
that power Requests.\n', '__package__': 'requests', '__loader__': 
, '__spec__': , origin='lib/requests/models.py', loader_state=None, 
submodule_search_locations=None, _set_fileattr=True, 
_cached='lib/requests/__pycache__/models.cpython-37.pyc', _initializing=False) 
at remote 0x354cd70>, '__file__': 'lib/requests/models.py', '__cached__': 
'lib/requests/__pycache__/models.cpython-37.pyc', '__builtins__': {'__name__': 
'builtins', '__doc__': "Built-in functions, exceptions, and other 
objects.\n\nNoteworthy: N...(truncated)) at Objects/call.c:283
#16 0x00445180 in _PyFunction_FastCallDict (
func=, args=0x3ce1f08, nargs=1, kwargs=0x0)
at Objects/call.c:322
[remainder of trace redacted]

Sometimes the C backtrace is slightly different, but very similar:

Core was generated by `./python'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  PyErr_SetObject (exception=0x8b7c00 <_PyExc_StopIteration>, value=0x0)
at Python/errors.c:101
101 Py_INCREF(exc_value);

(gdb) bt
#0  PyErr_SetObject (exception=, value=0x0)
at Python/errors.c:101
#1  0x0050ba17 in PyErr_SetNone (exception=)
at Python/errors.c:163
#2  0x005d254d in gen_send_ex (gen=0x3c71b10, arg=, 
exc=, closing=) at Objects/genobject.c:241
[rest of trace not listed, since it appears to be the same as the previous one]

When running my app's tests, I've also seen one occurrence (possibly related to 
these crashes) when Python aborted because a reference count was -6.

--
components: Interpreter Core
messages: 355274
nosy: kchen
priority: normal
severity: norm

[issue38092] environment variables not passed correctly using new virtualenv launching in windows and python3.7+

2019-10-23 Thread Eryk Sun


Eryk Sun  added the comment:

This should revert to setting `_python_exe = sys.executable` in 
Lib/multiprocessing/spawn.py. Then the code in 
Lib/multiprocessing/popen_spawn_win32.py will set __PYVENV_LAUNCHER__ in the 
spawned process to the virtual environment's sys.executable. Otherwise the 
worker process has no connection to the virtual environment, other than how 
sys.path gets manually copied from the parent process. In particular, without 
setting __PYVENV_LAUNCHER__, sys.executable is not the virtual-environment 
executable and sys.prefix is not the virtual-environment directory.

Also, the fix for the parameters that are passed to _winapi.CreateProcess needs 
to be backported to 3.7. Else __PYVENV_LAUNCHER__ won't actually be set in the 
child.

--
nosy: +eryksun
resolution: fixed -> 
stage: resolved -> needs patch
status: closed -> open
versions: +Python 3.7

___
Python tracker 

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



[issue38567] urllib.parse.unquote_plus raises incorrect error message when string parameter is bytes

2019-10-23 Thread Emmanuel Arias


Change by Emmanuel Arias :


--
nosy: +eamanu
title: urllib.parse.unquote_plus raises incorrect errormessage when string 
parameter is bytes -> urllib.parse.unquote_plus raises incorrect error message 
when string parameter is bytes

___
Python tracker 

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



[issue38559] async generators aclose() behavior in 3.8

2019-10-23 Thread Yury Selivanov


Yury Selivanov  added the comment:

The more I think about this the more I like new 3.8 behavior. I'm going to 
close this issue; if anything comes up I'll reopen it later. Sorry for the 
noise.

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



[issue38565] Expose the value passed of typed passed to functools.lru_cache

2019-10-23 Thread Manjusaka


Manjusaka  added the comment:

I think it's a good idea to expose the full arguments that people use in 
lru_cache()

--
nosy: +Manjusaka

___
Python tracker 

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



[issue20443] __code__. co_filename should always be an absolute path

2019-10-23 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Please revert.  An absolute path changes semantics in many real world 
situations (altering symlink traversals, etc).  People expect the current 
sys.argv[0] behavior which is "similar to C argv" and matches what was passed 
on the interpreter command line.

A getcwd() call doesn't even have to succeed.  A single file python program 
should still be able to run in that environment rather than fail to start.

To help address the original report filing issue, we could add a notion of 
.co_cwd to code objects for use in resolving co_filename.  Allow it to be '' if 
getcwd failed at source load time.  Code could check if co_cwd exists and join 
it with the co_filename.  Also let co_cwd remain empty when there is no valid 
co_filename for the code.

Preaching: Code that calls os.chdir() is always a potential problem as it 
alters process global state.  That call is best avoided as modifying globals is 
impolite.

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



[issue38565] Expose the value passed of typed passed to functools.lru_cache

2019-10-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +rhettinger

___
Python tracker 

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



[issue36541] Make lib2to3 grammar more closely match Python

2019-10-23 Thread Gregory P. Smith


Change by Gregory P. Smith :


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



[issue33348] lib2to3 doesn't parse f(*[] or [])

2019-10-23 Thread Gregory P. Smith


Change by Gregory P. Smith :


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



[issue32496] lib2to3 fails to parse a ** of a conditional expression

2019-10-23 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> lib2to3 doesn't parse f(*[] or [])
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



[issue33348] lib2to3 doesn't parse f(*[] or [])

2019-10-23 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
assignee:  -> gregory.p.smith
nosy: +gregory.p.smith

___
Python tracker 

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



[issue33348] lib2to3 doesn't parse f(*[] or [])

2019-10-23 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
versions: +Python 2.7

___
Python tracker 

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



[issue36541] Make lib2to3 grammar more closely match Python

2019-10-23 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
assignee:  -> gregory.p.smith
nosy: +gregory.p.smith

___
Python tracker 

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



[issue36541] Make lib2to3 grammar better match Python, support the := walrus

2019-10-23 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
title: Make lib2to3 grammar more closely match Python -> Make lib2to3 grammar 
better match Python, support the := walrus

___
Python tracker 

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



[issue38571] Segfault with StopIteration

2019-10-23 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

There isn't really much we can do without a reasonable repeatable way to 
reproduce the problem.

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue33348] lib2to3 doesn't parse f(*[] or [])

2019-10-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16443
pull_request: https://github.com/python/cpython/pull/16913

___
Python tracker 

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



[issue33348] lib2to3 doesn't parse f(*[] or [])

2019-10-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16444
pull_request: https://github.com/python/cpython/pull/16914

___
Python tracker 

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



[issue33348] lib2to3 doesn't parse f(*[] or [])

2019-10-23 Thread miss-islington


miss-islington  added the comment:


New changeset 96b06aefe23521b61e4e9cdd44f5d30b00c7eb95 by Miss Skeleton (bot) 
(Zsolt Dollenstein) in branch 'master':
bpo-33348: parse expressions after * and ** in lib2to3 (GH-6586)
https://github.com/python/cpython/commit/96b06aefe23521b61e4e9cdd44f5d30b00c7eb95


--
nosy: +miss-islington

___
Python tracker 

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



[issue33348] lib2to3 doesn't parse f(*[] or [])

2019-10-23 Thread miss-islington


miss-islington  added the comment:


New changeset 0160a70acbd9c530802effdf320ab08c7132f4bf by Miss Skeleton (bot) 
in branch '3.7':
bpo-33348: parse expressions after * and ** in lib2to3 (GH-6586)
https://github.com/python/cpython/commit/0160a70acbd9c530802effdf320ab08c7132f4bf


--

___
Python tracker 

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



[issue33348] lib2to3 doesn't parse f(*[] or [])

2019-10-23 Thread miss-islington


miss-islington  added the comment:


New changeset d04661f9ca4a082a2dd9de52df687600d574407e by Miss Skeleton (bot) 
in branch '3.8':
bpo-33348: parse expressions after * and ** in lib2to3 (GH-6586)
https://github.com/python/cpython/commit/d04661f9ca4a082a2dd9de52df687600d574407e


--

___
Python tracker 

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



[issue38565] Expose the value passed of typed passed to functools.lru_cache

2019-10-23 Thread Manjusaka


Change by Manjusaka :


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

___
Python tracker 

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



[issue38572] Misleading AttributeError accessing fileno attribute in tarfile

2019-10-23 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

This came up during https://github.com/psf/requests/issues/5229 . While fileno 
returns True as an attribute the actual implementation uses self.raw.fileno 
where the AttributeError is raised at 
https://github.com/python/cpython/blob/96b06aefe23521b61e4e9cdd44f5d30b00c7eb95/Lib/_pyio.py#L878
 (Python implementation) . I guess it should be raising UnsupportedOperation 
when self.raw has no fileno so that the callers only need to catch 
UnsupportedOperation. Something like below for fileno implementation that will 
give a better exception.

   def fileno(self):
if hasattr(self.raw, 'fileno'):
return self.raw.fileno()
else:
self._unsupported("fileno")

# tarfile_fileno.py

import tarfile
import os

for f in ["foo.txt", "foo.tar"]:
try:
os.unlink(f)
except OSError:
pass

with open("foo.txt", "w") as f:
f.write("foo.txt")
with tarfile.open("foo.tar", "w:gz") as tarfile_obj:
tarfile_obj.add(f.name)

with tarfile.open("foo.tar", "r:gz") as f:
member = f.extractfile("foo.txt")
print(f"Has attr : {hasattr(member, 'fileno')}")
print(member.fileno())

# Current exception

python.exe .\tarfile_fileno.py
Has attr : True
Traceback (most recent call last):
  File ".\tarfile_fileno.py", line 18, in 
print(member.fileno())
AttributeError: '_FileInFile' object has no attribute 'fileno'

# Proposed exception (Patching tarfile to use _pyio and modifying fileno as 
above) 

python.exe .\tarfile_fileno.py
Has attr : True
Traceback (most recent call last):
  File ".\tarfile_fileno.py", line 11, in 
print(member.fileno())
  File 
"C:\Users\kasingar\AppData\Local\Programs\Python\Python37-32\lib\_pyio.py", 
line 831, in fileno
self._unsupported("fileno")
  File 
"C:\Users\kasingar\AppData\Local\Programs\Python\Python37-32\lib\_pyio.py", 
line 320, in _unsupported
(self.__class__.__name__, name))
io.UnsupportedOperation: ExFileObject.fileno() not supported

--
components: Library (Lib)
messages: 355283
nosy: lars.gustaebel, serhiy.storchaka, xtreak
priority: normal
severity: normal
status: open
title: Misleading AttributeError accessing fileno attribute in tarfile
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



  1   2   >