Skip to content

Python3 port #1

@arsenier

Description

@arsenier

Hey! This package looks exactly what I was looking for for my project, however I can't build it with Python3. Can you give some guidance how can I do that?

Here is the output of pip install .:

 arsenier ~/D/s/r/s/shm_manager venv master                                                                                                                    last: 0m 0s 13:11:14 
 ➜ pip install .
Processing /home/arsenier/Documents/ssl/rnd/shm/shm_manager
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: shm_manager
  Building wheel for shm_manager (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for shm_manager (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [47 lines of output]
      In file included from shm_manager.cc:1:
      shm_manager.h:228:1: warning: converting to non-pointer type ‘long int’ from NULL [-Wconversion-null]
        228 | };
            | ^
      shm_manager.h:191:5: error: invalid conversion from ‘const char*’ to ‘Py_ssize_t’ {aka ‘long int’} [-fpermissive]
        191 |     "shm_manager.shm_manager",                  /*tp_name*/
            |     ^~~~~~~~~~~~~~~~~~~~~~~~~
            |     |
            |     const char*
      shm_manager.h:194:5: error: invalid conversion from ‘destructor’ {aka ‘void (*)(_object*)’} to ‘Py_ssize_t’ {aka ‘long int’} [-fpermissive]
        194 |     (destructor)shm_manager_dealloc,            /*tp_dealloc*/
            |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            |     |
            |     destructor {aka void (*)(_object*)}
      shm_manager.h:209:24: error: invalid conversion from ‘long unsigned int’ to ‘const char*’ [-fpermissive]
        209 |     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,   /*tp_flags*/
      shm_manager.h:210:5: error: cannot convert ‘char*’ to ‘traverseproc’ {aka ‘int (*)(_object*, int (*)(_object*, void*), void*)’} in initialization
        210 |     shm_manager_doc,                            /* tp_doc */
            |     ^~~~~~~~~~~~~~~
            |     |
            |     char*
      shm_manager.cc: In function ‘PyObject* shm_manager_read(PyObject*, PyObject*)’:
      shm_manager.cc:117:10: error: ‘PyString_FromStringAndSize’ was not declared in this scope; did you mean ‘PyBytes_FromStringAndSize’?
        117 |   return PyString_FromStringAndSize(
            |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
            |          PyBytes_FromStringAndSize
      shm_manager.cc: In function ‘PyObject* shm_manager_read_pyobject(PyObject*, PyObject*)’:
      shm_manager.cc:126:21: error: ‘PyString_Type’ was not declared in this scope; did you mean ‘PySlice_Type’?
        126 |   ret -> ob_type = &PyString_Type;
            |                     ^~~~~~~~~~~~~
            |                     PySlice_Type
      shm_manager.cc: In function ‘PyObject* shm_manager_readline(PyObject*, PyObject*)’:
      shm_manager.cc:139:14: error: ‘PyString_FromStringAndSize’ was not declared in this scope; did you mean ‘PyBytes_FromStringAndSize’?
        139 |   auto ret = PyString_FromStringAndSize(_self->base_address + old_offset,
            |              ^~~~~~~~~~~~~~~~~~~~~~~~~~
            |              PyBytes_FromStringAndSize
      shm_manager.cc: In function ‘PyObject* initshm_manager()’:
      shm_manager.cc:166:9: error: return-statement with no value, in function returning ‘PyObject*’ {aka ‘_object*’} [-fpermissive]
        166 |         return;
            |         ^~~~~~
      shm_manager.cc:167:9: error: ‘Py_InitModule’ was not declared in this scope
        167 |     m = Py_InitModule("shm_manager", module_methods);
            |         ^~~~~~~~~~~~~
      shm_manager.cc:169:23: warning: control reaches end of non-void function [-Wreturn-type]
        169 |     PyModule_AddObject(m, "shm_manager", (PyObject *)&shm_managerType);
            |     ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      error: command '/usr/bin/x86_64-linux-gnu-g++' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for shm_manager
Failed to build shm_manager
ERROR: Could not build wheels for shm_manager, which is required to install pyproject.toml-based projects

Also could you add license to your project so I can use the code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions