Skip to content

Broken conversion char* -> std::string #2132

@jdemeyer

Description

@jdemeyer

Cython-0.28b1 miscompiles

from libcpp.string cimport string

cdef extern:
    void foo(string&)

foo("hello")

The call foo("hello") becomes

foo(((std::string &)"hello"));

In Cython-0.27.3, this was instead compiled to

  __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_hello); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 6, __pyx_L1_error)
  foo(__pyx_t_1);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions