[issue6697] Check that _PyUnicode_AsString() result is not NULL

2011-06-20 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset b87eac0369b5 by Victor Stinner in branch 'default': Issue #6697: _lsprof: normalizeUserObj() doesn't encode/decode (UTF-8) the http://hg.python.org/cpython/rev/b87eac0369b5 -- nosy: +python-dev

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2011-06-20 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: I wrote a similar patch to add PyModule_GetNameObject() (I am working on another huge patch, to fix #3080) Issue #3080 added the PyModule_GetNameObject() function, so it simplify your patch. I commited your

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2011-06-20 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6697 ___

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2011-06-12 Thread Terry J. Reedy
Changes by Terry J. Reedy tjre...@udel.edu: -- versions: +Python 3.3 -Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6697 ___ ___

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2011-01-13 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: I am replacing issue6697-lsprof.diff with a (hopefully) more carefully written version that addresses the issues that Victor noted. Victor, I take your comment as +1 for adding PyModule_GetNameObject(). I started

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2011-01-13 Thread Alexander Belopolsky
Changes by Alexander Belopolsky belopol...@users.sourceforge.net: Removed file: http://bugs.python.org/file19980/issue6697-lsprof.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6697 ___

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2011-01-13 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Le jeudi 13 janvier 2011 à 23:05 +, Alexander Belopolsky a écrit : I take your comment as +1 for adding PyModule_GetNameObject(). I wrote a similar patch to add PyModule_GetNameObject() (I am working on another huge patch, to

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-12-10 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: issue6697-lsprof.diff: - Oh, I did recently a similar change on PyModule: I created PyModule_GetFilenameObject() - PyObject * mod = PyObject *mod - modname is not initialized if fn-m_module (mod) is NULL = initialize modname to

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-12-08 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: Committed revision 87137. Needs backporting. Also as Victor suggested, _lsprof.c code can be refactored to avoid roundtrips of unicode through utf8 char*. -- ___ Python

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-12-08 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: I am attaching an untested rewrite of normalizeUserObj() in _lsprof.c for comments on whether it is worth the effort. There might be other places where PyModule_GetName() can be profitably replaced with

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-12-07 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: I am attaching a revised version of the patch which also includes some tests. Interestingly, the issue in syslog module is a regression from 3.1 introduced in r80401. Although it is not a crasher, I don't think it was

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-12-07 Thread Alexander Belopolsky
Changes by Alexander Belopolsky belopol...@users.sourceforge.net: Added file: http://bugs.python.org/file19970/issue6697a.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6697 ___

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-12-07 Thread Marc-Andre Lemburg
Marc-Andre Lemburg m...@egenix.com added the comment: Alexander Belopolsky wrote: Alexander Belopolsky belopol...@users.sourceforge.net added the comment: I am attaching a revised version of the patch which also includes some tests. Interestingly, the issue in syslog module is a

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-12-07 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: On Tue, Dec 7, 2010 at 12:44 PM, Marc-Andre Lemburg rep...@bugs.python.org wrote: .. * Rather than just patching in error handling code, please consider removing use of those APIs and replace their calls with something

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-12-07 Thread Marc-Andre Lemburg
Marc-Andre Lemburg m...@egenix.com added the comment: Alexander Belopolsky wrote: Alexander Belopolsky belopol...@users.sourceforge.net added the comment: On Tue, Dec 7, 2010 at 12:44 PM, Marc-Andre Lemburg rep...@bugs.python.org wrote: .. * Rather than just patching in error handling

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-12-07 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: On Tue, Dec 7, 2010 at 1:11 PM, Marc-Andre Lemburg rep...@bugs.python.org wrote:  I am not sure what you mean by a parser API. PyArg_Parse() et al. See the discussion earlier on this ticket. I've just realized that.

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-12-07 Thread Marc-Andre Lemburg
Marc-Andre Lemburg m...@egenix.com added the comment: Alexander Belopolsky wrote: Alexander Belopolsky belopol...@users.sourceforge.net added the comment: On Tue, Dec 7, 2010 at 1:11 PM, Marc-Andre Lemburg rep...@bugs.python.org wrote: I am not sure what you mean by a parser API.

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-12-07 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: issue6697b.diff addresses Marc's comments. Thanks for the review. -- stage: patch review - commit review Added file: http://bugs.python.org/file19972/issue6697b.diff ___ Python

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-12-06 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: What is the status of this issue? A grep for _PyUnicode_AsString quickly revealed a crash: from xml.etree.cElementTree import * e = Element('a') getattr(e, '\uD800') Segmentation fault I don't think this is the only

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-12-06 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: Another crash: from datetime import * datetime.now(timezone(timedelta(0), '\uD800')).strftime('%Z') Segmentation fault -- ___ Python tracker rep...@bugs.python.org

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-12-06 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: One of the uses of problematic uses of PyUnicode_GetSize() is in Macintosh Gestalt interface: /* Convert a 4-char string object argument to an OSType value */ static int convert_to_OSType(PyObject *v, OSType *pr) {

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-12-06 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: I am attaching a patch that fixes several instances of unchecked _PyUnicode_AsString() result. Not all fixes are completely trivial, so I would appreciate a review. I did not attempt to fix Modules/_gestalt.c because I

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-05-19 Thread Arfrever Frehtes Taifersar Arahesis
Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com added the comment: r81319 fixed 4 calls in pythonrun.c. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6697 ___

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-05-18 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: r81314 fixes 2 calls in _PyModule_Clear(). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6697 ___

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-05-18 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: r81320 fixes a call in vgetargskeywords() (PyArg_ParseTupleAndKeywords). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6697

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-05-18 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: r81321 fixes 2 calls in builtin_input() (if sys.stdin or sys.stdout encoding contain a surrogate: this is *very* unlikely :-)). -- ___ Python tracker rep...@bugs.python.org

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-05-18 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: r81322 fixes 2 calls in textio.c. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6697 ___

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-05-18 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: r81323 fixes 4 calls in _sqlite. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6697 ___

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-05-18 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: r81324 fixes 2 calls in typeobject.c -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6697 ___

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-05-18 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: Removed file: http://bugs.python.org/file16461/pythonrun-py3k.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6697 ___

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-05-18 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Remove pyunicode_asstringordefault.patch and pythonrun-py3k.patch because the new _PyUnicode_AsStringOrDefault() function was rejected (and it's easy to avoid it). -- ___ Python tracker

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-05-18 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: Removed file: http://bugs.python.org/file16458/pyunicode_asstringordefault.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6697 ___

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-05-16 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: Removed file: http://bugs.python.org/file16442/object_pyunicode_asstring-py3k.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6697 ___

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-05-16 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@haypocalc.com: Removed file: http://bugs.python.org/file16502/unicode_fromformat_U.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6697 ___

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-05-16 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: pymain.patch commited as r81250. Wait for the buildbot before backporting it to 3.1. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6697

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-03-21 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: I commited unicode_fromformat_U.patch as r78875. object_pyunicode_asstring-py3k.patch commited as r78876. Backported as r79240 and r79241 to 3.1. -- ___ Python tracker

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-03-12 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: I commited unicode_fromformat_U.patch as r78875. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6697 ___

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-03-12 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Oh, my ssl_rand_egd_unicode-py3k.patch is complelty broken! It writes a pointer to an object into the char* path variable :-/ -- ___ Python tracker rep...@bugs.python.org

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-03-12 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: object_pyunicode_asstring-py3k.patch commited as r78876. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6697 ___

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-03-08 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: See also issue #8092. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6697 ___ ___

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-03-08 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: unicode_fromformat_U.patch: replace PyUnicode_FromFormat(..%s..., ..., _PyUnicode_AsString(obj)) by PyUnicode_FromFormat(...%U..., ..., obj). It replaces also %.200s by %U, so the output is no more truncated. -- Added

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-03-05 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: MaL If you want a fail-safe stringified version of a Unicode object, MaL your only choice is to create a new API that does error checking, MaL properly clears the error and then returns a reference to a constant MaL string, e.g.

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-03-05 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Patch for pythonrun.c: - catch _PyUnicode_AsString() error in get_codeset(): very unlikely, codeset is the result of nl_langinfo() and is ASCII only - catch _PyUnicode_AsString(sys.stdin.encoding) error in

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-03-05 Thread Marc-Andre Lemburg
Marc-Andre Lemburg m...@egenix.com added the comment: About the _PyUnicode_AsStringOrDefault() patch: Since the _PyUnicode_AsString*() APIs are scheduled to be removed, it would be better to not introduce yet another way to use them. If that's not easily possible now, then please fix the

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-03-04 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Here is a fix for object.c (object_pyunicode_asstring-py3k.patch): - PyObject_GenericGetAttr(): Replace PyErr_Format(... %.400s, ..., _PyUnicode_AsString(name)) by PyErr_Format(... %U, ..., name), as done in

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-03-04 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Fix for _ssl module: replace _PyUnicode_AsString() by PyArg_ParseTuple() with PyUnicode_FSConverter. This change fixes also ssl for file system encoding different than utf8. I added a test on surrogates. The test fails if