Re: [Python-Dev] Counting references to Py_None

2016-03-21 Thread Alexander Belopolsky
On Mon, Mar 21, 2016 at 5:56 PM, Tim Peters wrote: > I've seen this trigger, > from C code that had no idea it was playing with None, but just had > general refcounting errors. So this does serve a debugging purpose, > although rarely > You probably have a better

Re: [Python-Dev] Counting references to Py_None

2016-03-21 Thread Tim Peters
Brett Cannon ] >> And if we didn't keep its count accurately it would eventually hit >> zero and constantly have its dealloc function checked for. [Armin Rigo] [> I think the idea is really consistency. If we wanted to avoid all > "Py_INCREF(Py_None);", it would be possible: we

Re: [Python-Dev] Counting references to Py_None

2016-03-21 Thread Armin Rigo
Hi, On 20 March 2016 at 18:10, Brett Cannon wrote: > And if we didn't keep its count accurately it would eventually hit > zero and constantly have its dealloc function checked for. I think the idea is really consistency. If we wanted to avoid all "Py_INCREF(Py_None);", it

Re: [Python-Dev] Counting references to Py_None

2016-03-20 Thread Tim Peters
[Facundo Batista ] > I'm seeing that our code increases the reference counting to Py_None, > and I find this a little strange: isn't Py_None eternal and will never > die? Yes, but it's immortal in CPython because its reference count never falls to 0 (it's created with a

Re: [Python-Dev] Counting references to Py_None

2016-03-20 Thread Brett Cannon
On Sun, 20 Mar 2016 at 09:44 Facundo Batista wrote: > Hello! > > I'm seeing that our code increases the reference counting to Py_None, > and I find this a little strange: isn't Py_None eternal and will never > die? > Semantically yes, but we have to technically make

Re: [Python-Dev] Counting references to Py_None

2016-03-20 Thread David Wilson
On Sun, Mar 20, 2016 at 01:43:27PM -0300, Facundo Batista wrote: > Hello! > > I'm seeing that our code increases the reference counting to Py_None, > and I find this a little strange: isn't Py_None eternal and will never > die? > > What's the point of counting its references? Avoiding a branch

[Python-Dev] Counting references to Py_None

2016-03-20 Thread Facundo Batista
Hello! I'm seeing that our code increases the reference counting to Py_None, and I find this a little strange: isn't Py_None eternal and will never die? What's the point of counting its references? Thanks! -- .Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: