Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8818527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:07:43+00:00 2026-06-14T05:07:43+00:00

I have read ( here ) that PyPy has support for CPython extension modules

  • 0

I have read (here) that PyPy has support for CPython extension modules via cpyext.

I haven’t found any cpyext documentation. Is there any?

How do I use it?

From the source code (e.g. here), I figured out that to load my leveldb.so module, I probably have to do this:

import cpyext
cpyext.load_module("leveldb.so","leveldb")

However, this crashes with this error:

Fatal Python error: PyThreadState_Get: no current thread

I noticed in the backtrace that it calls the functions from my CPython, not from PyPy:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff8b3e4d46 __kill + 10
1   libsystem_c.dylib               0x00007fff927a9df0 abort + 177
2   org.python.python               0x0000000104692eaa Py_FatalError + 49
3   org.python.python               0x0000000104691370 PyThreadState_Get + 28
4   org.python.python               0x000000010468cf16 Py_InitModule4_64 + 58
5   leveldb.so                      0x00000001027e0881 initleveldb + 49 (leveldb_ext.cc:59)
6   pypy                            0x0000000100f59bb3 PyLong_CheckExact + 55379
7   pypy                            0x0000000100f6e7c7 PyLong_CheckExact + 140391
....
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:07:45+00:00Added an answer on June 14, 2026 at 5:07 am

    I figured it out.

    It is necessary to recompile the module. I must use the header files from PyPy. For linking, I must not link against libpython. I must just tell the linker to ignore about unresolved symbols.

    This where my commands to build py-leveldb on MacOSX:

    cc -I /usr/local/Cellar/pypy/1.9/include -g -c leveldb_ext.cc leveldb_object.cc
    libtool -dynamic -o leveldb.so leveldb_ext.o leveldb_object.o -lleveldb -lsnappy -lc -lstdc++ -undefined dynamic_lookup
    

    That worked. I just did cpyext.load_module("leveldb.so","leveldb").

    I also found some more notes about CPyExt in their wiki here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read here that any ASP.NET validator has a property called: isvalid .
I have read so many times, here and everywhere on the net, that mutexes
I have an XML file that I'm trying to read from here , and
I have read here -- without understanding much -- that it's bad to use
I have read here* that ontologies (RDF's in nature) are data-driven because one can
I am having a problem with my Listbox not updating/refresing.I have read here that
I read here that when sending an image for print it can have multiple
I have read in a several places (e.g. here ) that I can use
I have read the various questions/answers here that basically indicate that having a clustered
I have read many other posts on here that state the same issue and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.