◐ Shell
clean mode source ↗

Message 66162 - Python tracker

Marc-Andre Lemburg wrote:
[SNIP]
> The above cast needs to be (Py_ssize_t). size_t is an unsigned length
type.

Actually, the cast is right (even though it is not strictly necessary).
  It just the patch that is confusing. Here is the relevant code:  

	/* Normal module, so work out the package name if any */
	char *start = PyUnicode_AsString(modname);
	char *lastdot = strrchr(start, '.');
	size_t len;
	int error;
/* snip */
	len = (size_t)(lastdot - start);
	if (len >= MAXPATHLEN) {
		PyErr_SetString(PyExc_ValueError,
				"Module name too long");
		return NULL;
	}

I removed the cast from the patch (I don't know why I added it, anyway)
to avoid further confusion.