[issue46841] Inline bytecode caches

2022-03-24 Thread penguin_wwy


Change by penguin_wwy <940375...@qq.com>:


--
nosy: +penguin_wwy
nosy_count: 4.0 -> 5.0
pull_requests: +30181
pull_request: https://github.com/python/cpython/pull/32099

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



[issue47067] Add vectorcall for generica alias object

2022-03-20 Thread penguin_wwy


penguin_wwy <940375...@qq.com> added the comment:

> You could also try replacing PyObject_SetAttrString with PyObject_SetAttr and 
> adding "__orig_class__" to the global strings with 
> Tools/scripts/generate_global_objects.py, probably for a later PR.

Already done via `make regen-global-objects`

Also, I found that `regen-global-objects` depends on `regen-deepfreeze`, which 
should be a bug. This causes the `regen-global-objects` to be executed with the 
compile task first, and it does not compile successfully at this point because 
of the new symbols(_Py_ID(__orig_class__)) added.

--

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



[issue47067] Add vectorcall for generica alias object

2022-03-20 Thread penguin_wwy


penguin_wwy <940375...@qq.com> added the comment:

There is a small problem with the example:

```
d = dict[int]
```

should

```
d = dict[str, int]
```

--

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



[issue47067] Add vectorcall for generica alias object

2022-03-20 Thread penguin_wwy

penguin_wwy <940375...@qq.com> added the comment:

The point of bpo-40369 issue seems to be to provide vectorcall to the 
`GenericAliasType`, means vectorcall for `Queue[int]`

However, my idea is to add vectorcall to gaobject, like this:

```
d = dict[int]
d(a=1, b=2) <-- vectorcall
```

The idea came from my desire to implement different subclasses of a type when 
implementing some kind of factory model:

```
class ChildClassBuilder:
...

def set_type(self, t: Type):
self.t = t

def build():
instance = self.t()
...
return instance
```

In the case of high type-hint coverage, the `self.t` is often a gaobject.

Benchmark example:
```
def test():
d = dict[int]
for _ in range(100):
d(a=1, b=2)
```

Speedup 20% in my wsl2
```
opt:
   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
10.0000.0001.7281.728 :1()
11.7281.7281.7281.728 test.py:4(test)

master:
   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
10.0000.0002.2712.271 :1()
12.2712.2712.2712.271 test.py:4(test)
```

--

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



[issue47067] Add vectorcall for generica alias object

2022-03-19 Thread penguin_wwy


Change by penguin_wwy <940375...@qq.com>:


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

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



[issue47067] Add vectorcall for generica alias object

2022-03-19 Thread penguin_wwy


New submission from penguin_wwy <940375...@qq.com>:

Although `ga_call` determines whether `origin` has a vectorcall, it needs to be 
unpacked the parameters that are already packed.
  /-> origin.vectorcall(unpacked)
MakeTpCall(packed) -> ga_call -> PyObject_Call
   \-> origin.tp_call

We can advance the `vectorcall` judgment to the `setup` phase.

ga_vectorcall -> origin.vectorcall

or

ga_make_tp_call -> _PyObject_MakeTpCall(packed argument) -> origin.tp_call

This will have no effect on tp_call, which still only needs to be packed once, 
while vectorcall does not need packed/unpacked

--
components: Library (Lib)
messages: 415556
nosy: penguin_wwy
priority: normal
severity: normal
status: open
title: Add vectorcall for generica alias object
versions: Python 3.11

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



[issue46813] Allow developer to resize the dictionary

2022-02-21 Thread penguin_wwy


penguin_wwy <940375...@qq.com> added the comment:

I tried to look for it in issue list two days ago but couldn't find it. Maybe I 
should have been more careful :(.

However, I think it is a useful modification. Just need to return a dict that 
satisfies the user's requirements, and the developers themselves should be 
responsible for their code (if they can't use it exactly, they should choose to 
use the default, and python needs to do is provide that optional ability)

--

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



[issue46813] Allow developer to resize the dictionary

2022-02-20 Thread penguin_wwy


Change by penguin_wwy <940375...@qq.com>:


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

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



[issue46813] Allow developer to resize the dictionary

2022-02-20 Thread penguin_wwy


New submission from penguin_wwy <940375...@qq.com>:

https://github.com/faster-cpython/ideas/discussions/288

--
components: Interpreter Core
messages: 413634
nosy: penguin_wwy
priority: normal
severity: normal
status: open
title: Allow developer to resize the dictionary
type: enhancement
versions: Python 3.11

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



[issue46031] add POP_JUMP_IF_NOT_NONE and POP_JUMP_IF_NONE

2021-12-10 Thread penguin_wwy


Change by penguin_wwy <940375...@qq.com>:


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

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



[issue46031] add POP_JUMP_IF_NOT_NONE and POP_JUMP_IF_NONE

2021-12-10 Thread penguin_wwy


New submission from penguin_wwy <940375...@qq.com>:

https://github.com/faster-cpython/ideas/discussions/154

--
components: Interpreter Core
messages: 408178
nosy: penguin_wwy
priority: normal
severity: normal
status: open
title: add POP_JUMP_IF_NOT_NONE and POP_JUMP_IF_NONE
type: performance
versions: Python 3.11

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



[issue45630] Dump CodeObject API for debugging

2021-12-09 Thread penguin_wwy


penguin_wwy <940375...@qq.com> added the comment:

Recently, we have used this function to troubleshoot problems with online 
applications.
We have implemented the PEP659(Specializing) to the 3.6 version which is used 
by online services, and this function allows us to dump the current function's 
code in the case of an unhandled exception to determine if the problem was 
caused by an optimization.

--

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



[issue45928] Set up file stream for redirecting GC logs

2021-11-29 Thread penguin_wwy


penguin_wwy <940375...@qq.com> added the comment:

Sorry, parameter type is `TextIOWrapper`, not `TestIOWrapper`

--

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



[issue45928] Set up file stream for redirecting GC logs

2021-11-29 Thread penguin_wwy


penguin_wwy <940375...@qq.com> added the comment:

Thank you for the reminder.

At first, I wanted to analyze the effectiveness of GC through logs.
However, because GC through the stderr output, these logs are mixed in with 
other output(such as warnings). This make it difficult to handle them 
automaticaly.

So, i added an `TestIOWrapper` parameter(Not just file streams, but also other 
io, sockets, buffer and so on) to `set_debug` function in gcmodule.c, to 
redirect GC logs.

I think this will help developers monitor the GC more easily, for example when 
they deal with a memory leak.

Of course, the default will remain the same as the previous behavior , log via 
stderr :)

--

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



[issue45928] Set up file stream for redirecting GC logs

2021-11-29 Thread penguin_wwy


Change by penguin_wwy <940375...@qq.com>:


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

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



[issue45928] Set up file stream for redirecting GC logs

2021-11-29 Thread penguin_wwy


New submission from penguin_wwy <940375...@qq.com>:

Set up file stream for redirecting logs by adding a parameter in `set_debug`.

The stderr is used by default.

--
components: Library (Lib)
messages: 407286
nosy: penguin_wwy
priority: normal
severity: normal
status: open
title: Set up file stream for redirecting GC logs
type: enhancement
versions: Python 3.11

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



[issue45630] Dump CodeObject API for debugging

2021-11-05 Thread penguin_wwy


penguin_wwy <940375...@qq.com> added the comment:

I hope that this function can be used in the _PyEval_EvalFrameDefault(or other 
customized eval_frame), for example, after calling the _Py_Quicken to confirm 
whether the instruction is modified correctly 
https://github.com/python/cpython/pull/29243/files#diff-c22186367cbe20233e843261998dc027ae5f1f8c0d2e778abfa454ae74cc59de

--

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



[issue45630] Dump CodeObject API for debugging

2021-11-05 Thread penguin_wwy


Change by penguin_wwy <940375...@qq.com>:


--
nosy: +gvanrossum

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



[issue45630] Dump CodeObject API for debugging

2021-10-28 Thread penguin_wwy


penguin_wwy <940375...@qq.com> added the comment:

This interface can dump code at any time, not just at compile time.

Can observe the comparison before and after dynamic optimization(eg. specialize 
and super instr), and can also observe the instructions actually executed.

Another situation is to execute the dump by command line in gdb/lldb(eg. 
`expression _PyCode_DebugDump(co, "test")`), when debugging.

--

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



[issue45630] Dump CodeObject API for debugging

2021-10-27 Thread penguin_wwy


Change by penguin_wwy <940375...@qq.com>:


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

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



[issue45630] Dump CodeObject API for debugging

2021-10-27 Thread penguin_wwy


New submission from penguin_wwy <940375...@qq.com>:

What the title says.

--
components: Interpreter Core
messages: 405106
nosy: penguin_wwy
priority: normal
severity: normal
status: open
title: Dump CodeObject API for debugging
type: enhancement
versions: Python 3.11

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