Thomas Grainger added the comment:
the problem is multiprocessing/process is calling threading._shutdown which
tries to join its own thread, because concurrent.futures.thread._threads_queues
contains the main thread in the subprocess
File
"/home/graingert/miniconda3/envs
Change by Thomas Grainger :
--
keywords: +patch
nosy: +graingert
nosy_count: 4.0 -> 5.0
pull_requests: +30134
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/32044
___
Python tracker
<https://bugs.p
New submission from Thomas Grainger :
the following code prints:
import sys
import dis
import pprint
def demo():
for i in range(1):
if i >= 0:
pass
class Tracer:
def __init__(self):
self.events = []
def trace(self, frame, event,
Thomas Grainger added the comment:
> I'd advocate for not supporting bytes paths and instead updating the
> documentation to require strings.
I've got PR GH-31934 started to do this
--
message_count: 8.0 -> 9.0
pull_requests: +30026
pull_request: https://github
New submission from Thomas Grainger :
importing from a bytes zipimport path on sys.path results in a BytesWarning:
Comparison between bytes and string
running the reproducer with `python -b` shows:
python -b zipfile_demo.py
:1345: BytesWarning: Comparison between
bytes and string
see also
Thomas Grainger added the comment:
zipimporter.zipimporter handles non-bytes paths here:
https://github.com/python/cpython/blob/2cf7f865f099db11cc6903b334d9c376610313e8/Lib/zipimport.py#L65-L67
I think FileFinder should do the same
--
___
Python
Thomas Grainger added the comment:
interestingly bytes filenames pointing to zip files on sys.path do support
bytes (see zipfile_demo.py)
--
Added file: https://bugs.python.org/file50679/zipfile_demo.py
___
Python tracker
<https://bugs.python.
Thomas Grainger added the comment:
https://docs.python.org/3/reference/import.html#path-entry-finders says "The
encoding of bytes entries is determined by the individual path entry finders."
see
https://github.com/python/cpython/commit/82c1c781c7ee6496bd4c404b7ba972
Thomas Grainger added the comment:
this is a regression from 3.2:
```
Python 3.2.6 (default, Jan 18 2016, 19:21:14)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tempfile
>>>
Change by Thomas Grainger :
--
keywords: +patch
pull_requests: +29993
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/31897
___
Python tracker
<https://bugs.python.org/issu
Change by Thomas Grainger :
--
components: +Library (Lib)
versions: +Python 3.10, Python 3.11, Python 3.9
___
Python tracker
<https://bugs.python.org/issue47
New submission from Thomas Grainger :
importing a module with bytes in `sys.path` fails with:
File "", line 182, in _path_isabs
TypeError: startswith first arg must be bytes or a tuple of bytes, not str
(see reproducer in attached demo.py)
however `sys.path` is documented as
Thomas Grainger added the comment:
The main advantage for my usecase is support for heterogeneous unpacking
On Sat, Mar 5, 2022, 6:04 PM Alex Waygood wrote:
>
> Alex Waygood added the comment:
>
> I sense we'll have to agree to disagree on the usefulness of NamedTuple
Thomas Grainger added the comment:
there could be multiple messages here
perhaps it could be:
```
finally:
# Must reacquire lock even if wait is cancelled
cancelled = []
while True:
try:
await self.acquire
Change by Thomas Grainger :
--
keywords: +patch
pull_requests: +29629
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/31499
___
Python tracker
<https://bugs.python.org/issu
New submission from Thomas Grainger :
the following code:
import socket
import asyncio
async def amain():
with socket.socket(family=socket.AF_INET, proto=socket.IPPROTO_UDP,
type=socket.SOCK_DGRAM) as sock:
sock.setblocking(False)
await asyncio.get_running_loop
Thomas Grainger added the comment:
hello, it's actually a bit of a round about context, but it was brought up on a
tornado issue where I was attempting to port the asyncio optimization to
tornado:
https://github.com/tornadoweb/tornado/issues/3113#issuecomment-1041019287
I think it wou
Change by Thomas Grainger :
--
keywords: +patch
pull_requests: +29627
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/31497
___
Python tracker
<https://bugs.python.org/issu
New submission from Thomas Grainger :
now that the getaddrinfo lock has been removed on all platforms the numeric
only host resolve in asyncio could be moved back into BaseEventLoop.getaddrinfo
--
components: asyncio
messages: 413699
nosy: asvetlov, graingert, yselivanov
priority
Change by Thomas Grainger :
--
nosy: +graingert, vstinner
___
Python tracker
<https://bugs.python.org/issue42752>
___
___
Python-bugs-list mailing list
Unsub
Thomas Grainger added the comment:
there's a thread on typing-sig for this now:
https://mail.python.org/archives/list/typing-...@python.org/thread/I7P3ER2NH7SENVMIXK74U6L4Z5JDLQGZ/#I7P3ER2NH7SENVMIXK74U6L4Z5JDLQGZ
--
nosy: +graingert
___
P
Thomas Grainger added the comment:
this also applies to io and _pyio
--
___
Python tracker
<https://bugs.python.org/issue46522>
___
___
Python-bugs-list mailin
New submission from Thomas Grainger :
>>> import types
>>> types.ModuleType("concurrent.futures").missing_attribute
Traceback (most recent call last):
File "", line 1, in
AttributeError: module 'concurrent.futures' has no attribute &
Thomas Grainger added the comment:
actually it was already done in 13 months!
--
___
Python tracker
<https://bugs.python.org/issue38415>
___
___
Python-bug
Change by Thomas Grainger :
--
nosy: +graingert
nosy_count: 3.0 -> 4.0
pull_requests: +28454
pull_request: https://github.com/python/cpython/pull/30233
___
Python tracker
<https://bugs.python.org/issu
Thomas Grainger added the comment:
> Actually I don't agree with Thomas's logic... his argument feels like
> consistency for its own sake.
Do you expect sync and async contextmanagers to act differently?
Why would sync contextmanagers raise AttributeError and async contextm
Thomas Grainger added the comment:
you can see the analogous sync contextmanager issue on python3.6 with:
```
import logging
from contextlib import contextmanager
@contextmanager
def foo():
yield
def test():
f = foo()
f.__enter__()
f.__enter__()
test()
```
on python3.7
Thomas Grainger added the comment:
I see the change here:
https://github.com/python/cpython/commit/1c5c9c89ffc36875afaf4c3cc6a716d4bd089bbf#diff-e00601a380ba6c916ba4333277fe6ea43d2477804002ab1ae64480f80fec8e3aR177-R179
this is intentionally implementing https://bugs.python.org/issue30306 for
Thomas Grainger added the comment:
ah I can repeat this on python3.8.10 trio but not python3.9.9 trio:
```
import logging
import trio
from contextlib import asynccontextmanager
@asynccontextmanager
async def foo():
await trio.sleep(1)
yield
async def test():
async with
Thomas Grainger added the comment:
or consider the trio version:
```
import logging
import trio
from contextlib import asynccontextmanager
@asynccontextmanager
async def foo():
await trio.sleep(1)
yield
async def test():
async with trio.open_nursery() as n:
f = foo
Thomas Grainger added the comment:
I think `AttributeError: args` is the desired/expected behaviour
consider the sync version:
```
import logging
from asyncio import sleep, gather, run
from contextlib import asynccontextmanager, contextmanager
@contextmanager
def foo():
yield
def test
Change by Thomas Grainger :
--
nosy: +graingert
nosy_count: 10.0 -> 11.0
pull_requests: +27360
pull_request: https://github.com/python/cpython/pull/29091
___
Python tracker
<https://bugs.python.org/issu
Thomas Grainger added the comment:
it's as part of this discussion in
https://mail.python.org/archives/list/python-...@python.org/thread/ABR2L6BENNA6UPSPKV474HCS4LWT26GY/#IAOCDDCJ653NBED3G2J2YBWD7HHPFHT6
and others in #python-dev
specifically
https://github.com/python/cpython
Change by Thomas Grainger :
--
keywords: +patch
pull_requests: +27181
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/28886
___
Python tracker
<https://bugs.python.org/issu
Change by Thomas Grainger :
--
assignee: docs@python
components: Documentation
nosy: docs@python, graingert
priority: normal
severity: normal
status: open
title: delete misleading faq entry about atomic operations
___
Python tracker
<ht
Thomas Grainger added the comment:
afaik this is intentional https://bugs.python.org/issue31033
--
nosy: +graingert
___
Python tracker
<https://bugs.python.org/issue45
Change by Thomas Grainger :
--
keywords: +patch
pull_requests: +26930
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/28546
___
Python tracker
<https://bugs.python.org/issu
New submission from Thomas Grainger :
refactor to avoid redundant _commit_removals pending_removals guard
--
components: Library (Lib)
messages: 402554
nosy: graingert
priority: normal
severity: normal
status: open
title: avoid redundant _commit_removals pending_removals guard
versions
Change by Thomas Grainger :
--
nosy: +graingert
___
Python tracker
<https://bugs.python.org/issue45278>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Thomas Grainger :
--
keywords: +patch
pull_requests: +26925
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/28541
___
Python tracker
<https://bugs.python.org/issu
New submission from Thomas Grainger :
the weak collections should have the same threadsafe/thread unsafe guarantees
as their strong reference counterparts - eg dict.copy and set.copy are atomic
and so the weak versions should be atomic also
--
components: Interpreter Core, asyncio
Change by Thomas Grainger :
--
nosy: +pitrou
___
Python tracker
<https://bugs.python.org/issue44962>
___
___
Python-bugs-list mailing list
Unsubscribe:
Thomas Grainger added the comment:
> weakref.WeakSet is not thread-safe, which means concurrent create_task's in
> different threads (even on separate event loops) is not safe.
actually it looks like WeakSet is *supposed* to be thread-safe
```
import patchy
p
Change by Thomas Grainger :
--
pull_requests: +26373
pull_request: https://github.com/python/cpython/pull/27921
___
Python tracker
<https://bugs.python.org/issue44
Change by Thomas Grainger :
--
keywords: +patch
pull_requests: +26365
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/27909
___
Python tracker
<https://bugs.python.org/issu
Change by Thomas Grainger :
--
nosy: +pablogsal
___
Python tracker
<https://bugs.python.org/issue44963>
___
___
Python-bugs-list mailing list
Unsubscribe:
Thomas Grainger added the comment:
it also fails with asyncio.create_task
```
import asyncio
async def agen():
yield
async def main():
p = agen()
await asyncio.create_task(anext(p, 'finished'))
asyncio.run(main())
```
```
Traceback (most recent call last):
F
Thomas Grainger added the comment:
interestingly 3.10 didn't show:
sys:1: RuntimeWarning: coroutine 'BaseEventLoop.shutdown_asyncgens' was never
awaited
--
___
Python tracker
<https://bugs.pyt
Thomas Grainger added the comment:
still happens on 3.10 even though there's an `with _IterationGuard`
```
worked 0
Traceback (most recent call last):
File "/home/graingert/projects/asyncio-demo/demo.py", line 36, in
sys.exit(main())
File "/home/graingert/p
Change by Thomas Grainger :
--
versions: +Python 3.10
___
Python tracker
<https://bugs.python.org/issue44962>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Thomas Grainger :
--
versions: +Python 3.7
___
Python tracker
<https://bugs.python.org/issue44962>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Thomas Grainger :
with the following demo script I can get a IndexError: pop from empty list
```
import itertools
import asyncio
import concurrent.futures
import sys
import threading
threads = 200
def test_all_tasks_threading() -> None:
async def foo() ->
Thomas Grainger added the comment:
Depends on the redirect type they create. If it's temporary we should keep
the same URL, if it's permanent or otherwise has bookmark updating
semantics we should update the URL to follow the redirect
On Wed, 18 Aug 2021, 21:40 Jack DeVries, wrote:
Thomas Grainger added the comment:
It looks like it got archived here
https://github.com/mdn/archived-content/blob/main/files/en-us/mozilla/qa/bug_writing_guidelines/index.html
--
nosy: +graingert
___
Python tracker
<https://bugs.python.
New submission from Thomas Grainger :
demo program:
```
def test_async_fn():
async def async_fn():
pass
async_fn()
def test_async_gen_fn():
async def agen_fn():
yield
agen_fn().aclose()
agen_fn().asend(None)
test_async_fn()
test_async_gen_fn
New submission from Thomas Grainger :
HTTPX is a fully featured HTTP client for Python 3, which provides sync and
async APIs, and support for both HTTP/1.1 and HTTP/2.
It's also broadly compatible and inspired by the requests API:
https://github.com/encode/httpx/blob/master
Thomas Grainger added the comment:
Yep that's the fix I went for in the end
https://github.com/twisted/twisted/pull/1628/files#diff-8110fe13865c1f305bb999e82cd7514b2e7269f41087bd7ef39c3d6de508R105
--
___
Python tracker
&
Thomas Grainger added the comment:
lib2to3 is deprecated and is pending removal, so I think this can be closed
--
nosy: +graingert
___
Python tracker
<https://bugs.python.org/issue37
Thomas Grainger added the comment:
> using a per-descriptor `WeakKeyDictionary` to map the instance to locks
> (which would of course not work - is there any way to map unhashable
> instances weakly?)
there's an issue for that too: https://bugs.python.
Thomas Grainger added the comment:
how about deprecating the functools.cached_property?
--
nosy: +graingert
___
Python tracker
<https://bugs.python.org/issue43
New submission from Thomas Grainger :
per https://bugs.python.org/issue12915 pkgutil.resolve_name was added for use
in mock and other stdlib modules:
> pydoc has locate and resolve, packaging has util.resolve_name, unittest has
> something else, etc.
--
messages: 39790
Thomas Grainger added the comment:
hello, just chiming in to let you know that this broke CI on twisted:
https://github.com/twisted/twisted/pull/1628/ (As above for Chalice, I think
this didn't actually break the framework itself, just the tests for the
framework. )
do you know wha
Thomas Grainger added the comment:
https://docs.microsoft.com/en-us/windows/win32/seccng/cng-portal ?
--
nosy: +graingert
___
Python tracker
<https://bugs.python.org/issue44
Change by Thomas Grainger :
--
nosy: +lukasz.langa
___
Python tracker
<https://bugs.python.org/issue44428>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Thomas Grainger :
--
keywords: +patch
pull_requests: +25590
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/27024
___
Python tracker
<https://bugs.python.org/issu
Thomas Grainger added the comment:
This is the output:
```
Traceback (most recent call last):
File "/home/graingert/projects/close.py", line 5, in foo
yield
File "/home/graingert/projects/close.py", line 12, in
raise StartIrritation
__main__.StartIrritation
Thomas Grainger added the comment:
apologies I meant to post this on a new ticket
--
___
Python tracker
<https://bugs.python.org/issue1462485>
___
___
Python-bug
New submission from Thomas Grainger :
https://bugs.python.org/issue1462485
import contextlib
@contextlib.contextmanager
def foo():
yield
class StartIrritation(StopIteration):
pass
with foo():
raise StartIrritation
--
messages: 396979
nosy: graingert, ncoghlan
Thomas Grainger added the comment:
```
import contextlib
@contextlib.contextmanager
def foo():
yield
class StartIrritation(StopIteration):
pass
with foo():
raise StartIrritation
```
--
nosy: +graingert
___
Python tracker
<ht
Thomas Grainger added the comment:
nosying the author of the selector_events fix
--
___
Python tracker
<https://bugs.python.org/issue44428>
___
___
Python-bug
Change by Thomas Grainger :
--
nosy: +gvanrossum
___
Python tracker
<https://bugs.python.org/issue44428>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Thomas Grainger :
--
nosy: +graingert
___
Python tracker
<https://bugs.python.org/issue33408>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Thomas Grainger :
--
nosy: +nedbat
___
Python tracker
<https://bugs.python.org/issue6>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Thomas Grainger :
--
nosy: +Mark.Shannon -nedbat
___
Python tracker
<https://bugs.python.org/issue6>
___
___
Python-bugs-list mailing list
Unsub
New submission from Thomas Grainger :
demo:
import traceback
import io
async def foo():
yield 1
traceback.print_stack(file=io.StringIO())
yield 2
async def bar():
return [chunk async for chunk in foo()]
next(bar().__await__(), None)
print("working!")
Trace
New submission from Thomas Grainger :
demo program:
import asyncio
import socket
import threading
async def amain():
family = socket.AddressFamily.AF_INET
sock = socket.socket(family, socket.SOCK_STREAM)
sock.settimeout(1)
sock.bind(('localhost', 0))
sock.listen(
Thomas Grainger added the comment:
> Would you like me to submit a PR for this simple patch?
>
> https://github.com/jdevries3133/cpython/commit/42d9bd7f97f03b49d4fc89780616704998492ac1
TLS_PROTOCOL_CLIENT and TLS_PROTOCOL_SERVER are defined in terms of the
deprecated TLS_PROTOCO
Thomas Grainger added the comment:
there should still be a deprecation warning so that 3.12 can raise
AttributeError
--
___
Python tracker
<https://bugs.python.org/issue44
Thomas Grainger added the comment:
it looks like OP_NO_SSLv2 and OP_NO_SSLv3 are not raising a DeprecationWarning
```
python310 -W error
Python 3.10.0b2 (default, Jun 2 2021, 00:22:18) [GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license&qu
Thomas Grainger added the comment:
It's also confusing that other not deprecated flags are described in terms of
this deprecated flag. These will need rewriting when the deprecated flag is
removed
--
___
Python tracker
<https://bugs.py
New submission from Thomas Grainger :
> I can see in the 3.10 release notes, that ssl.PROTOCOL_TLS becomes
> deprecated. Is there any further context explaining why, and what the
> preferred usage is instead, so that I (and anyone else) can understand this a
> bit more thorou
Thomas Grainger added the comment:
the "ssl module:" part of the warning message, I think, is redundant as it
should be defined in the
https://docs.python.org/3/library/warnings.html#warnings.warn_explicit module
kwarg
--
___
Pyth
New submission from Thomas Grainger :
The ssl module OP_NO_* deprecation warning message is slightly wrong: The error
message prints out "is deprecated is deprecated" because of an earlier format
template
There's a colon in the warning message `ssl module:` and that makes i
Thomas Grainger added the comment:
"""High-level support for working with threads in asyncio"""
import functools
import contextvars
from . import events
from . import tasks
__all__ = "to_thread", "from_thread"
class _Local(threading
New submission from Thomas Grainger :
create a asyncio.from_thread shortcut to run async functions from a thread
started with asyncio.to_thread
```
def from_thread(async_func, /, *args, **kwargs):
"""Synchronously run function *async_func* in the event loop thread.
Thomas Grainger added the comment:
I can confirm this happens on py3.5-3.10
```
import mmap
import pathlib
import tempfile
def main():
with tempfile.TemporaryDirectory() as tmp:
tmp_path = pathlib.Path(tmp)
path = tmp_path / "eg"
path.write_bytes(b&qu
Change by Thomas Grainger :
--
nosy: +graingert
___
Python tracker
<https://bugs.python.org/issue43216>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Thomas Grainger :
--
nosy: +alex.gronholm, graingert
___
Python tracker
<https://bugs.python.org/issue37771>
___
___
Python-bugs-list mailing list
Unsub
Change by Thomas Grainger :
--
pull_requests: +21438
pull_request: https://github.com/python/cpython/pull/22398
___
Python tracker
<https://bugs.python.org/issue41
Thomas Grainger added the comment:
nice the tests pass with that fix
--
___
Python tracker
<https://bugs.python.org/issue41602>
___
___
Python-bugs-list mailin
Thomas Grainger added the comment:
I pushed that patch
--
versions: -Python 3.10
___
Python tracker
<https://bugs.python.org/issue41602>
___
___
Python-bug
Thomas Grainger added the comment:
I'm assuming _Py_UnhandledKeyboardInterrupt is getting incorrectly cleared
somewhere in here
https://github.com/python/cpython/blob/fc23a9483ef0d7c98bea9f82392377d0b6ef7b18/Modules/main.c#L291-L300
Py_DECREF(runpy);
Py_DECREF(runm
Thomas Grainger added the comment:
> Okay, I got it. Now my next question. What do you mean by "I've eliminated
> runpy" and various other remarks along those lines?
I can use `runpy._run_module_as_main` from another Python entry, eg -c and get
the correct `-2`
>>
Thomas Grainger added the comment:
The return code of python on linux when the program is ended with a
KeyboardInterrupt should be -2, this works in most cases - except when called
via "python -m"
Does this repl help?
Python 3.8.2 (default, Jul 16 2020, 14:00:26)
[GCC 9.3.0
Thomas Grainger added the comment:
adding `__main__` owners to nosy
--
nosy: +gvanrossum
___
Python tracker
<https://bugs.python.org/issue41602>
___
___
Pytho
Change by Thomas Grainger :
--
keywords: +patch
pull_requests: +21129
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/22029
___
Python tracker
<https://bugs.python.org/issu
New submission from Thomas Grainger :
https://docs.python.org/dev/library/asyncio-sync.html#asyncio.Event links to
https://docs.python.org/dev/library/asyncio-task.html#asyncio.wait instead of
https://docs.python.org/dev/library/asyncio-sync.html#asyncio.Event.wait
--
assignee: docs
Change by Thomas Grainger :
--
keywords: +patch
pull_requests: +21072
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/21962
___
Python tracker
<https://bugs.python.org/issu
Change by Thomas Grainger :
--
title: make shutil.make_archive always accepts pathlib objects -> make
shutil.make_archive always accept pathlib objects
___
Python tracker
<https://bugs.python.org/issu
New submission from Thomas Grainger :
>>> shutil.make_archive(pathlib.Path("./foo"), root_dir=pathlib.Path("./foo"),
>>> format="zip")
'/home/graingert/projects/ham/foo.zip'
>>> shutil.make_archive(pathlib.Path("./foo&q
1 - 100 of 141 matches
Mail list logo