summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2009-06-04 00:43:04 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2009-06-04 00:43:04 (GMT)
commit394996b519af11284f2e4905f28c4a2a677214cf (patch)
treec930eb19f83c7962fdab804bdc7f5fd0ef1f0c5e /Objects
parentd76b9f18d1d094120faba5bde5aa7b937c3f3f2c (diff)
downloadcpython-394996b519af11284f2e4905f28c4a2a677214cf.zip
cpython-394996b519af11284f2e4905f28c4a2a677214cf.tar.gz
cpython-394996b519af11284f2e4905f28c4a2a677214cf.tar.bz2
Issue #5373: Remove restriction on null bytes in docstrings of classes.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 0035f6d..0e79542 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2178,17 +2178,13 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
char *doc_str;
char *tp_doc;
- doc_str = _PyUnicode_AsStringAndSize(doc, &len);
+ doc_str = _PyUnicode_AsString(doc);
if (doc_str == NULL) {
Py_DECREF(type);
return NULL;
}
- if ((Py_ssize_t)strlen(doc_str) != len) {
- PyErr_SetString(PyExc_TypeError,
- "__doc__ contains null-bytes");
- Py_DECREF(type);
- return NULL;
- }
+ /* Silently truncate the docstring if it contains null bytes. */
+ len = strlen(doc_str);
tp_doc = (char *)PyObject_MALLOC(len + 1);
if (tp_doc == NULL) {
Py_DECREF(type);