Dear Maintainer,
this can be reproduced in current Bookworm/testing too.

The backtrace below shows PyBytes_FromString received for
parameter str a NULL, which documentation states must not be NULL [1].

Unfortunately could not find an issue or update in upstream page [2].

Kind regards,
Bernhard



[1] https://docs.python.org/3/c-api/bytes.html
[2] https://github.com/facebookincubator/pystemd


$ cat test.py
from pystemd.dbuslib import DBus
bus=DBus(user_mode=True)
bus.get_unique_name()
$


$ python3 test.py
pystemd.dbusexc.DBusBaseError: [err -22]: Failed to get unique name
This is DBusBaseError, a base error for DBus (i bet you did not see that 
coming) if you need a special error, enhance pystemd.sysdexc module!.
Exception ignored in: 'pystemd.dbuslib.DBus.get_unique_name'
Traceback (most recent call last):
  File "/home/benutzer/test.py", line 3, in <module>
    bus.get_unique_name()
pystemd.dbusexc.DBusBaseError: [err -22]: Failed to get unique name
This is DBusBaseError, a base error for DBus (i bet you did not see that 
coming) if you need a special error, enhance pystemd.sysdexc module!.
Speicherzugriffsfehler (Speicherabzug geschrieben)
$


# coredumpctl gdb 1246
(gdb) bt
#0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:76
#1  0x000000000059f40c in PyBytes_FromString (str=0x0) at 
../Objects/bytesobject.c:153
#2  0x00007f360fb7b6a6 in __pyx_pf_7pystemd_7dbuslib_4DBus_20get_unique_name 
(__pyx_v_self=<optimized out>) at pystemd/dbuslib.c:10541
#3  __pyx_pw_7pystemd_7dbuslib_4DBus_21get_unique_name (__pyx_v_self=<optimized out>, 
unused=<optimized out>) at pystemd/dbuslib.c:10525
#4  0x000000000055a850 in method_vectorcall_NOARGS (func=<method_descriptor at remote 
0x7f360fbc3ba0>, args=0x7f3610512070, nargsf=<optimized out>, kwnames=0x0) at 
../Objects/descrobject.c:453
#5  0x000000000053983c in _PyObject_VectorcallTstate (kwnames=<optimized out>, nargsf=<optimized 
out>, args=<optimized out>, callable=<method_descriptor at remote 0x7f360fbc3ba0>, 
tstate=0xa85258 <_PyRuntime+166328>) at ../Include/internal/pycore_call.h:92
#6  PyObject_Vectorcall (callable=<method_descriptor at remote 0x7f360fbc3ba0>, 
args=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at 
../Objects/call.c:299
...
(gdb) py-bt
Traceback (most recent call first):
  File "/home/benutzer/test.py", line 3, in <module>
    bus.get_unique_name()
(gdb)


$ cat -n pystemd/dbuslib.c | grep 10541 -C10
 10531
 10532  static PyObject 
*__pyx_pf_7pystemd_7dbuslib_4DBus_20get_unique_name(struct 
__pyx_obj_7pystemd_7dbuslib_DBus *__pyx_v_self) {
 10533    PyObject *__pyx_r = NULL;
 10534    __Pyx_RefNannyDeclarations
 10535    PyObject *__pyx_t_1 = NULL;
 10536    int __pyx_lineno = 0;
 10537    const char *__pyx_filename = NULL;
 10538    int __pyx_clineno = 0;
 10539    __Pyx_RefNannySetupContext("get_unique_name", 0);
 10540    __Pyx_XDECREF(__pyx_r);
 10541    __pyx_t_1 = 
__Pyx_PyBytes_FromString(__pyx_f_7pystemd_7dbuslib_4DBus_get_unique_name(__pyx_v_self,
 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error)
 10542    __Pyx_GOTREF(__pyx_t_1);
 10543    __pyx_r = __pyx_t_1;
 10544    __pyx_t_1 = 0;
 10545    goto __pyx_L0;
 10546
 10547    /* function exit code */
...
$


$ cat -n pystemd/dbuslib.pyx | grep 536 -C10
   526      cpdef const char* get_unique_name(self):
   527          cdef:
   528              int r
   529              const char *unique_name
   530
   531          r = dbusc.sd_bus_get_unique_name(self.bus, &unique_name)
   532
   533          if r < 0:
   534              raise DBusError(r, None, "Failed to get unique name")
   535
   536          return unique_name
   537
   538      cpdef int get_fd(self):
...
$

Reply via email to