Git Product home page Git Product logo

Comments (7)

P403n1x87 avatar P403n1x87 commented on August 19, 2024

With

            for k in dir(stuff.modulestuff.__code__):
                if k.startswith("co_"):
                    print(k, getattr(stuff.modulestuff.__code__, k) == getattr(code, k))

we get

co_argcount True
co_cellvars True
co_code True
co_consts True
co_exceptiontable True
co_filename True
co_firstlineno True
co_flags True
co_freevars True
co_kwonlyargcount True
co_lines False
co_linetable True
co_lnotab True
co_name True
co_names True
co_nlocals True
co_positions False
co_posonlyargcount True
co_qualname True
co_stacksize True
co_varnames True

which might narrow it down to just co_lines and co_positions. These differ because are bound methods. Their return values seem to coincide too.

from bytecode.

MatthieuDartiailh avatar MatthieuDartiailh commented on August 19, 2024

Can you confirm if this is a real issue or not ?

from bytecode.

P403n1x87 avatar P403n1x87 commented on August 19, 2024

It depends on what we mean by "issue". We have round-trip tests that take a CodeType object from a function, add some extra bytecode in different order and places, then take it off, and rebuild a CodeType object. Up until CPython 3.11 we get equal CodeType objects (but not identical, because they are indeed different objects). With CPython 3.12, the equality checks fail, which is a bit of a concern. There is no evidence, however, that the new CodeType object is "functionally" different from the original.

from bytecode.

MatthieuDartiailh avatar MatthieuDartiailh commented on August 19, 2024

Ok. It is just that from the list you made in your previous comment the code object did look equal and that got me confused. I guess one would have to check the implementation of __eq__ on CodeType to know why it changed between 3.11 and 3.12.

from bytecode.

MatthieuDartiailh avatar MatthieuDartiailh commented on August 19, 2024

@P403n1x87 is this still an actual issue ?

from bytecode.

MatthieuDartiailh avatar MatthieuDartiailh commented on August 19, 2024

ping @P403n1x87

from bytecode.

P403n1x87 avatar P403n1x87 commented on August 19, 2024

Sorry for the late reply. Because I have disabled the "round-trip" tests I don't know if the issue has been solved. I don't think I'll be able to look back at this any time soon unfortunately 🙁 .

from bytecode.

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.