Commit 9eac7e76 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Add '%r' format and some more pyconfig defines

parent 53d6a680
......@@ -38,6 +38,11 @@
#define Py_UNICODE_SIZE 4
// Copied from a CPython ./configure run on a Linux machine:
// TODO copy these more systematically
#define HAVE_WAIT3 1
#define HAVE_WAIT4 1
#define HAVE_WAITPID 1
#define HAVE_ALLOCA_H 1
#define HAVE_ASM_TYPES_H 1
#define HAVE_CURSES_H 1
......
......@@ -192,6 +192,10 @@ static Box* import(const std::string* name, bool return_first) {
return return_first ? first_module : last_module;
}
extern "C" PyObject* PyImport_ImportModuleNoBlock(const char* name) {
Py_FatalError("unimplemented");
}
// Named the same thing as the CPython method:
static void ensure_fromlist(Box* module, Box* fromlist, const std::string& module_name, bool recursive) {
if (module->getattr("__path__") == NULL) {
......
......@@ -136,7 +136,7 @@ extern "C" Box* strMod(BoxedString* lhs, Box* rhs) {
}
os << '%';
break;
} else if (c == 's') {
} else if (c == 's' || c == 'r') {
RELEASE_ASSERT(ndot == 0, "");
RELEASE_ASSERT(nzero == 0, "");
RELEASE_ASSERT(nspace == 0, "");
......@@ -148,7 +148,11 @@ extern "C" Box* strMod(BoxedString* lhs, Box* rhs) {
elt_num++;
}
BoxedString* s = str(val_to_use);
BoxedString* s;
if (c == 's')
s = str(val_to_use);
else
s = repr(val_to_use);
os << s->s;
break;
} else if (c == 'c') {
......
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