STINNER Victor <[email protected]> added the comment:
Extract of memoryview pack_signal() function:
#define PACK_SINGLE(ptr, src, type) \
do { \
type x; \
x = (type)src; \
memcpy(ptr, (char *)&x, sizeof x); \
} while (0)
/* floats */
case 'f': case 'd':
d = PyFloat_AsDouble(item);
if (d == -1.0 && PyErr_Occurred())
goto err_occurred;
if (fmt[0] == 'f') {
PACK_SINGLE(ptr, d, float); // ##### BUG IS HERE ###
}
else {
PACK_SINGLE(ptr, d, double);
}
break;
Pseudo-code:
double d = PyFloat_AsDouble(item);
float x;
x = (float)d;
memcpy(ptr, (char *)&x, sizeo x);
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35752>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com