Giter Club home page Giter Club logo

Comments (2)

dgelessus avatar dgelessus commented on September 27, 2024

Ah, my awful hack finally broke! I'm surprised it didn't happen sooner...

The relevant CPython commit appears to be python/cpython@dcaf33a, which removes the StgDict class and replaces all uses of it with regular dict objects. The extra C data previously stored in StgDicts is now stored as part of the regular dicts, using a new standard mechanism added in CPython 3.12.

Thankfully, the fields we care about are still structured almost identically as before - only the location where they are stored has changed. So as long as we can figure out the new location of the data, it should be easy to adjust the patch to work with both the old and new ways.

The way to access the new attached data is using the PyStgInfo_FromType function from _ctypes/ctypes.h. Unfortunately, that function is static inline, so we can't call it directly. Instead, ctypes_patch would have to reimplement the relevant code. Thankfully, it doesn't look too complex.

That said, this would also be a good opportunity to upstream our patch into CPython itself, so it would be properly supported and maintained. Then we could stop doing our risky runtime patching... There is already an open CPython issue for this since 2009 (python/cpython#49960, formerly known as bpo-5710), so clearly others are interested in this too. I don't remember why we didn't try upstreaming this patch earlier - though most likely there is no particular reason and just nobody had the time for it.

from rubicon-objc.

freakboy3742 avatar freakboy3742 commented on September 27, 2024

I took a quick poke after I logged this bug, and came to about the same conclusion as you have.

The upstream bug has been on my "I really should do something about that" list for a while. I agree that this would be an ideal opportunity to fix this bug upstream - finally removing this compatibility shim would be awesome.

from rubicon-objc.

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.