- Issue #11450: Don't truncate hg version info in Py_GetBuildInfo() when
there are many tags (e.g. when using mq). Patch by Nadeem Vawda.
-- Issue #10451: memoryview objects could allow to mutate a readable buffer.
- Initial patch by Ross Lagerwall.
-
-- Issue #10892: Don't segfault when trying to delete __abstractmethods__ from a
- class.
+- Issue #11246: Fix PyUnicode_FromFormat("%V") to decode the byte string from
+ UTF-8 (with replace error handler) instead of ISO-8859-1 (in strict mode).
+ Patch written by Ray Allen.
-- Issue #8020: Avoid a crash where the small objects allocator would read
- non-Python managed memory while it is being modified by another thread.
- Patch by Matt Bandy.
+- Issue #11286: Raise a ValueError from calling PyMemoryView_FromBuffer with
+ a buffer struct having a NULL data pointer.
-- Issue #8278: On Windows and with a NTFS filesystem, os.stat() and os.utime()
- can now handle dates after 2038.
+- Issue #11272: On Windows, input() strips '\r' (and not only '\n'), and
+ sys.stdin uses universal newline (replace '\r\n' by '\n').
-- Issue #4236: PyModule_Create2 now checks the import machinery directly
- rather than the Py_IsInitialized flag, avoiding a Fatal Python
- error in certain circumstances when an import is done in __del__.
-
-- Issue #10596: Fix float.__mod__ to have the same behaviour as
- float.__divmod__ with respect to signed zeros. -4.0 % 4.0 should be
- 0.0, not -0.0.
+ - issue #11828: startswith and endswith don't accept None as slice index.
+ Patch by Torsten Becker.
+
+- Issue #10830: Fix PyUnicode_FromFormatV("%c") for non-BMP characters on
+ narrow build.
-- Issue #5587: add a repr to dict_proxy objects. Patch by David Stanek and
- Daniel Urban.
+- Check for NULL result in PyType_FromSpec.
-- Issue #11506: Trying to assign to a bytes literal should result in a
- SyntaxError.
+- Issue #11386: bytearray.pop() now throws IndexError when the bytearray is
+ empty, instead of OverflowError.
Library
-------
) != -1;
}
-#endif /* STRINGLIB_STR */
+#endif /* STRINGLIB_WANT_CONTAINS_OBJ */
- #if STRINGLIB_IS_UNICODE
-
/*
This function is a helper for the "find" family (find, rfind, index,
- rindex) of unicodeobject.c file, because they all have the same
- behaviour for the arguments.
+ rindex) and for count, startswith and endswith, because they all have
+ the same behaviour for the arguments.
It does not touch the variables received until it knows everything
is ok.
return 1;
}
-#ifdef FROM_UNICODE
+ #undef FORMAT_BUFFER_SIZE
+
-#endif /* FROM_UNICODE */
++#if STRINGLIB_IS_UNICODE
+
+ /*
+ Wraps stringlib_parse_args_finds() and additionally ensures that the
+ first argument is a unicode object.
+
+ Note that we receive a pointer to the pointer of the substring object,
+ so when we create that object in this function we don't DECREF it,
+ because it continues living in the caller functions (those functions,
+ after finishing using the substring, must DECREF it).
+ */
+
+ Py_LOCAL_INLINE(int)
+ stringlib_parse_args_finds_unicode(const char * function_name, PyObject *args,
+ PyUnicodeObject **substring,
+ Py_ssize_t *start, Py_ssize_t *end)
+ {
+ PyObject *tmp_substring;
+
+ if(stringlib_parse_args_finds(function_name, args, &tmp_substring,
+ start, end)) {
+ tmp_substring = PyUnicode_FromObject(tmp_substring);
+ if (!tmp_substring)
+ return 0;
+ *substring = (PyUnicodeObject *)tmp_substring;
+ return 1;
+ }
+ return 0;
+ }
+
+#endif /* STRINGLIB_IS_UNICODE */
#endif /* STRINGLIB_FIND_H */
-
-/*
-Local variables:
-c-basic-offset: 4
-indent-tabs-mode: nil
-End:
-*/
Py_ssize_t end = PY_SSIZE_T_MAX;
PyObject *result;
- if (!PyArg_ParseTuple(args, "O|O&O&:count", &substring,
- _PyEval_SliceIndex, &start, _PyEval_SliceIndex, &end))
- return NULL;
-
- substring = (PyUnicodeObject *)PyUnicode_FromObject(
- (PyObject *)substring);
- if (substring == NULL)
+ if (!stringlib_parse_args_finds_unicode("count", args, &substring,
+ &start, &end))
return NULL;
- FIX_START_END(self);
-
+ ADJUST_INDICES(start, end, self->length);
result = PyLong_FromSsize_t(
stringlib_count(self->str + start, end - start,
- substring->str, substring->length)
+ substring->str, substring->length,
+ PY_SSIZE_T_MAX)
);
Py_DECREF(substring);