[issue9417] Declaring a class creates circular references

2020-04-25 Thread Terry J. Reedy
Terry J. Reedy added the comment: Kay, please ask your question on python-list or a similar forum. -- ___ Python tracker ___ ___ Pyt

[issue9417] Declaring a class creates circular references

2020-04-25 Thread Kay Hayen
Kay Hayen added the comment: What I also meant to say, is that debug Python is not affected, and this had me deeply confused. Any ideas how that could happen? -- ___ Python tracker __

[issue9417] Declaring a class creates circular references

2020-04-25 Thread Kay Hayen
Kay Hayen added the comment: Today I changed my reference count tests to not use debug Python and came across this issue. >From my testing, Python3.4 is the first affected version, Python3.3 was still >fine, so were 2.7 and 2.6. This leaks: def simpleFunction39(): class Parent(str):

[issue9417] Declaring a class creates circular references

2014-10-06 Thread Georg Brandl
Georg Brandl added the comment: I don't think this can go somewhere useful. -- resolution: -> wont fix status: open -> closed ___ Python tracker ___ _

[issue9417] Declaring a class creates circular references

2014-09-30 Thread Mark Lawrence
Mark Lawrence added the comment: Does anyone wish to take this forward, is it simply dead in the water or what? You might like to note that msg111963 refers to #812369 which was superseded by #18214 which was fixed in 3.4. -- nosy: +BreamoreBoy versions: +Python 3.5 -Python 3.2 _

[issue9417] Declaring a class creates circular references

2010-08-17 Thread David Stanek
Changes by David Stanek : -- nosy: +dstanek ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.o

[issue9417] Declaring a class creates circular references

2010-08-07 Thread Terry J. Reedy
Terry J. Reedy added the comment: I am opposed to a new 'unlink' builtin and '__unlink__' special method. There are more than enough builtin functions now, and this need is specific to those who both make lots temporary classes that they need garbage collected AND need to run with gc turned o

[issue9417] Declaring a class creates circular references

2010-08-07 Thread Daniel Urban
Changes by Daniel Urban : -- nosy: +durban ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.or

[issue9417] Declaring a class creates circular references

2010-08-07 Thread Ray.Allen
Ray.Allen added the comment: krisvale: > What about my suggestion of simply providing a convention on how to disable > links manually, similar to how minidom.document does it with an "unlink" > method? If these cases are documented, then there shouldn't be any extra > bother to do so. We co

[issue9417] Declaring a class creates circular references

2010-08-06 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: What about my suggestion of simply providing a convention on how to disable links manually, similar to how minidom.document does it with an "unlink" method? If these cases are documented, then there shouldn't be any extra bother to do so. We could pr

[issue9417] Declaring a class creates circular references

2010-08-06 Thread Terry J. Reedy
Terry J. Reedy added the comment: Andrea: for the purpose of this tracker, a 'bug' is a discrepancy between doc and behavior. The fact that (new-style) classes have circular references was known when they were introduced in 2.2. That fact is not a bug in the above sense. It is a design tradeo

[issue9417] Declaring a class creates circular references

2010-07-30 Thread Ray.Allen
Ray.Allen added the comment: Is this due to your adopting of Django? Are there other guys who using Django suffer the same problem? -- ___ Python tracker ___

[issue9417] Declaring a class creates circular references

2010-07-30 Thread Andrea Colangelo
Andrea Colangelo added the comment: I can confirm this bug should be addressed some way. On my high-traffic server, keeping GC enabled causes performance issues due to this bug, and disabling it causes an out-of-memory within hours. -- nosy: +warp10 __

[issue9417] Declaring a class creates circular references

2010-07-30 Thread Ray.Allen
Ray.Allen added the comment: > However here's a proposed solution: * for the __mro__: instead of using a tuple, use a new object that inherits from it. This new object should use weak reference for the first item and should return the real object (if available) only in __getitem__(). * __obj

[issue9417] Declaring a class creates circular references

2010-07-29 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Interesting. Here is a case for disabling GC: We intentionally disable GC in Eve-online, because of the unpredictable lag spikes it produces. In a server application with gigabytes of python objects, GC can cause hickups of some seconds, which is

[issue9417] Declaring a class creates circular references

2010-07-29 Thread Georg Brandl
Georg Brandl added the comment: This is not so easy: the __mro__ tuple, as its name says, is used internally for method resolution, or finding attributes on the type's bases. __objclass__ is used whenever the descriptor is accessed. These operations are involved in every method call. If you

[issue9417] Declaring a class creates circular references

2010-07-29 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: This was discussed in issue1545463 which was deemed not to be worth fixing. The particular bug described in issue1545463 would also be fixed by the still open issue812369. So yes, there are cases where these cycles are a problem even with gc. ---

[issue9417] Declaring a class creates circular references

2010-07-29 Thread Andrea Corbellini
Andrea Corbellini added the comment: This is an unwanted an unexpected behavior, so this is a bug by definition. If it's not easy to fix, it's a different matter. However here's a proposed solution: * for the __mro__: instead of using a tuple, use a new object that inherits from it. This new

[issue9417] Declaring a class creates circular references

2010-07-29 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +krisvale ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pytho

[issue9417] Declaring a class creates circular references

2010-07-29 Thread Georg Brandl
Georg Brandl added the comment: Whether this is a bug is not clear. Sometimes it's just impossible not to create cycles, and classes may just be one instance of that. -- ___ Python tracker ___

[issue9417] Declaring a class creates circular references

2010-07-29 Thread Andrea Corbellini
Andrea Corbellini added the comment: Having a __del__ inside a metaclass is strange, I know... but probably there are situations where you need to do so. Why shouldn't a developer be able to add a __del__ to a metaclass without creating uncollectable objects? I don't think this behavior is by

[issue9417] Declaring a class creates circular references

2010-07-29 Thread Georg Brandl
Georg Brandl added the comment: I couldn't imagine why a metaclass would want to have a __del__ method... -- nosy: +georg.brandl ___ Python tracker ___ __

[issue9417] Declaring a class creates circular references

2010-07-29 Thread Andrea Corbellini
Andrea Corbellini added the comment: Disabling the GC can increase performances (although not significantly). But this bug is the cause of other problems too: what if the metaclass contains a __del__() method? An another issue that I've found is that debugging is harder. I always try to avoi

[issue9417] Declaring a class creates circular references

2010-07-29 Thread Ray.Allen
Ray.Allen added the comment: This should not be a problem, I think. We cannot avoid such a circular reference. I believe the main reason of the circular reference is in MyClass.__mro__, this is a list and contains a reference to MyClass. You can add "__slots__ = []" to MyClass's class body

[issue9417] Declaring a class creates circular references

2010-07-29 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- versions: -Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.3 ___ Python tracker ___ ___ Python

[issue9417] Declaring a class creates circular references

2010-07-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: Is there a reason why you want to disable the cyclic garbage collector? -- nosy: +pitrou ___ Python tracker ___

[issue9417] Declaring a class creates circular references

2010-07-29 Thread Andrea Corbellini
New submission from Andrea Corbellini : Creating a class (either using the 'class' statement or using type()) creates a circular reference. I've attached a script that simply demonstrates this. The problem is caused by the fact that MyClass.__dict__['__dict__'].__objclass__ is MyClass. Althou