Commit 79dc30d1 authored by Kevin Modzelewski's avatar Kevin Modzelewski

The _sre module now compiles and links (but doesn't run yet)

parent 88c308f5
......@@ -268,7 +268,7 @@ SRCS := $(MAIN_SRCS) $(STDLIB_SRCS)
STDLIB_OBJS := stdlib.bc.o stdlib.stripped.bc.o
STDLIB_RELEASE_OBJS := stdlib.release.bc.o
STDMODULE_SRCS := errnomodule.c shamodule.c sha256module.c sha512module.c md5.c md5module.c $(EXTRA_STDMODULE_SRCS)
STDMODULE_SRCS := errnomodule.c shamodule.c sha256module.c sha512module.c md5.c md5module.c _sre.c $(EXTRA_STDMODULE_SRCS)
FROM_CPYTHON_SRCS := $(addprefix ../lib_python/2.7_Modules/,$(STDMODULE_SRCS)) $(wildcard capi/*.c)
# The stdlib objects have slightly longer dependency chains,
......
// Copyright (c) 2014 Dropbox, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <cmath>
#include "core/types.h"
#include "gc/collector.h"
#include "runtime/inline/boxing.h"
#include "runtime/types.h"
#include "runtime/util.h"
namespace pyston {
BoxedModule* sre_module;
void setupSre() {
sre_module = createModule("_sre", "__builtin__");
sre_module->giveAttr("MAGIC", boxInt(20031017));
sre_module->giveAttr("CODESIZE", boxInt(4));
}
}
......@@ -365,6 +365,25 @@ extern "C" void PyObject_ClearWeakRefs(PyObject* object) {
}
extern "C" PyObject* PySequence_GetItem(PyObject* o, Py_ssize_t i) {
try {
// Not sure if this is really the same:
return getitem(o, boxInt(i));
} catch (Box* b) {
abort();
}
}
extern "C" PyObject* PySequence_GetSlice(PyObject* o, Py_ssize_t i1, Py_ssize_t i2) {
try {
// Not sure if this is really the same:
return getitem(o, new BoxedSlice(boxInt(i1), boxInt(i2), None));
} catch (Box* b) {
abort();
}
}
extern "C" int PyCallable_Check(PyObject* x) {
if (x == NULL)
return 0;
......@@ -419,6 +438,7 @@ extern "C" int PyErr_WarnEx(PyObject* category, const char* text, Py_ssize_t sta
abort();
}
extern "C" PyObject* PyImport_Import(PyObject* module_name) {
RELEASE_ASSERT(module_name, "");
RELEASE_ASSERT(module_name->cls == str_cls, "");
......@@ -430,6 +450,12 @@ extern "C" PyObject* PyImport_Import(PyObject* module_name) {
}
}
extern "C" PyObject* PyCallIter_New(PyObject* callable, PyObject* sentinel) {
abort();
}
BoxedModule* importTestExtension() {
const char* pathname = "../test/test_extension/test.so";
void* handle = dlopen(pathname, RTLD_NOW);
......
......@@ -36,6 +36,7 @@ extern "C" void init_sha();
extern "C" void init_sha256();
extern "C" void init_sha512();
extern "C" void init_md5();
extern "C" void init_sre();
namespace pyston {
......@@ -758,7 +759,6 @@ void setupRuntime() {
setupTime();
setupThread();
setupPosix();
setupSre();
setupCAPI();
......@@ -767,6 +767,7 @@ void setupRuntime() {
init_sha256();
init_sha512();
init_md5();
// init_sre();
setupSysEnd();
......
......@@ -66,7 +66,6 @@ void setupMath();
void setupTime();
void setupThread();
void setupPosix();
void setupSre();
void setupSysEnd();
BoxedDict* getSysModulesDict();
......
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