Commit 61a7ab64 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Get cffi-1.7 building

parent 2a4e46ea
...@@ -20,12 +20,13 @@ typedef struct _is { ...@@ -20,12 +20,13 @@ typedef struct _is {
struct _is *next; struct _is *next;
struct _ts *tstate_head; struct _ts *tstate_head;
PyObject *modules;
PyObject *builtins;
// Pyston change // Pyston change
// Note: any changes here need to show up in PyInterpreterState_Clear as well // Note: any changes here need to show up in PyInterpreterState_Clear as well
#if 0 #if 0
PyObject *modules;
PyObject *sysdict; PyObject *sysdict;
PyObject *builtins;
PyObject *modules_reloading; PyObject *modules_reloading;
PyObject *codec_search_path; PyObject *codec_search_path;
......
...@@ -62,7 +62,7 @@ static PyThread_type_lock head_mutex = NULL; /* Protects interp->tstate_head */ ...@@ -62,7 +62,7 @@ static PyThread_type_lock head_mutex = NULL; /* Protects interp->tstate_head */
#define HEAD_UNLOCK() /* Nothing */ #define HEAD_UNLOCK() /* Nothing */
#endif #endif
PyInterpreterState interpreter_state; static PyInterpreterState interpreter_state;
std::unordered_set<PerThreadSetBase*> PerThreadSetBase::all_instances; std::unordered_set<PerThreadSetBase*> PerThreadSetBase::all_instances;
...@@ -509,10 +509,14 @@ extern "C" void PyInterpreterState_Clear(PyInterpreterState* interp) noexcept { ...@@ -509,10 +509,14 @@ extern "C" void PyInterpreterState_Clear(PyInterpreterState* interp) noexcept {
// Py_CLEAR(interp->codec_search_path); // Py_CLEAR(interp->codec_search_path);
// Py_CLEAR(interp->codec_search_cache); // Py_CLEAR(interp->codec_search_cache);
// Py_CLEAR(interp->codec_error_registry); // Py_CLEAR(interp->codec_error_registry);
// Py_CLEAR(interp->modules); Py_CLEAR(interp->modules);
// Py_CLEAR(interp->modules_reloading); // Py_CLEAR(interp->modules_reloading);
// Py_CLEAR(interp->sysdict); // Py_CLEAR(interp->sysdict);
// Py_CLEAR(interp->builtins); Py_CLEAR(interp->builtins);
}
extern "C" void PyThreadState_DeleteCurrent() noexcept {
Py_FatalError("unimplemented");
} }
extern "C" void PyThreadState_Clear(PyThreadState* tstate) noexcept { extern "C" void PyThreadState_Clear(PyThreadState* tstate) noexcept {
......
...@@ -2376,6 +2376,7 @@ void setupBuiltins() { ...@@ -2376,6 +2376,7 @@ void setupBuiltins() {
builtins_module = createModule(autoDecref(boxString("__builtin__")), NULL, builtins_module = createModule(autoDecref(boxString("__builtin__")), NULL,
"Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is " "Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is "
"the `nil' object; Ellipsis represents `...' in slices."); "the `nil' object; Ellipsis represents `...' in slices.");
PyThreadState_GET()->interp->builtins = incref(builtins_module->getAttrWrapper());
ellipsis_cls ellipsis_cls
= BoxedClass::create(type_cls, object_cls, 0, 0, sizeof(Box), false, "ellipsis", false, NULL, NULL, false); = BoxedClass::create(type_cls, object_cls, 0, 0, sizeof(Box), false, "ellipsis", false, NULL, NULL, false);
......
...@@ -795,6 +795,8 @@ static int _check_and_flush(FILE* stream) { ...@@ -795,6 +795,8 @@ static int _check_and_flush(FILE* stream) {
void setupSys() { void setupSys() {
sys_modules_dict = new BoxedDict(); sys_modules_dict = new BoxedDict();
PyThreadState_GET()->interp->modules = incref(sys_modules_dict);
constants.push_back(sys_modules_dict); constants.push_back(sys_modules_dict);
// This is ok to call here because we've already created the sys_modules_dict // This is ok to call here because we've already created the sys_modules_dict
......
...@@ -139,8 +139,9 @@ extern "C" Box* import(int level, Box* from_imports, llvm::StringRef module_name ...@@ -139,8 +139,9 @@ extern "C" Box* import(int level, Box* from_imports, llvm::StringRef module_name
BoxedModule* importCExtension(BoxedString* full_name, const std::string& last_name, const std::string& path) { BoxedModule* importCExtension(BoxedString* full_name, const std::string& last_name, const std::string& path) {
void* handle = dlopen(path.c_str(), RTLD_NOW); void* handle = dlopen(path.c_str(), RTLD_NOW);
if (!handle) { if (!handle) {
const char* s = dlerror();
// raiseExcHelper(ImportError, "%s", dlerror()); // raiseExcHelper(ImportError, "%s", dlerror());
fprintf(stderr, "%s\n", dlerror()); fprintf(stderr, "%s\n", s);
exit(1); exit(1);
} }
assert(handle); assert(handle);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment