Change by Ken Jin :
--
pull_requests: +26305
pull_request: https://github.com/python/cpython/pull/27841
___
Python tracker
<https://bugs.python.org/issue44
Ken Jin added the comment:
Sure. Sebastian has created a really thorough PR at GH-27833 and I like it
(with only one point for discussion).
--
___
Python tracker
<https://bugs.python.org/issue44
Ken Jin added the comment:
I just realised I'm slightly wrong about identity checks -- there is a very
very small chance where if the type object occupies the same address and the
attribute is in a dynamically allocated __dict__ (and not some static slot), we
can trick the checks
Ken Jin added the comment:
@finnjavier08 sorry, I'd misinterpreted your original message. Thanks for
clarifying your intent!
> I'd be happy to do the implementation and pull request once approval is given
> and a module is decided on.
I can't comment because I'm not an
Ken Jin added the comment:
> Ken Jin, can you guide Maximilian towards a successful doc update PR?
It seems that Maximilian has already made some contributions to CPython, so I'm
sure he's somewhat familiar with our workflow :). Nonetheless, @Maximilian if
you need any help, please do p
Change by Ken Jin :
--
nosy: +kj
___
Python tracker
<https://bugs.python.org/issue44937>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.pyth
Change by Ken Jin :
--
nosy: +rhettinger, stutzbach
title: Add check_methods function to standard library -> Add check_methods
function to collections.abc in standard library
versions: +Python 3.11
___
Python tracker
<https://bugs.pyth
Ken Jin added the comment:
Yep! You can choose to add a new section under "Other concrete types", maybe
"typing.io and typing.re submodules" then talk about how we could import from
them in the past, but they're now deprecated and going to be removed.
Alternati
Ken Jin added the comment:
Some improvements can be made (see
https://github.com/python/cpython/pull/27722#issuecomment-900369714), but for
the most part we're done.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -&g
Ken Jin added the comment:
Thank you for the examples Serhiy. I agree.
--
resolution: -> wont fix
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Ken Jin added the comment:
@Pablo yup the 3.10 opcache used tp_version_tag. But it also does identity
(pointer) comparison of type/class object
https://github.com/python/cpython/blob/3.10/Python/ceval.c#L3432. Which is why
it doesn't fail.
I created this issue because we don't do type
Ken Jin added the comment:
Thanks Mark and Victor for the patch and reviews!
This issue also affects 3.10, but IMO we don't need to backport this as we
don't have other code relying on this invariant in that version, so it won't
affect anything there. If you feel otherwise, please let me
Ken Jin added the comment:
@Paul, Steve, Tim and Zach, I've removed y'all from nosy as this isn't a
Windows issue (but a typing/builtin types one). If you feel that I shouldn't
have done that: my apologies and please do tell me.
To summarize what OP said:
>>> isinstance(bool, (b
Ken Jin added the comment:
> 1. func1 doesn't crash, but also doesn't resolve the forward reference. I am
> not sure if this expected behavior.
Good observation! That's indeed the current behavior. The reason is a little
subtle - list[...] is using a special builtin type
Ken Jin added the comment:
@rittneje, would you like to submit a PR for this? We can help if you'd like to.
--
___
Python tracker
<https://bugs.python.org/issue44
Change by Ken Jin :
--
assignee: -> docs@python
components: +Documentation -Library (Lib)
keywords: +easy, newcomer friendly
nosy: +docs@python, gvanrossum, kj, srittau
title: Confusing deprecation notice for typing.IO -> [docs] Confusing
deprecation notice for typing.IO
ve
Change by Ken Jin :
--
pull_requests: +26251
pull_request: https://github.com/python/cpython/pull/27774
___
Python tracker
<https://bugs.python.org/issue44
Ken Jin added the comment:
@Mark, agreed about properly defining the semantics.
For the current bug: I've narrowed it down to a corner case in how the -R tests
work:
1. On each run cleanup, libregrtest will clear the type cache
https://github.com/python/cpython/blob
New submission from Ken Jin :
tp_version_tag is supposed to be unique for different class objects. Under
normal circumstances, everything works properly:
def good():
class C:
def __init__(self): # Just to force `tp_version_tag` to update
pass
cls_id = hex(id(C
Change by Ken Jin :
--
keywords: +patch
pull_requests: +26207
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/27722
___
Python tracker
<https://bugs.python.org/issu
New submission from Ken Jin :
Possible specializations:
- LOAD_METHOD_CACHED
Cache the method. We only need to check that type(o) and o.__dict__ was not
modified.
- LOAD_METHOD_CLASS
For classmethods. Less speedup expected.
- LOAD_METHOD_MODULE
For module methods. Uncommon (<10%).
Ple
Ken Jin added the comment:
@Serhiy a summary from what I understand. I hope this helps:
> I am confused. Why do these objects should have __name__ and __qualname__
> attributes? What document specifies this?
I don't think any doc specifies this. The docs for __name__ and __qualname_
Ken Jin added the comment:
@Bas van Beek, thanks for testing numpy on 3.10rc1 and sending that link over.
I was confused about what your original question entailed. The link provided
much more context :). Seems that __name__ = None unintentionally breaks things
that use annotations
Ken Jin added the comment:
> This PRs herein have created a situation wherein the
> `__name__`/`__qualname__` attributes of certain typing objects can be `None`.
> Is this behavior intentional?
The affected objects are special forms which can hold types, so Union[],
Ken Jin added the comment:
> Just chiming in to say that this is still broken for me on Python 3.9.6
>From what I understand, the patch landed on 2021-07-02, 4 days after Python
>3.9.6's release date of 2021-06-28, so it wasn't included.
It should come in 3.9.7, which should be ou
Change by Ken Jin :
--
keywords: +patch
pull_requests: +26061
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/27555
___
Python tracker
<https://bugs.python.org/issu
New submission from Ken Jin :
I can't seem to find PyMember_GetOne or PyMember_SetOne in C API docs, yet they
are in stable_abi.txt.
Sending a PR shortly, please tell me if these were accidentally exposed and not
supposed to be documented (I will close the PR if so).
--
assignee
Ken Jin added the comment:
Agree with Yurii. This is no longer an issue in 3.10 onwards. Thanks to Yurii
for providing the fix in the other issue.
--
nosy: +kj
resolution: -> fixed
stage: -> resolved
status: open -> closed
___
Pytho
Ken Jin added the comment:
> Type expression is coerced to a list of parameter arguments in substitution
> of ParamSpec.
It's not, only the repr is like that. Internally it's not coerced.
>>> C[int, str]
typing.Callable[[int], str]
>>> C[int, str].__args__
(, )
Be
Ken Jin added the comment:
Should Concatenate support substitution to begin with? PEP 612 doesn't say
anything, and I am fairly certain it's a special typing form, not a generic. So
I don't really understand what it means to substitute Concatenate.
Then again, Callable with a nested
Ken Jin added the comment:
@Serhiy, could you please briefly describe what you are planning? I'm guessing
you're generalizing for _TypeVarLike?
My main concern is that we should have as few differences between builtin and
typing types as possible. typing.List is deprecated and set to remove
Change by Ken Jin :
--
title: Reduce usage of sys._getframe at typing module -> Refactor usage of
sys._getframe at typing module
___
Python tracker
<https://bugs.python.org/issu
Ken Jin added the comment:
I think we can close this. The current docs show the version added for the
items in OP's list https://docs.python.org/3.11/library/enum.html.
Their versionadded should be 3.11 now, but that's a separate issue with a PR at
GH-27388.
--
nosy: +kj
Ken Jin added the comment:
This is fixed. Thanks Yurii and Serhiy for the patches :) (and everyone else
for the reviews too).
--
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/i
Change by Ken Jin :
--
nosy: +kj
nosy_count: 5.0 -> 6.0
pull_requests: +25878
pull_request: https://github.com/python/cpython/pull/27335
___
Python tracker
<https://bugs.python.org/issu
Ken Jin added the comment:
Thanks a bunch Yurii, Serhiy, Jelle, Ćukasz and Pablo for working on this! I'm
re-closing this issue. *Fingers-crossed* we won't have to open this again ;-).
--
resolution: -> fixed
status: open -> closed
___
Change by Ken Jin :
--
pull_requests: +25877
pull_request: https://github.com/python/cpython/pull/27334
___
Python tracker
<https://bugs.python.org/issue44
Ken Jin added the comment:
@Pablo, I don't think this change is causing the buildbots to fail. The test
failure on all the currently failing buildbots is:
==
ERROR: test_absolute_circular_submodule
Change by Ken Jin :
--
pull_requests: +25865
pull_request: https://github.com/python/cpython/pull/27319
___
Python tracker
<https://bugs.python.org/issue44
Change by Ken Jin :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Ken Jin added the comment:
> Does that work if you try to union two NewTypes?
Oh woops I was too eager in closing this issue -- it doesn't work. Sorry,
please disregard my previous message. I'm reopening this. Thanks for the
reminder Jelle.
--
resolution: out of date ->
Ken Jin added the comment:
This issue is now out of date on. After Serhiy's refactoring, any function
types can be unioned.
>>> NewType('x', int)
>>> int | NewType('x', int)
int | typing.NewType..new_type
The only problem now is that the repr is weird, but Ser
Ken Jin added the comment:
Nosied over people from issue44490. This issue addresses msg396895:
Thanks to Ruben for the catch. (message copied over):
```
It also lacks the __module__ attribute, causing it to be unusable in PEP 593
typing.Annotated types:
from typing import Annotated
x
Ken Jin added the comment:
Yurii has a working PR for __name__ in _BaseGenericAlias, but not for
_SpecialForm yet.
Guido and/or Lukasz, do y'all think we should support __name__ and __qualname__
for special forms too? Personally I don't see how it'd hurt and I'm +1
Ken Jin added the comment:
@Serhiy, this doesn't just affect typing.Union, it seems that the rest of the
typing types don't substitute:
>>> (int | T)[typing.List[str]]
Traceback (most recent call last):
File "", line 1, in
TypeError: Each union arg must be a type, got t
Change by Ken Jin :
--
pull_requests: +25763
pull_request: https://github.com/python/cpython/pull/27222
___
Python tracker
<https://bugs.python.org/issue44
Change by Ken Jin :
--
pull_requests: -25752
___
Python tracker
<https://bugs.python.org/issue44490>
___
___
Python-bugs-list mailing list
Unsubscribe:
Ken Jin added the comment:
Thank you for everything you've done over the years for typing and its
ecosystem Ivan. Take care, and please don't hesitate to add yourself back in
the future if you feel like it.
--
___
Python tracker
<ht
Change by Ken Jin :
--
nosy: +kj
nosy_count: 10.0 -> 11.0
pull_requests: +25749
pull_request: https://github.com/python/cpython/pull/27211
___
Python tracker
<https://bugs.python.org/issu
Change by Ken Jin :
--
pull_requests: +25739
pull_request: https://github.com/python/cpython/pull/27205
___
Python tracker
<https://bugs.python.org/issue41
Ken Jin added the comment:
The list for GH reviews is the CODEOWNERS file at
https://github.com/python/cpython/blob/main/.github/CODEOWNERS
The list for grouping bpo users is the experts index (I hope) at
https://devguide.python.org/experts/
Let's wait a bit to hear what Ivan wants. I
Ken Jin added the comment:
> How far can/should we backport this?
It will work in 3.10 and 3.9 without issues. However, I don't remember if
bugfixes for __future__ features require special treatment/are excluded from
normal bugfix backports. I vaguely remember us not backporting f
Change by Ken Jin :
--
pull_requests: +25737
pull_request: https://github.com/python/cpython/pull/27203
___
Python tracker
<https://bugs.python.org/issue44
Ken Jin added the comment:
> I am going to backport these changes to 3.10 to make backporting of future
> fixes easier.
> * Move declarations of _Py_make_parameters and _Py_subs_parameters ...
Unfortunately, _Py_make_parameters and _Py_subs_parameters are 3.11 only. They
were part
Change by Ken Jin :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Ken Jin added the comment:
@Serhiy
> 1. Make NewType a class and add more strict test.
See also: issue44353 (https://bugs.python.org/issue44353). We had some
discussion there about converting to class but it ended in a deadlock.
--
___
Pyt
Change by Ken Jin :
--
pull_requests: +25683
pull_request: https://github.com/python/cpython/pull/27141
___
Python tracker
<https://bugs.python.org/issue44
Ken Jin added the comment:
Oh this is a fun one :).
> The code for recognizing TypeVars must be wrong. Is it also wrong in e.g.
> list[T]?
list[T] is correct. I was pretty puzzled since I thought their code is nearly
the same, but then I noticed a subtle difference -- GenericAlias
Ken Jin added the comment:
> 3. There is also a crash in isinstance():
That's unfortunate :(.
Serhiy, thanks for catching all these bugs in union. I recently realized you
probably made 50% of all bug reports for union and they're very much
appreciated :).
> Converting None to typ
Ken Jin added the comment:
@Serhiy, can I work on converting None to type(None) please?
--
___
Python tracker
<https://bugs.python.org/issue44606>
___
___
Pytho
Ken Jin added the comment:
@Serhiy
> 2. Different handling of virtual subclasses:
This looks like a bug. I think the union form of isinstance/issubclass should
have the same behavior as the tuple form. We promise checking of virtual
classes in the docs for union types:
ht
Ken Jin added the comment:
@Yurii, I would like to caution against a C accelerator for the typing module.
My reasoning follows:
1. The maintenance burden is higher. typing is already somewhat complex in
Python (lots of MRO/metaclass wizardry). A C module would require knowledge of
the C
Ken Jin added the comment:
@Steve, after this change, the Azure Pipelines commit CI's appx tests started
failing on main and 3.10.
https://dev.azure.com/Python/cpython/_build/results?buildId=83619=results
==
FAIL
Ken Jin added the comment:
Sorry, I don't think this will be fixed as it is intentional.
types.GenericAlias (the type of list[int] or dict[str, str]) does almost 0
checking for two reasons IIUC:
- Types with wrong number of parameters will usually be caught by your IDE/type
checker
Ken Jin added the comment:
> This change seems to emit deprecation warnings in test_pydoc.
test_typing emits them too as it tests importing things from __all__.
--
___
Python tracker
<https://bugs.python.org/issu
Change by Ken Jin :
--
pull_requests: +25587
pull_request: https://github.com/python/cpython/pull/27028
___
Python tracker
<https://bugs.python.org/issue44
Change by Ken Jin :
--
keywords: +patch
pull_requests: +25575
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/27016
___
Python tracker
<https://bugs.python.org/issu
New submission from Ken Jin :
Ref: comment chain at
https://github.com/python/cpython/pull/27008#discussion_r663450441.
setup_ga fails only if PyTuple_Pack fails, which usually happens when Python is
out of memory. The cleanup code for setup_ga shouldn't use PyObject_GC_DEL as
mentioned
Ken Jin added the comment:
Oh I didn't see Pablo's message on the PR:
> @Fidget-Spinner For next occasions, the problem with this is that
> PyObject_GC_Del cannot be called like that because it overrides a bunch of
> cleanups like the call to _Py_ForgetReference and other possible
Ken Jin added the comment:
Woops, thanks for the quick fix Pablo. I'm guessing the takeaway here is
that we should start tracking a GC-ed object as early as possible?
--
___
Python tracker
<https://bugs.python.org/issue44
Ken Jin added the comment:
Thanks for the helpful review and merge Serhiy.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Ken Jin :
--
nosy: +kj
nosy_count: 12.0 -> 13.0
pull_requests: +2
pull_request: https://github.com/python/cpython/pull/26994
___
Python tracker
<https://bugs.python.org/issu
Change by Ken Jin :
--
keywords: +patch
pull_requests: +25554
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/26993
___
Python tracker
<https://bugs.python.org/issu
New submission from Ken Jin :
types.Union objects can contain reference cycles, therefore causing memory
leaks.
E.g.::
```
import sys, gc
from typing import TypeVar
gc.collect()
for _ in range(10):
sys.gettotalrefcount()
T = TypeVar('T')
U = int | list[T]
T.blah = U
del T
del U
Ken Jin added the comment:
Closing this issue since OP(Maciej) has marked it as "not a bug".
--
nosy: +kj
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.py
Ken Jin added the comment:
I don't think we need the types.GenericAlias(int | list[T], str)
workaround. GenericAlias already has code for extracting __parameters__ and
implementing __getitem__. Someone would need to refactor and reuse them for
Union too. That should be enough to trick
Ken Jin added the comment:
Lars, yes you're right that __name__ is documented in datamodel, sorry I wasn't
clear in my original message. What I meant was that specifically for the typing
module, it's not exposed anywhere in its docs
https://docs.python.org/3/library/typing.html.
> If I w
Ken Jin added the comment:
> Is this intentional? It seems a little inconsistent.
The `__name__` attribute is for internal use only. It's subject to change every
release along with other implementation details.
Sorry, I don't really understand what this issue is requesting. Do you w
Ken Jin added the comment:
Yurii, thanks for the offer.
We only need to implement __getitem__ if union supports TypeVars. Which
means __parameters__ need to be implemented too (or at least a private
internal implementation of it).
I interpreted Guido's message above as to wait and see
Change by Ken Jin :
--
keywords: +patch
pull_requests: +25503
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/26934
___
Python tracker
<https://bugs.python.org/issu
New submission from Ken Jin :
CALL_FUNCTION can be specialized. Copying from Mark's comments
https://github.com/faster-cpython/ideas/issues/54#issue-898013125
```
There are a number of specializations of CALL_FUNCTION that make sense:
1. Calls to a Python function where the arguments
Ken Jin added the comment:
Oh, that's a good point too. Thanks for the explanation, reviews and merge
Serhiy.
--
___
Python tracker
<https://bugs.python.org/issue44
Change by Ken Jin :
--
pull_requests: -25430
___
Python tracker
<https://bugs.python.org/issue38323>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Ken Jin :
--
nosy: +kj
nosy_count: 10.0 -> 11.0
pull_requests: +25430
pull_request: https://github.com/python/cpython/pull/26848
___
Python tracker
<https://bugs.python.org/issu
New submission from Ken Jin :
Recently I noticed that the new PEP 604 Union type doesn't collect type
variables:
from typing import TypeVar
T = TypeVar('T')
(int | list[T]).__parameters__
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'types.Union'
Ken Jin added the comment:
@Sebastian,
Woops, thanks for the reminder. I think both options are fine. But I'm leaning
towards creating a new issue. The title of the current issue is "Deprecate the
typing.io and typing.re pseudo-modules" not "Remove the typing.io and ty
Ken Jin added the comment:
A possible simple fix is to change these lines
https://github.com/python/cpython/blob/main/Objects/unionobject.c#L294-L301
to:
```
return (
is_typevar(obj) |
is_new_type(obj) |
is_special_form(obj) |
PyType_Check(obj
Change by Ken Jin :
--
keywords: +patch
nosy: +kj
nosy_count: 1.0 -> 2.0
pull_requests: +25429
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/26848
___
Python tracker
<https://bugs.python.org/i
Ken Jin added the comment:
That specific buildbot is now green. Thanks everyone :)!
https://dev.azure.com/Python/cpython/_build/results?buildId=82931=results
I'm closing the issue now as it seems there isn't anything left to do.
--
resolution: -> fixed
stage: patch rev
Ken Jin added the comment:
> Ken, if you feel like it, a fix should not be too complicated, right?
Yup. Will's proposal is to change the try-except to:
base_globals = getattr(sys.modules.get(base.__module__, None), '__dict__', {})
@Will, would you like to submit a PR for this? You'd n
Ken Jin added the comment:
Closing this for now as it seems PEP 509 may need to be repealed:
https://github.com/faster-cpython/ideas/issues/30#issuecomment-858615678
Sorry for the noise everyone :(.
--
resolution: -> postponed
stage: patch review -> resolved
status: open -&g
Ken Jin added the comment:
Hmm I'm suddenly having second thoughts. I wonder if there's future use cases I
might be missing here from PEP 509?
--
nosy: +vstinner
___
Python tracker
<https://bugs.python.org/issue44
Change by Ken Jin :
--
keywords: +patch
pull_requests: +25414
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/26833
___
Python tracker
<https://bugs.python.org/issu
New submission from Ken Jin :
issue44206, issue44337, and issue44338 converted things dependent on
ma_version_tag to ma_keys->dk_version.
I propose to remove ma_version_tag and save 8 bytes of space in dict. I've
prepared a draft PR to do that. However, I'd like to wait for some time bef
Ken Jin added the comment:
Will, I think what you say makes sense.
@Guido / Ivan / Jelle
What do you think?
--
nosy: +Jelle Zijlstra, gvanrossum, kj, levkivskyi
___
Python tracker
<https://bugs.python.org/issue44
Ken Jin added the comment:
> Overall it looks as if the the Azure pipeline should be fixed, though. It's
> not ideal that the tests pass while running the PR, but not in other
> situations.
I agree. This specific test only seems to run *after* a commit is made. I don't
see a w
Change by Ken Jin :
--
pull_requests: +25393
pull_request: https://github.com/python/cpython/pull/26811
___
Python tracker
<https://bugs.python.org/issue38
Ken Jin added the comment:
Hello Sebastian, the tests are failing on the Azure pipelines buildbot running
appx tests:
https://dev.azure.com/Python/cpython/_build/results?buildId=82827=logs=0fcf9c9b-89fc-526f-8708-363e467e119e=fa5ef4ee-3911-591e--19482ab189b7
I suspect it's the same
Ken Jin added the comment:
@irit, you may be interested in issue44135, there's an open PR there and it
seems to fix what this issue describes.
--
nosy: +kj
___
Python tracker
<https://bugs.python.org/issue16
Ken Jin added the comment:
I'm closing this issue as all the relevant PRs have landed. Thanks everyone!
@Ronald
> Why should this be deprecated at all?
I can't speak for others, but personally I think it's here to stay (for the
many reasons raised in the previous messages).
Tha
201 - 300 of 530 matches
Mail list logo