Re: What's the public API alternative to _PyObject_GC_IS_TRACKED()?

2021-12-28 Thread Marco Sulla
On Wed, 29 Dec 2021 at 07:46, Inada Naoki wrote: > You are right. I thought PyObject_GC_Track() can be used to tracked > objects because PyObject_GC_Untrack() can be used untracked object. > I think there is no enough reason for this asymmetry. > > Additionally, adding PyObject_GC_IsTracked() to p

Re: What's the public API alternative to _PyObject_GC_IS_TRACKED()?

2021-12-28 Thread Marco Sulla
On Wed, 29 Dec 2021 at 00:03, Dieter Maurer wrote: > Why do you not derive from `dict` and override its mutating methods > (to raise a type error after initialization is complete)? I've done this for the pure py version, for speed. But in this way, frozendict results to be a subclass of MutableMa

Re: What's the public API alternative to _PyObject_GC_IS_TRACKED()?

2021-12-28 Thread Inada Naoki
On Wed, Dec 29, 2021 at 5:18 AM Marco Sulla wrote: > > > > But PyObject_GC_Track() is a public API. > > The problem is I can't invoke PyObject_GC_Track() on an already > tracked object. I tried it and Python segfaulted. That's why CPython > uses _PyObject_GC_IS_TRACKED() before. > You are right.

Re: Option for venv to upgrade pip automatically?

2021-12-28 Thread Inada Naoki
You can use --upgrade-deps option. My alias is: alias mkvenv='python3 -m venv --upgrade-deps --prompt . venv' On Wed, Dec 29, 2021 at 4:55 AM Marco Sulla wrote: > > I think it's very boring that, after creating a venv, you have > immediately to do every time: > > pip install -U pip > > Can't v

Re: What's the public API alternative to _PyObject_GC_IS_TRACKED()?

2021-12-28 Thread Dieter Maurer
Marco Sulla wrote at 2021-12-27 19:30 +0100: >I need it since I'm developing an immutable dict. And in dict that >function is used. Why do you not derive from `dict` and override its mutating methods (to raise a type error after initialization is complete)? -- https://mail.python.org/mailman/list

Re: What's the public API alternative to _PyObject_GC_IS_TRACKED()?

2021-12-28 Thread Marco Sulla
On Tue, 28 Dec 2021 at 12:38, Inada Naoki wrote: > Your case is special. > You want to create a frozendict which performance is same to builtin dict. > Builtin dict has special optimization which tightly coupled with > current CPython implementation. > So you need to use private APIs for MAINTAIN_

Option for venv to upgrade pip automatically?

2021-12-28 Thread Marco Sulla
I think it's very boring that, after creating a venv, you have immediately to do every time: pip install -U pip Can't venv have an option for doing this automatically or, better, a config file where you can put commands that will be launched every time after you create a venv? -- https://mail.py

Re: What's the public API alternative to _PyObject_GC_IS_TRACKED()?

2021-12-28 Thread Inada Naoki
On Tue, Dec 28, 2021 at 4:41 PM Marco Sulla wrote: > > Hi, Inada Senpai. So I do not need PyObject_GC_Track on cloning or > merging, or MAINTAIN_TRACKING on insert? > Your case is special. You want to create a frozendict which performance is same to builtin dict. Builtin dict has special optimiza