[issue45489] ForwardRef does not support | operator

2021-10-16 Thread Ken Jin
Ken Jin added the comment: Thanks @corona10 for the patch. @bobbeyreese The new behavior is available in 3.11 and up. 3.10.x won't be supporting the | operator. -- resolution: -> fixed stage: -> resolved status: open -> closed versions: -Py

[issue45489] ForwardRef does not support | operator

2021-10-16 Thread Ken Jin
Ken Jin added the comment: ForwardRef is for internal use, and writing ForwardRef('fdsa') is discouraged, as the docs say: This class should not be instantiated by a user. However, I don't see any cons from adding union support, so let's do it! Note that a workaround exists for OP's

[issue42345] Equality of typing.Literal depends on the order of arguments

2021-10-13 Thread Ken Jin
Ken Jin added the comment: @Alick yes. To be specific, 3.9.1 and above. 3.9.0 still has the old behavior. -- ___ Python tracker <https://bugs.python.org/issue42

[issue45417] Enum creation non-linear in the number of values

2021-10-10 Thread Ken Jin
Change by Ken Jin : -- nosy: +barry, eli.bendersky, ethan.furman versions: +Python 3.9 -Python 3.7 ___ Python tracker <https://bugs.python.org/issue45

[issue45418] types.UnionType is not subscriptable

2021-10-10 Thread Ken Jin
Ken Jin added the comment: @Guido, I hope I didn't misunderstand you, but to clarify, what OP is asking is an alternative way to construct types.UnionType objects and write: types.UnionType[int, str] like how we used to write before 3.10: typing.Union[int, str] I don't know why we need

[issue45203] Improve specialization stats for LOAD_METHOD and BINARY_SUBSCR

2021-10-10 Thread Ken Jin
Ken Jin added the comment: I'm closing this as there doesn't seem to be anything left to do. Please do reopen this issue if you feel that isn't the case. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed _

[issue45418] types.UnionType is not subscriptable

2021-10-10 Thread Ken Jin
Ken Jin added the comment: No worries! > So I'll have to add some `if` in my code. Yeah, we had to do that in the typing module too. Hope you manage to fix your library without much trouble. -- ___ Python tracker <https://bugs.pyth

[issue45418] types.UnionType is not subscriptable

2021-10-10 Thread Ken Jin
Ken Jin added the comment: I don't understand your example, T | None doesn't return a types.Union object, it returns typing.Union/typing.Optional. (I'm assuming this T is the TypeVar in typing). Which *is* subscriptable. >>> (T | None)[int].__origin__ typing.Union If you meant to

[issue45415] Assert oparg < INSTR_OFFSET()

2021-10-08 Thread Ken Jin
Ken Jin added the comment: > I think we should switch back to debug builds in CI in order to catch failed > assertions before they get merged. I'm not Victor, but +1. I've been bitten by release builds not catching things, see issue44348 for example where I advocated for switchin

[issue45362] dis does not work with the new optimized ops

2021-10-05 Thread Ken Jin
Ken Jin added the comment: Closing this issue as the behavior in dis module is as intended. For any potential issues to 3rd party packages discovered in the future, consider opening an issue in that package's issue tracker, or submitting a brand new issue to bugs.python.org

[issue45367] Specialize BINARY_MULTIPLY

2021-10-05 Thread Ken Jin
Ken Jin added the comment: > (Windows doesn't want to install greenlet for pyperformance) I had the *exact* same issues, I eventually found a workaround for it after many hours spent guessing. Initially, setuptools complained that I needed MSVC++ 14.0 or later (even after I had the lat

[issue45362] dis does not work with the new optimized ops

2021-10-04 Thread Ken Jin
Ken Jin added the comment: > Will this change be reflected in co_code? No. As per PEP 659: "Once any instruction in a code object has executed a few times, that code object will be "quickened" by allocating a new array for the bytecode that can be m

[issue45362] dis does not work with the new optimized ops

2021-10-04 Thread Ken Jin
Ken Jin added the comment: Thanks Martmists for the bug report, I'll try to address some of your concerns: > The reason for this seems to be the lack of definition in `opcode.py` aside > from being mentioned in _specialized_instructions. If I understood Mark's intentions in P

[issue45352] Move documentation for typed generic forms of standard collections to collections.abc

2021-10-04 Thread Ken Jin
Ken Jin added the comment: > I think those should go with the individual types as well The list[] and dict[] stdtypes are in a different document from collections.abc.*. While this helps logical separation, I feel like it'd be tougher searching for type information compared to our curr

[issue45352] Move documentation for typed generic forms of standard collections to collections.abc

2021-10-03 Thread Ken Jin
Change by Ken Jin : -- nosy: +gvanrossum, kj, rhettinger, stutzbach ___ Python tracker <https://bugs.python.org/issue45352> ___ ___ Python-bugs-list mailin

[issue45330] dulwich_log performance regression in 3.10

2021-10-01 Thread Ken Jin
Ken Jin added the comment: Ooh thanks Irit, I hadn't considered that. I thought that versions were fixed, but it seems that we *do* change the 3rd party package versions once in a while. In that time period, we bumped dulwich from 0.20.20 to 0.20.21 https://github.com/python/pyperformance

[issue45330] dulwich_log performance regression in 3.10

2021-09-30 Thread Ken Jin
New submission from Ken Jin : Somewhere between May02-May11, dulwich_log benchmark on pyperformance had a major performance regression on the 3.10 branch. https://speed.python.org/timeline/?exe=12==dulwich_log=1=200=off=on=on For a start, we could git bisect with pyperformance. FWIW, I

[issue45116] Performance regression 3.10b1 and later on Windows: Py_DECREF() not inlined in PGO build

2021-09-30 Thread Ken Jin
Ken Jin added the comment: @Pablo > I disagree. This is a regression/bug and we don't advertise "known bugs" in > the what's new, the same for any other bugfix that has been delayed until > 3.10.1 Alright, in hindsight 3.10 What's New was a bad suggestion on my part. I

[issue45116] Performance regression 3.10b1 and later on Windows: Py_DECREF() not inlined in PGO build

2021-09-29 Thread Ken Jin
Ken Jin added the comment: Sadly, I can't reproduce the speedups OP reported from disabling test_patma.TestTracing. It's not any faster than what we have with PR28475. (See attached pyperformance). I'm looking forward to their other fix :). Even if it comes in 3.10.1 that's still a huge

[issue45116] Performance regression 3.10b1 and later on Windows: Py_DECREF() not inlined in PGO build

2021-09-29 Thread Ken Jin
Ken Jin added the comment: > If someone wants this issue to be solved in 3.10.0 it must be resolved ASAP. neonene suggested that the tracing tests for pattern matching (added in 3.10b4/rc1) caused PGO to wrongly optimize the more uncommon tracing paths in ceval. I will verify their one-l

[issue45295] Speed up classmethod calls via LOAD_METHOD

2021-09-27 Thread Ken Jin
Change by Ken Jin : -- title: _PyObject_GetMethod/LOAD_METHOD for C classmethods -> Speed up classmethod calls via LOAD_METHOD ___ Python tracker <https://bugs.python.org/issu

[issue45295] _PyObject_GetMethod/LOAD_METHOD for C classmethods

2021-09-27 Thread Ken Jin
Change by Ken Jin : -- keywords: +patch pull_requests: +26961 stage: -> patch review pull_request: https://github.com/python/cpython/pull/28572 ___ Python tracker <https://bugs.python.org/issu

[issue45295] _PyObject_GetMethod/LOAD_METHOD for C classmethods

2021-09-26 Thread Ken Jin
New submission from Ken Jin : LOAD_METHOD + CALL_METHOD currently doesn't work for Python @classmethod and C classmethod (METH_CLASS). They still create bound classmethods which are fairly expensive. I propose supporting classmethods. I have an implementation for C classmethods. It passes

[issue45283] Top / function argument level ClassVar should not be allowed during `get_type_hints()`

2021-09-25 Thread Ken Jin
Ken Jin added the comment: > 1. By adding the same `_type_check` logic we can reduce the inconsistency > between two versions. It would be easier for users to migrate from one > version to another. That's definitely a plus. But please consider this hypothetical scenario: - Let's

[issue45283] Top / function argument level ClassVar should not be allowed during `get_type_hints()`

2021-09-25 Thread Ken Jin
Ken Jin added the comment: This makes ``get_type_hints`` quite opinionated and backwards incompatible. The first line the docs says "This is often the same as obj.__annotations__". I also agree with Guido. FYI, we've tried to *reduce* usage of `_type_check` in new features sin

[issue44958] [sqlite3] only reset statements when needed

2021-09-22 Thread Ken Jin
Ken Jin added the comment: Erlend, I suspect that 050d1035957379d70e8601e6f5636637716a264b may have introduced a perf regression in pyperformance's sqlite_synth benchmark: https://speed.python.org/timeline/?exe=12==sqlite_synth=1=50=off=on=on The benchmark code is here https://github.com

[issue45256] Remove the usage of the cstack in Python to Python calls

2021-09-21 Thread Ken Jin
Change by Ken Jin : -- nosy: +kj ___ Python tracker <https://bugs.python.org/issue45256> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue45116] Performance regression 3.10b1 and later on Windows: Py_DECREF() not inlined in PGO build

2021-09-21 Thread Ken Jin
Ken Jin added the comment: Like what Ma Lin and neonene have mentioned above, PR28475 recovered half of the lost performance. It's unfortunately still 4% slower than 3.10a7. >pyperf compare_to 310a7.json 310rc2.json 310rc2patched.json Geometric mean (versus 3.10a7) == 310

[issue45116] Performance regression 3.10b1 and later on Windows: Py_DECREF() not inlined in PGO build

2021-09-18 Thread Ken Jin
Ken Jin added the comment: @Pablo, > If is correct ... For some verification, I benched pyperformance on Win10 AMD64, with the Python 3.10a7 and 3.10rc2 x64 binaries downloaded directly from python.org website release pages. The results corroborate with neonene's (please see the attac

[issue45116] Performance regression 3.10b1 and later on Windows: Py_DECREF() not inlined in PGO build

2021-09-17 Thread Ken Jin
Ken Jin added the comment: > How severe is the regression? OP provided pyperformance of current 3.10 vs their patched version at https://bugs.python.org/file50280/310rc2_benchmarks.txt. The patch is at https://bugs.python.org/msg401

[issue45107] Improve LOAD_METHOD specialization

2021-09-17 Thread Ken Jin
Ken Jin added the comment: New changeset 70bed6f9936c811472b376edd93c37bcf8f06f35 by Ken Jin in branch 'main': bpo-45107: Make LOAD_METHOD_CLASS safer and faster, clean up comments (GH-28177) https://github.com/python/cpython/commit/70bed6f9936c811472b376edd93c37bcf8f06f35

[issue45116] Performance regression 3.10b1 and later on Windows: Py_DECREF() not inlined in PGO build

2021-09-17 Thread Ken Jin
Ken Jin added the comment: @neonene Thanks for the truly excellent investigation! @Raymond and @Steve, If I understood OP (neonene) properly, changing Py_DECREF to a macro won't get back the entire 7% lost performance in pyperformance. neonene's investigations suggest that the entire eval

[issue45227] Control reaches end of non-void function in specialize.c

2021-09-17 Thread Ken Jin
Ken Jin added the comment: Fixed in https://github.com/python/cpython/commit/4857e53890408fd5a8ee0e83c0250dd5355b3de3. -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue45203] Improve specialization stats for LOAD_METHOD and BINARY_SUBSCR

2021-09-17 Thread Ken Jin
Ken Jin added the comment: New changeset 4857e53890408fd5a8ee0e83c0250dd5355b3de3 by Ken Jin in branch 'main': bpo-45203: fix compiler warnings (GH-28357) https://github.com/python/cpython/commit/4857e53890408fd5a8ee0e83c0250dd5355b3de3

[issue45227] Control reaches end of non-void function in specialize.c

2021-09-17 Thread Ken Jin
Ken Jin added the comment: Please see https://bugs.python.org/issue45203. A fix is available at https://github.com/python/cpython/pull/28357 or https://github.com/python/cpython/pull/28386. But we're waiting for Windows CI to pass. -- nosy: +kj

[issue45116] Performance regression 3.10b1 and later on Windows: Py_DECREF() not inlined in PGO build

2021-09-16 Thread Ken Jin
Change by Ken Jin : -- nosy: +kj ___ Python tracker <https://bugs.python.org/issue45116> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue45203] Improve specialization stats for LOAD_METHOD and BINARY_SUBSCR

2021-09-15 Thread Ken Jin
Change by Ken Jin : -- nosy: +kj nosy_count: 2.0 -> 3.0 pull_requests: +26771 pull_request: https://github.com/python/cpython/pull/28357 ___ Python tracker <https://bugs.python.org/issu

[issue45121] Calling super().__init__ in subclasses of typing.Protocol raises RecursionError

2021-09-08 Thread Ken Jin
Change by Ken Jin : -- pull_requests: +26653 pull_request: https://github.com/python/cpython/pull/28233 ___ Python tracker <https://bugs.python.org/issue45

[issue45121] Calling super().__init__ in subclasses of typing.Protocol raises RecursionError

2021-09-08 Thread Ken Jin
Ken Jin added the comment: New changeset c11956a8bddd75f02ccc7b4da7e4d8123e1f3c5f by Yurii Karabas in branch 'main': bpo-45121: Fix RecursionError when calling Protocol.__init__ from a subclass' __init__ (GH-28206) https://github.com/python/cpython/commit

[issue45121] Calling super().__init__ in subclasses of typing.Protocol raises RecursionError

2021-09-07 Thread Ken Jin
Change by Ken Jin : -- priority: normal -> critical title: Regression in 3.9.7 with typing.Protocol -> Calling super().__init__ in subclasses of typing.Protocol raises RecursionError versions: +Python 3.10, Python 3.11 ___ Python tracker

[issue45107] Improve LOAD_METHOD specialization

2021-09-05 Thread Ken Jin
Change by Ken Jin : -- keywords: +patch pull_requests: +26604 stage: -> patch review pull_request: https://github.com/python/cpython/pull/28177 ___ Python tracker <https://bugs.python.org/issu

[issue45107] Improve LOAD_METHOD specialization

2021-09-05 Thread Ken Jin
New submission from Ken Jin : I plan to do two improvements over the initial implementation: 1. General comments cleanup and optimize LOAD_METHOD_CLASS. 2. Implement LOAD_METHOD_SUPER, for super().meth() calls. See Issue44889 for the precursor. -- components: Interpreter Core

[issue45100] Teach help about typing.overload()

2021-09-05 Thread Ken Jin
Change by Ken Jin : -- nosy: +gvanrossum, kj ___ Python tracker <https://bugs.python.org/issue45100> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44863] Allow TypedDict to inherit from Generics

2021-09-05 Thread Ken Jin
Ken Jin added the comment: Guido, OP has kindly written a mini PEP for this. Do you think just updating PEP 589 is sufficient, or do we need a full PEP? (PS. Changed version to 3.11 since we've missed the train for 3.10 enhancements). -- versions: -Python 3.10

[issue45094] Consider using __forceinline and __attribute__((always_inline)) on static inline functions (Py_INCREF, Py_TYPE) for debug builds

2021-09-03 Thread Ken Jin
Change by Ken Jin : -- nosy: +kj ___ Python tracker <https://bugs.python.org/issue45094> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue45024] Cannot extend collections ABCs with protocol

2021-09-02 Thread Ken Jin
Ken Jin added the comment: I suspect this may be intentional. See related issues https://bugs.python.org/issue35190 and https://bugs.python.org/issue23864. Copying verbatim from what Ivan said in the first issue: " The separation may look arbitrary, but the idea is quite simple. Only

[issue45081] dataclasses that inherit from Protocol subclasses have wrong __init__

2021-09-02 Thread Ken Jin
Change by Ken Jin : -- nosy: +kj, lukasz.langa, serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue45081> ___ ___ Python-bugs-list mailin

[issue36560] test_functools leaks randomly 1 memory block

2021-08-31 Thread Ken Jin
Ken Jin added the comment: @Victor, with your patch applied, for test_typing (locally, Windows x64): $ ./python -m test test_typing -R 3:20 Different result on every run (race condition maybe?) $ ./python -m test test_typing -R 1:20 Same result as yours on every run. -- nosy: +kj

[issue44135] issubclass documentation doesn't explain tuple semantic

2021-08-31 Thread Ken Jin
Change by Ken Jin : -- pull_requests: +26538 pull_request: https://github.com/python/cpython/pull/28095 ___ Python tracker <https://bugs.python.org/issue44

[issue44925] [docs] Confusing deprecation notice for typing.IO

2021-08-31 Thread Ken Jin
Ken Jin added the comment: New changeset edae42f99f8153b92ccf365dbd1c2fa954f913b4 by DonnaDia in branch 'main': bpo-44925: [docs] Fix confusing deprecation notice for typing.IO (GH-28004) https://github.com/python/cpython/commit/edae42f99f8153b92ccf365dbd1c2fa954f913b4

[issue45024] Cannot extend collections ABCs with protocol

2021-08-28 Thread Ken Jin
Ken Jin added the comment: Thanks for the bug report Anup. I'm mildly confused by what you meant, so please help me here: I interpreted your request as wanting any type that implements `method` and `__iter__` to be considered a subtype of `IterableWithMethod`. But this already works

[issue44975] [typing] Runtime protocols with ClassVar data members should support issubclass

2021-08-22 Thread Ken Jin
Change by Ken Jin : -- keywords: +patch pull_requests: +26338 stage: -> patch review pull_request: https://github.com/python/cpython/pull/27883 ___ Python tracker <https://bugs.python.org/issu

[issue44975] [typing] Runtime protocols with ClassVar data members should support issubclass

2021-08-22 Thread Ken Jin
New submission from Ken Jin : This is a feature request by a user at https://github.com/python/typing/issues/822. A copy of their request: Currently issubclass cannot be used for runtime_checkable protocols with data members, because those attributes could be set in __init__. I propose

[issue38291] Deprecate the typing.io and typing.re pseudo-modules

2021-08-21 Thread Ken Jin
Change by Ken Jin : -- pull_requests: +26327 pull_request: https://github.com/python/cpython/pull/27872 ___ Python tracker <https://bugs.python.org/issue38

[issue44524] __name__ attribute in typing module

2021-08-19 Thread Ken Jin
Ken Jin added the comment: > Now a subclass of an Annotated alias is a generic type. Should it be? I'm unsure if Annotated should be subclassable in the first place, but if I understand PEP 593 correctly, class X(Annotated[int, (1, 10)]), should be equivalent to class X(int) ri

[issue44524] __name__ attribute in typing module

2021-08-19 Thread Ken Jin
Change by Ken Jin : -- pull_requests: +26305 pull_request: https://github.com/python/cpython/pull/27841 ___ Python tracker <https://bugs.python.org/issue44

[issue44957] typing docs: Mention PEP 604 syntax more prominently

2021-08-19 Thread Ken Jin
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

[issue44914] tp_version_tag is not unique when test runs with -R :

2021-08-19 Thread Ken Jin
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

[issue44941] Add check_methods function to standard library

2021-08-19 Thread Ken Jin
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

[issue44926] typing.get_type_hints() raises for type aliases with forward references

2021-08-18 Thread Ken Jin
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

[issue44937] test_regrest: test_tools_script_run_tests() failed on GHA Windows x64

2021-08-18 Thread Ken Jin
Change by Ken Jin : -- nosy: +kj ___ Python tracker <https://bugs.python.org/issue44937> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue44941] Add check_methods function to collections.abc in standard library

2021-08-18 Thread Ken Jin
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

[issue44925] [docs] Confusing deprecation notice for typing.IO

2021-08-18 Thread Ken Jin
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

[issue44889] Specialize LOAD_METHOD with PEP 659 adaptive interpreter

2021-08-17 Thread Ken Jin
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

[issue44932] `issubclass` and `isinstance` doesn't check for all 2nd argument types

2021-08-17 Thread Ken Jin
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

[issue44914] tp_version_tag is not unique when test runs with -R :

2021-08-17 Thread Ken Jin
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

[issue44914] tp_version_tag is not unique when test runs with -R :

2021-08-17 Thread Ken Jin
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

[issue44932] `issubclass` and `isinstance` doesn't check for all 2nd argument types

2021-08-17 Thread Ken Jin
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

[issue44926] typing.get_type_hints() raises for type aliases with forward references

2021-08-16 Thread Ken Jin
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

[issue44925] [docs] Confusing deprecation notice for typing.IO

2021-08-16 Thread Ken Jin
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

[issue44925] [docs] Confusing deprecation notice for typing.IO

2021-08-16 Thread Ken Jin
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

[issue44914] tp_version_tag is not unique when test runs with -R :

2021-08-16 Thread Ken Jin
Change by Ken Jin : -- pull_requests: +26251 pull_request: https://github.com/python/cpython/pull/27774 ___ Python tracker <https://bugs.python.org/issue44

[issue44914] tp_version_tag is not unique when test runs with -R :

2021-08-15 Thread Ken Jin
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

[issue44914] tp_version_tag is not unique when test runs with -R :

2021-08-14 Thread Ken Jin
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

[issue44889] Specialize LOAD_METHOD with PEP 659 adaptive interpreter

2021-08-11 Thread Ken Jin
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

[issue44889] Specialize LOAD_METHOD with PEP 659 adaptive interpreter

2021-08-11 Thread Ken Jin
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

[issue44524] __name__ attribute in typing module

2021-08-05 Thread Ken Jin
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_

[issue44524] __name__ attribute in typing module

2021-08-05 Thread Ken Jin
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

[issue44524] __name__ attribute in typing module

2021-08-05 Thread Ken Jin
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[],

[issue30256] Adding a SyncManager Queue proxy to a SyncManager dict or Namespace proxy raises an exception

2021-08-03 Thread Ken Jin
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

[issue44812] [docs] Document PyMember_{Get/Set}One in C API reference

2021-08-02 Thread Ken Jin
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

[issue44812] [docs] Document PyMember_{Get/Set}One in C API reference

2021-08-02 Thread Ken Jin
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

[issue34422] __name__ not available for classes in typing module

2021-08-02 Thread Ken Jin
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

[issue44801] Type expression is coerced to a list of parameter arguments in substitution of ParamSpec

2021-08-01 Thread Ken Jin
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

[issue44791] Substitution of ParamSpec in Concatenate

2021-07-31 Thread Ken Jin
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

[issue44098] Remove ParamSpec from __parameters__ of most typing generics

2021-07-28 Thread Ken Jin
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

[issue44747] Refactor usage of sys._getframe at typing module

2021-07-28 Thread Ken Jin
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

[issue44021] enum docs in 3.10: missing "New in version 3.10"

2021-07-27 Thread Ken Jin
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

[issue44676] Add ability to serialise types.Union

2021-07-24 Thread Ken Jin
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

[issue44676] Add ability to serialise types.Union

2021-07-24 Thread Ken Jin
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

[issue44353] PEP 604 NewType

2021-07-24 Thread Ken Jin
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 ___

[issue44731] Simplify implementation of the union type

2021-07-24 Thread Ken Jin
Change by Ken Jin : -- pull_requests: +25877 pull_request: https://github.com/python/cpython/pull/27334 ___ Python tracker <https://bugs.python.org/issue44

[issue44353] PEP 604 NewType

2021-07-24 Thread Ken Jin
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

[issue44353] PEP 604 NewType

2021-07-24 Thread Ken Jin
Change by Ken Jin : -- pull_requests: +25865 pull_request: https://github.com/python/cpython/pull/27319 ___ Python tracker <https://bugs.python.org/issue44

[issue38291] Deprecate the typing.io and typing.re pseudo-modules

2021-07-23 Thread Ken Jin
Change by Ken Jin : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue44353] PEP 604 NewType

2021-07-19 Thread Ken Jin
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 ->

[issue44353] PEP 604 NewType

2021-07-19 Thread Ken Jin
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

[issue44662] Add ability to annotate types.Union

2021-07-19 Thread Ken Jin
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

[issue44524] __name__ attribute in typing module

2021-07-19 Thread Ken Jin
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

[issue44653] Parameter substitution in the union type does not work with typing.Union

2021-07-19 Thread Ken Jin
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

  1   2   3   4   >