<div dir="ltr"><div>Hey Eloi,</div><div><br></div><div>I think you need to just give up on this. Nobody here seems to support or understand your use case. At this point you are repeating yourself (again claiming there is no good reason for the prohibition and that it's only a few lines of code to change) and you can be assured that the response will also be the same.</div><div><br></div><div>--Guido<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jun 26, 2018 at 8:00 AM Eloi Gaudry <<a href="mailto:Eloi.Gaudry@fft.be">Eloi.Gaudry@fft.be</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div id="m_2483186568167295880divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p style="margin-top:0;margin-bottom:0">the origin of this feature disappearing for built-in types:</p>
<p style="margin-top:0;margin-bottom:0"><a href="http://bugs.jython.org/issue1058" class="m_2483186568167295880OWAAutoLink" id="m_2483186568167295880LPlnk825442" target="_blank">http://bugs.jython.org/issue1058</a><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">'''</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div>object.__set/delattr__ allow modification of built in types, this is </div>
<div>known as the Carlo Verre hack:</div>
<div><br>
</div>
<div>Jython 2.3a0+ (trunk:4630:4631M, Jun 14 2008, 20:07:38) </div>
<div>[Java HotSpot(TM) Client VM (Apple Inc.)] on java1.5.0_13</div>
<div>Type "help", "copyright", "credits" or "license" for more information.</div>
<div>>>> object.__setattr__(str, 'lower', str.upper)</div>
<div>>>> 'dammit Carlo!'.lower()</div>
<div>'DAMMIT CARLO!'</div>
<div>'''</div>
<div><br>
</div>
<div>but I do not see any reason why having an explicit flag for python extensions written in C to declare their types as static struct, and still be able to change their __setattr__, __getattr__, etc. slots would not make sense.</div>
<div><br>
</div>
<div>extensions and core types have not the same constraints and purposes, this should be reflected on the capabilities the first would have somewhere then.<br>
</div>
<div><span style="font-family:monospace"><br>
</span></div>
<div><span style="font-family:monospace"><br>
</span></div>
<br>
<p></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
</div>
<hr style="display:inline-block;width:98%">
<div id="m_2483186568167295880divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Eloi Gaudry<br>
<b>Sent:</b> Tuesday, June 26, 2018 4:27:18 PM<br>
<b>To:</b> <a href="mailto:python-ideas@python.org" target="_blank">python-ideas@python.org</a><br>
<b>Subject:</b> Re: [Python-ideas] Allow mutable builtin types (optionally)</font>
<div> </div>
</div>


<div dir="ltr">
<div id="m_2483186568167295880x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0;margin-bottom:0">some literature:</p>
<p style="margin-top:0;margin-bottom:0"><a href="https://mail.python.org/pipermail/python-dev/2008-February/077180.html" class="m_2483186568167295880x_OWAAutoLink" id="m_2483186568167295880LPlnk25528" target="_blank">https://mail.python.org/pipermail/python-dev/2008-February/077180.html</a></p>
<p style="margin-top:0;margin-bottom:0"><a href="https://mail.python.org/pipermail/python-dev/2008-February/077180.html" class="m_2483186568167295880x_OWAAutoLink" id="m_2483186568167295880LPlnk52352" target="_blank"></a><a href="https://mail.python.org/pipermail/python-dev/2008-February/077169.html" class="m_2483186568167295880x_OWAAutoLink" id="m_2483186568167295880LPlnk884690" target="_blank">https://mail.python.org/pipermail/python-dev/2008-February/077169.html</a></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">where it is stated that python C struct type should not be able to have their attributes changed.</p>
<p style="margin-top:0;margin-bottom:0">but the extension needs is clearly not taken into account.<br>
<br>
</p>
</div>
<hr style="display:inline-block;width:98%">
<div id="m_2483186568167295880x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Python-ideas <python-ideas-bounces+eloi.gaudry=<a href="mailto:fft.be@python.org" target="_blank">fft.be@python.org</a>> on behalf of Eloi Gaudry <<a href="mailto:Eloi.Gaudry@fft.be" target="_blank">Eloi.Gaudry@fft.be</a>><br>
<b>Sent:</b> Thursday, June 21, 2018 5:26:37 PM<br>
<b>To:</b> <a href="mailto:python-ideas@python.org" target="_blank">python-ideas@python.org</a>; <a href="mailto:encukou@gmail.com" target="_blank">encukou@gmail.com</a><br>
<b>Subject:</b> Re: [Python-ideas] Allow mutable builtin types (optionally)</font>
<div> </div>
</div>


<div dir="ltr">
<div id="m_2483186568167295880x_x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0;margin-bottom:0">This request didn't have a lot of traction, but <span style="font-size:12pt">I still consider this is something that would need to be supported (2 lines of code to be changed; no regression so far with python 2 and python
 3).</span></p>
<p style="margin-top:0;margin-bottom:0"><span style="font-size:12pt"><br>
</span></p>
<p style="margin-top:0;margin-bottom:0">My main points are:</p>
<p style="margin-top:0;margin-bottom:0">- HEAP_TYPE is not really used (as anyone being using it ?)</p>
<p style="margin-top:0;margin-bottom:0">- HEAP_TYPE serves other purposes </p>
<p style="margin-top:0;margin-bottom:0">- extension would benefit for allowing direct access to any of its type attributes</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Petr, what do you think ?</p>
<p style="margin-top:0;margin-bottom:0">Eloi</p>
</div>
<hr style="display:inline-block;width:98%">
<div id="m_2483186568167295880x_x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Python-ideas <python-ideas-bounces+eloi.gaudry=<a href="mailto:fft.be@python.org" target="_blank">fft.be@python.org</a>> on behalf of Eloi Gaudry <<a href="mailto:Eloi.Gaudry@fft.be" target="_blank">Eloi.Gaudry@fft.be</a>><br>
<b>Sent:</b> Tuesday, May 8, 2018 9:26:47 AM<br>
<b>To:</b> <a href="mailto:encukou@gmail.com" target="_blank">encukou@gmail.com</a>; <a href="mailto:python-ideas@python.org" target="_blank">python-ideas@python.org</a><br>
<b>Subject:</b> Re: [Python-ideas] Allow mutable builtin types (optionally)</font>
<div> </div>
</div>
<div class="m_2483186568167295880x_x_BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="m_2483186568167295880x_x_PlainText">On Mon, 2018-05-07 at 15:23 -0400, Petr Viktorin wrote:<br>
> On 05/07/18 11:37, Eloi Gaudry wrote:<br>
> > I mean, to my knowledge, there is no reason why a type should be<br>
> > allocated on the heap (<a></a><a href="https://docs.python.org/2/c-api/typeobj.html" target="_blank">https://docs.python.org/2/c-api/typeobj.html</a><br>
> > ) to<br>
> > be able to change its attributes at Python level.<br>
> <br>
> One reason is sub-interpreter support: you can have multiple <br>
> interpreters per process, and those shouldn't influence each other.<br>
> (see <a href="https://docs.python.org/3/c-api/init.html#sub-interpreter-suppor" target="_blank">
https://docs.python.org/3/c-api/init.html#sub-interpreter-suppor</a><br>
> t)<br>
> <br>
> With heap types, each sub-interpreter can have its own copy of the<br>
> type <br>
> object. But with builtins, changes done in one interpreter would be <br>
> visible in all the others.<br>
<br>
Yes, this could be a reason, but if you don't rely on such a feature<br>
neither implicitly nor explicitly ?<br>
<br>
I mean, our types are built-in and should be considered as immutable<br>
across interpreters. And we (as most users I guess) are only running<br>
one interpreter.<br>
<br>
In case several intepreters are used, it would make sense to have a<br>
non-heap type that would be seen as a singleton across all of them, no<br>
?<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</div>
</span></font></div>
</div>
</div>
</div>

</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido">python.org/~guido</a>)</div>