Change by Ken Jin :
--
nosy: +kj
___
Python tracker
<https://bugs.python.org/issue43463>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.pyth
Ken Jin added the comment:
@eric.smith, here's a summarized version. I hope it helps:
def foo(x: str) -> str: ...
In Python 3.7 - 3.9 with from __future__ import annotations, inspect.signature
sees foo's parameter as:
Without the future import (and also in Python 3.10):
The rea
Ken Jin added the comment:
Hmm I noticed this occurs in Python 3.9 but not 3.10. If you insert ``from
__future__ import annotations`` at the start of your code, it stops erroring.
Anyways, I don't think this is dataclass specific, the following code using a
plain class also errors
Change by Ken Jin :
--
pull_requests: +23323
pull_request: https://github.com/python/cpython/pull/24536
___
Python tracker
<https://bugs.python.org/issue42
Ken Jin added the comment:
Hi Guido, after a month of observing how people stumbled over the related
collections.abc.Callable bugs, and experience from implementing this PEP, I
learnt a few things which I think may interest you:
Previously it was *recommended* that everything in typing
Ken Jin added the comment:
Thanks for merging this Ethan! I think we can close this now (unless you want
me to backport this to 3.9 and 3.8 as well).
--
___
Python tracker
<https://bugs.python.org/issue8
Ken Jin added the comment:
I think we can close this now. Thanks for reporting it Dominic, and thanks
Guido for all your help!
--
___
Python tracker
<https://bugs.python.org/issue41
Change by Ken Jin :
--
pull_requests: +23285
pull_request: https://github.com/python/cpython/pull/24495
___
Python tracker
<https://bugs.python.org/issue41
Change by Ken Jin :
--
pull_requests: +23284
pull_request: https://github.com/python/cpython/pull/24494
___
Python tracker
<https://bugs.python.org/issue41
Change by Ken Jin :
--
pull_requests: +23283
pull_request: https://github.com/python/cpython/pull/24493
___
Python tracker
<https://bugs.python.org/issue41
Ken Jin added the comment:
Hi Daniel, wow thanks for the offer! My GitHub username is Fidget-Spinner.
I'm not sure about the grammar file either.
Oh, thanks for mentioning the tutorial recommendation by the SC, I'll keep that
in mind
Ken Jin added the comment:
Guido and Brandt, may I take a stab at the docs for this? I'll probably base
most of it off PEP 636's tutorial.
Relevant parts of the docs that I've identified:
reference/lexical_analysis.rst
reference/compound_stmts.rst
reference/grammar.rst
# this probably needs
Change by Ken Jin :
--
nosy: +kj
nosy_count: 2.0 -> 3.0
pull_requests: +23250
pull_request: https://github.com/python/cpython/pull/24440
___
Python tracker
<https://bugs.python.org/issu
Ken Jin added the comment:
Thanks for the minimal reproducer. I've tested it on 3.9.0 and 3.10a4 and they
seem to exhibit the same behavior too.
Out of genuine curiosity (I don't mean to question if this *is* a bug, it seems
like a trap for users): why not place an ``await asyncio.sleep(0
Ken Jin added the comment:
@Serhiy,
While this approach solves the getfile problem, I don't think this will solve
the other problem of pydoc leaking secrets stored in python files:
Quoting from Marc-Andre Lemburg's message:
> the tool also makes available all Python modules which
Ken Jin added the comment:
Dear all, now that Adam has signed the CLA, I have closed my PR in favor of
Adam's because I think 2 open PRs might split everyone's attention. Instead,
I'll focus on reviewing Adam's PR. Sorry for any inconvenience caused
Ken Jin added the comment:
I updated the PR to take in a sequence of separators from the user - eg:
>>> urllib.parse.parse_qsl('a=1=2;c=3', separators=('&', ';'))
[('a', '1'), ('b', '2'), ('c', '3')]
>>> urllib.parse.parse_qsl('a=1=2;c=3', separators=('&',))
[('a'
Ken Jin added the comment:
For anyone interested, I went to do some digging on the 3 issues Zac listed:
1. Similar to the first message, this is caused by inspect.getfullarg/signature
using get_type_hints in Py 3.10. get_type_hints internally converts None to
NoneType.
2. I don't know
Ken Jin added the comment:
@Adam:
>I haven't noticed, I'm sorry. I don't mind closing mine, just thought it could
>be a nice first contribution.
No worries :), please don't close yours.
> Our PRs are different though - I feel like if we are to implement this, we
>
Ken Jin added the comment:
> This is correct for typing.get_type_hints(), but *not* for
> inspect.signature(). I therefore suspect that this is an accidental
> side-effect from support for PEP-563 deferred evaluation of annotations.
Spot on about PEP 563 becoming the defa
Ken Jin added the comment:
This seems to be a duplicate of Issue40494. It has already been fixed in Python
3.10, and in Python 3.9.2 (which isn't out yet). You can see the what's new for
it here
https://docs.python.org/3/whatsnew/3.9.html#notable-changes-in-python-3-9-2.
The expected
Ken Jin added the comment:
I have updated the PR to do the following:
- removed html_getfile
- implement a unique secret as suggested above
Now it says:
>>> python.exe -m pydoc -b
Server ready at
http://localh
Ken Jin added the comment:
Adam, I linked a PR 2 days ago here
https://github.com/python/cpython/pull/24271 , it has the test suite passing
and the appropriate changes to cgi.py. Would you like to review it? Or since
you submitted a PR, would you prefer I close mine instead
Ken Jin added the comment:
I created a PR to remove the getfile function - now it just places the
hyperlinked file path there but clicking on it won't render the file contents.
Personally I agree with Marc-Andre Lemburg's comments on how _url_handler
probably has other vulnerabilities
Change by Ken Jin :
--
keywords: +patch
nosy: +kj
nosy_count: 4.0 -> 5.0
pull_requests: +23104
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/24285
___
Python tracker
<https://bugs.python.org/i
Ken Jin added the comment:
FWIW, a surprising amount of things rely on treating ';' as a valid separator
in the standard test suite.
>From just a cursory look:
test_cgi
test_urlparse
A change in the public API of urlparse will also require a change in cgi.py's
FieldStor
Change by Ken Jin :
--
keywords: +patch
nosy: +kj
nosy_count: 4.0 -> 5.0
pull_requests: +23094
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/24271
___
Python tracker
<https://bugs.python.org/i
Change by Ken Jin :
--
nosy: +kj
nosy_count: 5.0 -> 6.0
pull_requests: +23078
pull_request: https://github.com/python/cpython/pull/24256
___
Python tracker
<https://bugs.python.org/issu
Ken Jin added the comment:
Hello, this issue is a byproduct of issue42195. It has already been fixed on
Python 3.10, and on Python 3.9.2 (which isn't out yet). You can see the what's
new for it here
https://docs.python.org/3/whatsnew/3.9.html#notable-changes-in-python-3-9-2.
The expected
Ken Jin added the comment:
Sorry, I don't think this is a typing module issue.
The NameError stems from what you mentioned: 'A' not being defined since
TYPE_CHECKING evaluates to false at runtime. This would raise an error in any
Python code, not just typing. The equivalent
Change by Ken Jin :
--
keywords: +patch
nosy: +kj
nosy_count: 2.0 -> 3.0
pull_requests: +23048
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/24224
___
Python tracker
<https://bugs.python.org/i
Change by Ken Jin :
--
keywords: +patch
pull_requests: +23026
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/24201
___
Python tracker
<https://bugs.python.org/issu
Ken Jin added the comment:
> Fidget-Spinner, are you interested in taking this?
Sure thing! Please give me some time to look at it - I don't really use the
runtime type validation stuff from typing (I usually defer that to 3rd party
libraries), so I need to familiarize myself fi
Change by Ken Jin :
--
nosy: +kj
nosy_count: 5.0 -> 6.0
pull_requests: +22981
stage: backport needed -> patch review
pull_request: https://github.com/python/cpython/pull/24153
___
Python tracker
<https://bugs.python.org/i
Change by Ken Jin :
--
keywords: +patch
pull_requests: +22952
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/24121
___
Python tracker
<https://bugs.python.org/issu
New submission from Ken Jin :
_json currently uses a few static locals for caching of PyUnicode and one
Exception object. This patch aims to move them to the heap.
Apologies if this isn't the right way to track subinterpreter issues, I took a
look at issue36876 but it seemed like a meta
Change by Ken Jin :
--
pull_requests: +22893
pull_request: https://github.com/python/cpython/pull/24059
___
Python tracker
<https://bugs.python.org/issue42
Change by Ken Jin :
--
pull_requests: +22890
pull_request: https://github.com/python/cpython/pull/24056
___
Python tracker
<https://bugs.python.org/issue41
Ken Jin added the comment:
I have just one more PR - one that converts genericalias nested lists to
tuples by default. It'll simplify the code a little bit and prepare 3.9.x
for PEP 612.
--
___
Python tracker
<https://bugs.python.org/issue41
Ken Jin added the comment:
You're welcome, and yes you're right! You can read the news item for it here
https://docs.python.org/3/whatsnew/3.9.html#notable-changes-in-python-3-9-2.
The expected release date for Python 3.9.2 is Monday, 2021-02-15 according to
PEP 596 https://www.python.org
Ken Jin added the comment:
This was addressed in issue42195 and issue40494 as you pointed out :). It has
been fixed in Python 3.10. Unfortunately the backport didn't make it in time
for Python 3.9.1, and will come in Python 3.9.2 instead. Sadly there's not much
to do about that.
On 3.10
Change by Ken Jin :
--
pull_requests: +22842
pull_request: https://github.com/python/cpython/pull/24000
___
Python tracker
<https://bugs.python.org/issue41
Change by Ken Jin :
--
pull_requests: +22808
pull_request: https://github.com/python/cpython/pull/23963
___
Python tracker
<https://bugs.python.org/issue42
Change by Ken Jin :
--
keywords: +patch
pull_requests: +22794
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/23943
___
Python tracker
<https://bugs.python.org/issu
New submission from Ken Jin :
On the 3.10 branch, the what's new document for 3.9 isn't synced with the one
on the 3.9 branch.
Currently it's missing two entries:
macOS 11.0 (Big Sur) and Apple Silicon Mac support
issue41100
(next one's my fault, sorry)
collections.abc.Callable changes
Change by Ken Jin :
--
keywords: +patch
pull_requests: +22793
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/23942
___
Python tracker
<https://bugs.python.org/issu
New submission from Ken Jin :
Currently get_args doesn't work for PEP 604 Union:
>>> get_args(int | str)
or new Callables with PEP 612:
>>> P = ParamSpec('P)
>>> get_args(Callable[P, int])
([~P], )
get_origin doesn't work with PEP 604 Unions:
>>> get
Ken Jin added the comment:
Now that issue42195 has been resolved by subclassing types.GenericAlias, can
this be closed?
On 3.9 and 3.10:
>>> import typing, collections.abc
>>> T = typing.TypeVar('T')
>>> C2 = collections.abc.Callable[[T], T]
>>> C2[int]
Ken Jin added the comment:
Oops, you're right! Sorry, I'll close this issue. Anyways I realized I had the
wrong hunch - I was looking at a different part of the logs.
--
resolution: -> duplicate
stage: -> resolved
status: open -&g
New submission from Ken Jin :
Dear core developers, I noticed that for many recent commits, the s390x Fedora
LTO + PGO 3.x buildbot often fails. Here's an error log::
gcc -pthread -fno-semantic-interposition -flto -fuse-linker-plugin
-ffat-lto-objects -flto-partition=none -g -Xlinker
Ken Jin added the comment:
Thanks for the extremely helpful reviews and help in this Guido!
Sure, I'll probably start work on that next week, slightly busy with life right
now. After that I'll work on docs.
--
___
Python tracker
<ht
Change by Ken Jin :
--
pull_requests: +22766
pull_request: https://github.com/python/cpython/pull/23915
___
Python tracker
<https://bugs.python.org/issue42
Ken Jin added the comment:
Sorry for intruding, but I thought I'd offer some rudimentary, non-scientific
benchmarks for this:
[MSC v.1928 32 bit (Intel)] on win32 # a debug build of python, no compiler
optimizations
import timeit
# gen comp
timeit.timeit("''.join(str(_) for _ in
Change by Ken Jin :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Ken Jin :
--
pull_requests: +22717
pull_request: https://github.com/python/cpython/pull/23852
___
Python tracker
<https://bugs.python.org/issue42
Change by Ken Jin :
--
pull_requests: +22716
pull_request: https://github.com/python/cpython/pull/23852
___
Python tracker
<https://bugs.python.org/issue42
Change by Ken Jin :
--
pull_requests: +22702
pull_request: https://github.com/python/cpython/pull/23839
___
Python tracker
<https://bugs.python.org/issue42
Change by Ken Jin :
--
pull_requests: -22699
___
Python tracker
<https://bugs.python.org/issue42195>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Ken Jin :
--
pull_requests: +22699
pull_request: https://github.com/python/cpython/pull/23839
___
Python tracker
<https://bugs.python.org/issue42
Change by Ken Jin :
--
keywords: +patch
pull_requests: +22698
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/23839
___
Python tracker
<https://bugs.python.org/issu
New submission from Ken Jin :
A whatsnew is probably needed as this change causes backwards incompatibility
in some code working with Python 3.9.0 and 3.9.1. I think the patch for Python
3.9.2 should mention that a DeprecationWarning is emitted for some invalid use
cases, which
Change by Ken Jin :
--
pull_requests: +22621
pull_request: https://github.com/python/cpython/pull/23765
___
Python tracker
<https://bugs.python.org/issue42
Ken Jin added the comment:
The pyre version in their __init__.py looks like they took your advice for
letting the static checker do the work wholeheartedly.
I'm not in favour of type checking either. Just that the pre-existing code
does it for me.
Not type checking when seeing ~P
Ken Jin added the comment:
> and was surprised that C.__parameters__ was (T,) instead of (T, P).
Alright, I just fixed that :).
I'm now encountering many problems with how typing works which prevent what PEP
612 declare as valid from not throwing an error (these are all examples copied
f
Ken Jin added the comment:
I have a one question:
Should ParamSpec be treated as a type of TypeVar? This mostly pertains to
adding it to __parameters__ of generic aliases. Type substitution/chaining,
seems inappropiate for it right now.
Thanks for your help
Change by Ken Jin :
--
keywords: +patch
nosy: +kj
nosy_count: 1.0 -> 2.0
pull_requests: +22569
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/23702
___
Python tracker
<https://bugs.python.org/i
Change by Ken Jin :
--
pull_requests: +22530
pull_request: https://github.com/python/cpython/pull/23663
___
Python tracker
<https://bugs.python.org/issue42
Ken Jin added the comment:
Thanks for taking the time to review this! I forgot to specify this only
affects debug builds in the news entry. I'm opening a PR to edit that because
I don't want people to mistake it for an actual interpreter-crashing bug in the
release build (that would
Change by Ken Jin :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Ken Jin :
--
keywords: +patch
pull_requests: +22524
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/23656
___
Python tracker
<https://bugs.python.org/issu
New submission from Ken Jin :
I noticed that passing keyword arguments to types.GenericAlias's __new__ causes
the interpreter to hard crash and exit due to an assertion failure:
import types
types.GenericAlias(bad=float)
Result:
Assertion failed: PyTuple_CheckExact(kwnames), file
Ken Jin added the comment:
FWIW, current code for extracting args type and return type from Callable seems
to be something like this (at least from the typing module):
arg_types = __args__[:-1]
return_type = __args__[-1]
Once ParamSpec is added in, library authors would need to check
Change by Ken Jin :
--
nosy: +kj
nosy_count: 4.0 -> 5.0
pull_requests: +22400
pull_request: https://github.com/python/cpython/pull/23513
___
Python tracker
<https://bugs.python.org/iss
Ken Jin added the comment:
A possible workaround for _PosArgs in collections.abc without depending on
typing could be like this:
_PosArgs = type('_PosArgs', (tuple, ), {})
This would help out the future type proposals too, because GenericAlias accepts
non-type args.
__args__ of Callable
Ken Jin added the comment:
@guido,
Aesthetics-wise, I agree that ((int, int), str) looks by far the best. My gripe
with it lies with the implementation - almost every function in typing
currently assumes that every object in __args__ is a type, having (int, int) -
the tuple object
Ken Jin added the comment:
I tried to implement Callable[[int, int], str] as ((int, int), str). However,
it breaks much of typing's tests and requires recursion to account for the
nested tuples, in both typing, and in the C implementation of GenericAlias.
I'd like to humbly propose a less
Change by Ken Jin :
--
pull_requests: +22279
pull_request: https://github.com/python/cpython/pull/23386
___
Python tracker
<https://bugs.python.org/issue42
Change by Ken Jin :
--
pull_requests: +22278
pull_request: https://github.com/python/cpython/pull/23385
___
Python tracker
<https://bugs.python.org/issue42
Change by Ken Jin :
--
pull_requests: +22200
pull_request: https://github.com/python/cpython/pull/23309
___
Python tracker
<https://bugs.python.org/issue42
Ken Jin added the comment:
@Guido and @Ivan,
Should Literals de-duplicate values in its __args__ similar to Union? PEP 586
states that:
> Literal[v1, v2, v3] is equivalent to Union[Literal[v1], Literal[v2],
> Literal[v3]]
Naturally, a Union de-duplicates values, so I was won
Ken Jin added the comment:
This is a duplicate of issue bpo-41979, which was already fixed in this merged
PR https://github.com/python/cpython/pull/22611 and backported to 3.9.
The example code does not error on the latest 3.10. I'm guessing that the
bugfix will come in 3.9.1 since the fix
Ken Jin added the comment:
Dominik, would you like to submit a PR for this :) ?
--
___
Python tracker
<https://bugs.python.org/issue42317>
___
___
Python-bug
Change by Ken Jin :
--
keywords: +patch
nosy: +kj
nosy_count: 2.0 -> 3.0
pull_requests: +22147
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/23250
___
Python tracker
<https://bugs.python.org/i
Ken Jin added the comment:
Danil, thanks for finding the cause behind this. Could you check if the new
behavior in Python 3.8 and higher has the same problem on your machine (without
your fix)? multiprocessing on MacOS started using spawn in 3.8, and I was
wondering if it that fixed
Ken Jin added the comment:
You're right, currently this happens for 2 reasons:
1. _SpecialGenericAlias (used by List), caches its __getitem__. (As you already
pointed out :) )
2. _UnionGenericAlias (Union)'s __hash__ is `hash(frozenset(self.__args__))`.
i.e. Unions with different args
Change by Ken Jin :
--
nosy: +kj
nosy_count: 5.0 -> 6.0
pull_requests: +22130
pull_request: https://github.com/python/cpython/pull/23227
___
Python tracker
<https://bugs.python.org/issu
Change by Ken Jin :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Ken Jin added the comment:
Dear Jack, good catch! My only worry is that if we make the list exhaustive,
it would be too lengthy, or that it might not be feasible to continuously
update it every time a new generic type supports the feature.
Maybe a line somewhere to mention that most
Ken Jin added the comment:
Sorry to butt into this conversation, but I wanted to add that I have interest
in this feature - deques are the fourth most common container types I use in
Python. Is there any way I can help to get this PR across the finish line?
So far I've forked the PR
Change by Ken Jin :
--
nosy: +kj
nosy_count: 5.0 -> 6.0
pull_requests: +22076
pull_request: https://github.com/python/cpython/pull/23164
___
Python tracker
<https://bugs.python.org/issu
Ken Jin added the comment:
Hmm apologies I'm stumped then. The only things I managed to surmise from
xgboost's and scikit-learn's GitHub issues is that this is a recurring issue
specifically when using GridSearchCV :
Threads with discussions on workarounds:
https://github.com/scikit-learn
Ken Jin added the comment:
Hello, it would be great if you can you provide more details. Like your
Operating System and version, how many logical CPU cores there are on your
machine, and lastly the exact Python version with major and minor versions
included (eg. Python 3.8.2
Ken Jin added the comment:
Dear Guido, from what I can see in the typing module, _CallableType already
casts the args list to a tuple before creating the __CallableGenericAlias, so
it should support cacheing. This is taken from the from _CallableType::
def __getitem__(self, params
Change by Ken Jin :
--
pull_requests: +21999
pull_request: https://github.com/python/cpython/pull/23081
___
Python tracker
<https://bugs.python.org/issue42
Ken Jin added the comment:
@Serhiy, wow interesting find, it seems to be typing's repr problem rather than
the actual types itself:
>>> typing.Union[dict[int, str], list[str]]
typing.Union[dict, list]
>>> typing.Union[dict[int, str], list[str]].__args__
(dict[i
Change by Ken Jin :
--
keywords: +patch
pull_requests: +21997
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/23077
___
Python tracker
<https://bugs.python.org/issu
New submission from Ken Jin :
Union type expressions added in PEP 604 throw an error when both operands are
GenericAlias objects.
Eg the following works::
int | list[str]
The following throws TypeError::
list[int] | dict[float, str]
Traceback (most recent call last):
File "&quo
Ken Jin added the comment:
IMO, this can now be closed.
Most code examples in typing were changed to builtin generics:
https://github.com/python/cpython/commit/d9ab95ff1fe81efdf70e545d536d9f6927d1ba81
https://github.com/python/cpython/commit/7f54e563dc150cd670ca8df678437455c3a7f2cd
Docs
Change by Ken Jin :
--
pull_requests: +21982
pull_request: https://github.com/python/cpython/pull/23063
___
Python tracker
<https://bugs.python.org/issue42
Ken Jin added the comment:
Guido, I have one last one -- "2. Park GenericAlias and Union under a new
section 'Type Annotation Types' in stdtypes for 3.10". After which I'll close
this issue.
Thanks for reviewing my PRs so quickly!
--
401 - 500 of 530 matches
Mail list logo