port to PDOS (especially mainframe)
Paul Edwards
mutazilah at gmail.com
Wed Apr 14 06:35:45 EDT 2021
I have succeeded in producing a Python 3.3 executable
despite being built with a C library that only supports
C90. I had to provide my own mini-posix wrappers that
convert open() into fopen() etc.
With that in place, plus a compiler where char = wchar_t,
there were not a lot of changes required to the Python
mainline (see below).
However, the executable doesn't work yet. Here's the
current state:
C:\devel\python\Modules>python
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1755, in _install
File "<frozen importlib._bootstrap>", line 1726, in _setup
ImportError: importlib requires posix or nt
Fatal Python error: Py_Initialize: importlib install failed
Current thread 0x00000000:
That error message comes from here:
C:\devel\python\Python>head importlib.h
which is not human readable.
It is generated by this code:
C:\devel\python\Lib\importlib>grep "posix or nt" _bootstrap.py
but I don't know what it needs to satisfy that.
It's a bit strange that it can only be posix or nt when VMS is supported in 3.3 too.
BFN. Paul.
Index: Modules/main.c
===================================================================
RCS file: c:\cvsroot/python/Modules/main.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -r1.1.1.1 -r1.2
728a729
> #ifndef PUREISO
738a740
> #endif
Index: Modules/signalmodule.c
===================================================================
RCS file: c:\cvsroot/python/Modules/signalmodule.c,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -r1.1.1.1 -r1.3
418a419
> #ifndef PUREISO
419a421
> #endif
429a432
> #ifndef PUREISO
433a437
> #endif
Index: Objects/longobject.c
===================================================================
RCS file: c:\cvsroot/python/Objects/longobject.c,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -r1.1.1.1 -r1.3
939,944d938
< #ifndef HAVE_LONG_LONG
< # error "PyLong_FromVoidPtr: sizeof(void*) > sizeof(long), but no long long"
< #endif
< #if SIZEOF_LONG_LONG < SIZEOF_VOID_P
< # error "PyLong_FromVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)"
< #endif
948c942,944
< return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)(Py_uintptr_t)p);
---
> #if SIZEOF_VOID_P <= SIZEOF_LONG
> return PyLong_FromUnsignedLong((unsigned long)(Py_uintptr_t)p);
> #else
949a946,950
> #if SIZEOF_LONG_LONG < SIZEOF_VOID_P
> # error "PyLong_FromVoidPtr: sizeof(long long) < sizeof(void*)"
> #endif
> return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)(Py_uintptr_t)p);
> #endif /* SIZEOF_VOID_P <= SIZEOF_LONG */
986c987
< #ifdef HAVE_LONG_LONG
---
> #if 1 /*def HAVE_LONG_LONG */
996a998
> #ifdef HAVE_LONG_LONG
1037a1040
> #endif
1040a1044
> #ifdef HAVE_LONG_LONG
1066a1071
> #endif
1139a1145
> #ifdef HAVE_LONG_LONG
1187a1194
> #endif
1191a1199
> #ifdef HAVE_LONG_LONG
1223a1232
> #endif
1227a1237
> #ifdef HAVE_LONG_LONG
1256a1267
> #endif
1257a1269
> #ifdef HAVE_LONG_LONG
1291a1304
> #endif
1303a1317
> #ifdef HAVE_LONG_LONG
1389a1404
> #endif
Index: Objects/unicodeobject.c
===================================================================
RCS file: c:\cvsroot/python/Objects/unicodeobject.c,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -r1.1.1.1 -r1.3
2243c2243
< #ifdef HAVE_WCHAR_H
---
> #if defined(HAVE_WCHAR_H) || defined(PUREISO)
2865c2865
< #ifdef HAVE_WCHAR_H
---
> #if defined(HAVE_WCHAR_H) || defined(PUREISO)
9148c9148
< // TODO: honor direction and do a forward or backwards search
---
> /*TODO: honor direction and do a forward or backwards search */
Index: Parser/tokenizer.c
===================================================================
RCS file: c:\cvsroot/python/Parser/tokenizer.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -r1.1.1.1 -r1.2
1720a1721,1723
> #ifdef PUREISO
> return (NULL);
> #else
1758a1762
> #endif /* PUREISO */
Index: Python/fileutils.c
===================================================================
RCS file: c:\cvsroot/python/Python/fileutils.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -r1.1.1.1 -r1.2
40c40
< #ifdef HAVE_STAT
---
> #if 1 /* def HAVE_STAT */
279a280
> #ifdef HAVE_STAT
304a306
> #endif
Index: Python/getopt.c
===================================================================
RCS file: c:\cvsroot/python/Python/getopt.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -r1.1.1.1 -r1.2
33c33,35
< #include <wchar.h>
---
> #ifdef HAVE_WCHAR_H
> # include <wchar.h>
> #endif
Index: Python/pythonrun.c
===================================================================
RCS file: c:\cvsroot/python/Python/pythonrun.c,v
retrieving revision 1.1.1.1
retrieving revision 1.5
diff -r1.1.1.1 -r1.5
300a301,304
> /* Init Unicode implementation; relies on the codec registry */
> if (_PyUnicode_Init() < 0)
> Py_FatalError("Py_Initialize: can't initialize unicode");
>
318,321d321
< /* Init Unicode implementation; relies on the codec registry */
< if (_PyUnicode_Init() < 0)
< Py_FatalError("Py_Initialize: can't initialize unicode");
<
1009a1010
> #ifndef PUREISO
1021a1023
> #endif
1075a1078
> #ifndef PUREISO
1140a1144
> #endif /* PUREISO */
Index: Python/random.c
===================================================================
RCS file: c:\cvsroot/python/Python/random.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -r1.1.1.1 -r1.2
4c4
< #else
---
> #elif defined(HAVE_FCNTL_H)
119c119
< #if !defined(MS_WINDOWS) && !defined(__VMS)
---
> #if !defined(MS_WINDOWS) && !defined(__VMS) && !defined(PUREISO)
239a240,241
> #elif defined(PUREISO)
> return(-1);
287a290,291
> #elif defined(PUREISO)
> return;
Index: Python/sysmodule.c
===================================================================
RCS file: c:\cvsroot/python/Python/sysmodule.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -r1.1.1.1 -r1.2
1581c1581
< #if !defined(MS_WINDOWS)
---
> #if !defined(MS_WINDOWS) && !defined(PUREISO)
More information about the Python-list
mailing list