Giter Club home page Giter Club logo

Comments (7)

svenil avatar svenil commented on July 18, 2024

Interesting links to the CPython tests and the test_refcount test in particular which had to use a global instead of a local when testing refcounts.. Global objects don't get more references by PyFrame_FastToLocals.

Maybe a workaround would be to use global objects in Heapy tests and for the GC Hook object but I am not sure if it would have bad consequences or how many changes would be needed. What about multiple Heapy objects...

Another way if not using global objects could be to have the variables as object member variables, I suppose those would also not get more references. Have to think more about of this and test.

I think the check in View.py could be fixed by making the GC Hook handle a member variable.
But it remains to fix the tests, probably by encapsulating the critical variables in objects or making they global (urk). I checked in the new version in the link below. Travis test passes so far.

Note that this is my local version Guppy-PE for Python2, I haven't forked the Guppy3 (yet) so I can't commit to that directly.

svenil/guppy-pe@f5fbe94

PS: I am not going to fix the tests, not for now anyway, because it is late in the evening and tomorrow I will go to the work again.

from guppy3.

zhuyifei1999 avatar zhuyifei1999 commented on July 18, 2024

Hmm... I want to see if there is a way to clear this reference chain, even if we must use C code.

from guppy3.

zhuyifei1999 avatar zhuyifei1999 commented on July 18, 2024

I just saw https://bugs.python.org/issue30744...

from guppy3.

zhuyifei1999 avatar zhuyifei1999 commented on July 18, 2024

The ugly side of this is that, I can't just simply clear these locals dicts. PyFrame_LocalsToFast is called with clear set so clearing the dict would effectively clear all locals.

Now I wish PEP 558 get some real progress.

from guppy3.

zhuyifei1999 avatar zhuyifei1999 commented on July 18, 2024

Yeah, I'm afraid unless that PEP gets done, assigning to a temporary container is the only way to avoid this extra reference. How about, make Guppy work under a tracer, but don't expect the tests to pass? I mean, people are unlikely going to hit this unless they pdb against guppy test suite.

Btw, why make _local_clear_hook_handle a attribute of the glue instead of a container as a local variable? The extra reference from the call_trampoline is only going to affect objects directly referenced by a frame as a local variable.

from guppy3.

svenil avatar svenil commented on July 18, 2024

Yes, a local container seems to be a much easier and better way to do it!
And yes, it sounds at least somewhat reasonable to not require the tests to pass when tracing is enabled, unless you need that to find out the reachable code.

svenil/guppy-pe@fefc296

from guppy3.

zhuyifei1999 avatar zhuyifei1999 commented on July 18, 2024

unless you need that to find out the reachable code.

One could use a tracer written in C to trace this. I was just messing with Python tracers ;)

I think for someone who isn't trying to mess with stuffs, pdb is probably the most likely Python tracer being used, especially that most popular and less complex tracers have a variant written in C, like cProfile vs profile.

from guppy3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.