Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 37086:3b7b295cca90 legacy-trunk
Use macro versions instead of function versions when we already know the type.
This will hopefully get rid of some Coverity warnings, be a hint to
developers, and be marginally faster.
Some asserts were added when the type is currently known, but depends
on values from another function.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Mon, 20 Mar 2006 01:53:23 +0000 |
| parents | fc10ff322df1 |
| children | c844305aa8ed |
line wrap: on
line diff
--- a/Python/import.c Sun Mar 19 20:40:05 2006 +0000 +++ b/Python/import.c Mon Mar 20 01:53:23 2006 +0000 @@ -1216,12 +1216,12 @@ #endif if (!PyString_Check(v)) continue; - len = PyString_Size(v); + len = PyString_GET_SIZE(v); if (len + 2 + namelen + MAXSUFFIXSIZE >= buflen) { Py_XDECREF(copy); continue; /* Too long */ } - strcpy(buf, PyString_AsString(v)); + strcpy(buf, PyString_AS_STRING(v)); if (strlen(buf) != len) { Py_XDECREF(copy); continue; /* v contains '\0' */
