Python

Python

Python

 View Only
  • 1.  z/OS Compiling C program to use python

    Posted Thu December 23, 2021 12:02 PM

    I'm looking to port a python project to z/OS.
    I'm compiling it in Unix Services using  V2.4 z/OS XL C 
    and I'm getting compile errors 

    ERROR CCN3221 /u/tmp/python/usr/lpp/IBM/cyp/v3r10/pyz/include/python3.10/cpython/abstract.h:201 Initializer must be a valid constant expression. 
    ERROR CCN3221 /u/tmp/python/usr/lpp/IBM/cyp/v3r10/pyz/include/python3.10/cpython/abstract.h:201 Initializer must be a valid constant expression. 
    static inline PyObject *
    PyObject_CallMethodOneArg(PyObject *self, PyObject *name, PyObject *arg)
    {
    PyObject *args[2] = {self, arg};
    ...

    If I use
    PyObject *args[2] ;
    args[0] = self;
    args[1] = arg ; 

    __________

    Also the compiler does not like the "inline" - but I can #define this to blank.

    Are there some special compiler options I need to use?

    Colin Paice 



    ------------------------------
    Colin Paice
    ------------------------------


  • 2.  RE: z/OS Compiling C program to use python

    Posted Mon December 27, 2021 09:09 AM
    Hi Colin,

    Would you be able to post the full xlc command that is being used to generate that error?

    Thanks,

    Steven

    ------------------------------
    Steven Pitman
    ------------------------------



  • 3.  RE: z/OS Compiling C program to use python

    Posted Mon January 03, 2022 09:42 AM
    Hi Steven,

    I fixed the problem...  Once I changed to using setup.py it worked.
    The problem was the LANGLVL.  It defaulted to c89 - which did not allow declarations in the logic section.
    regards
    Colin

    ------------------------------
    Colin Paice
    ------------------------------