Permalink
Browse files

Remove unicodeobject.c and family from the OVM build!

This was easy because Python already has a Py_USING_UNICODE #define.

And it worked!  The only issue is that come modules like posixpath have
unicode constants.  So I added a hack in marshal.c to urn unicode
constants into string constants.

All spec tests pass.
  • Loading branch information...
Andy Chu
Andy Chu committed Jul 12, 2018
1 parent 2a785a7 commit f3484d80cc698735d987397d1a9be255fe3c1fe1
Showing with 7 additions and 12 deletions.
  1. +1 −0 Python-2.7.13/Modules/main.c
  2. +6 −0 Python-2.7.13/Python/marshal.c
  3. +0 −9 Python-2.7.13/pyconfig.h
  4. +0 −3 build/compile.sh
@@ -175,6 +175,7 @@ static int RunModule(char *module, int set_argv0)
runpy = PyImport_ImportModule("runpy");
if (runpy == NULL) {
fprintf(stderr, "Could not import runpy module\n");
PyErr_Print();
return -1;
}
runmodule = PyObject_GetAttrString(runpy, "_run_module_as_main");
@@ -805,6 +805,12 @@ r_object(RFILE *p)
case TYPE_INTERNED:
case TYPE_STRING:
#ifdef OVM_MAIN
/* Treat unicode constants like string constants. They are already
* utf-8 encoded. TODO: change the output of the OPy compiler
* and turn this into an exception. */
case TYPE_UNICODE:
#endif
n = r_long(p);
if (n < 0 || n > SIZE32_MAX) {
PyErr_SetString(PyExc_ValueError, "bad marshal data (string size out of range)");
View
@@ -912,21 +912,12 @@
/* Define to printf format modifier for Py_ssize_t */
#define PY_FORMAT_SIZE_T "z"
/* Define as the integral type used for Unicode representation. */
#define PY_UNICODE_TYPE unsigned short
/* Define if you want to build an interpreter with many run-time checks. */
/* #undef Py_DEBUG */
/* Defined if Python is built as a shared library. */
/* #undef Py_ENABLE_SHARED */
/* Define as the size of the unicode type. */
#define Py_UNICODE_SIZE 2
/* Define if you want to have a Unicode type. */
#define Py_USING_UNICODE 0
/* assume C89 semantics that RETSIGTYPE is always void */
#define RETSIGTYPE void
View
@@ -40,7 +40,6 @@ Python/getopt.c
Python/pystrcmp.c
Python/pystrtod.c
Python/dtoa.c
Python/formatter_unicode.c
Python/formatter_string.c
'
@@ -81,8 +80,6 @@ Objects/structseq.c
Objects/tupleobject.c
Objects/typeobject.c
Objects/weakrefobject.c
Objects/unicodeobject.c
Objects/unicodectype.c
'
# Non-standard lib stuff.

0 comments on commit f3484d8

Please sign in to comment.