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

2011-06-20 Thread STINNER Victor
Changes by STINNER Victor : -- resolution: -> fixed status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list Un

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

2011-06-20 Thread STINNER Victor
STINNER Victor 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-lsprof.diff patch, I just fixed a ref

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

2011-06-20 Thread Roundup Robot
Roundup Robot 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 ___ Pytho

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

2011-06-12 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- versions: +Python 3.3 -Python 3.1 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2011-01-13 Thread STINNER Victor
STINNER Victor 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 fix #3080). You have to docum

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

2011-01-13 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : Removed file: http://bugs.python.org/file19980/issue6697-lsprof.diff ___ Python tracker ___ ___ Python-bugs-l

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

2011-01-13 Thread Alexander Belopolsky
Alexander Belopolsky 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 looking into adding unit tests that wo

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

2010-12-10 Thread STINNER Victor
STINNER Victor 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 NULL - there is a ref

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

2010-12-08 Thread Alexander Belopolsky
Alexander Belopolsky 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 PyModule_GetNameObject(). -- Added file:

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

2010-12-08 Thread Alexander Belopolsky
Alexander Belopolsky 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 tracker

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

2010-12-07 Thread Alexander Belopolsky
Alexander Belopolsky 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 tracker

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

2010-12-07 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Alexander Belopolsky wrote: > > Alexander Belopolsky added the comment: > > On Tue, Dec 7, 2010 at 1:11 PM, Marc-Andre Lemburg > wrote: >>> I am not sure what >>> you mean by "a parser API." >> >> PyArg_Parse() et al. See the discussion earlier on this

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

2010-12-07 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Tue, Dec 7, 2010 at 1:11 PM, Marc-Andre Lemburg 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. It is the "u#" code. Yes, I'll see if I can u

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

2010-12-07 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Alexander Belopolsky wrote: > > Alexander Belopolsky added the comment: > > On Tue, Dec 7, 2010 at 12:44 PM, Marc-Andre Lemburg > wrote: > .. >> * Rather than just patching in error handling code, please consider >> removing use of those APIs and replace

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

2010-12-07 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Tue, Dec 7, 2010 at 12:44 PM, Marc-Andre Lemburg wrote: .. > * Rather than just patching in error handling code, please consider > removing use of those APIs and replace their calls with something > more appropriate, e.g. using a parser API. > Yes, tha

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

2010-12-07 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Alexander Belopolsky wrote: > > Alexander Belopolsky 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. Alth

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

2010-12-07 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : Added file: http://bugs.python.org/file19970/issue6697a.diff ___ Python tracker ___ ___ Python-bugs-list mail

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

2010-12-07 Thread Alexander Belopolsky
Alexander Belopolsky 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 intentional because although open

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

2010-12-06 Thread Alexander Belopolsky
Alexander Belopolsky 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 would like to hear from Ronald f

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

2010-12-06 Thread Alexander Belopolsky
Alexander Belopolsky 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) { uint32_t tmp; if (!PyUnicode_

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

2010-12-06 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Another crash: >>> from datetime import * >>> datetime.now(timezone(timedelta(0), '\uD800')).strftime('%Z') Segmentation fault -- ___ Python tracker

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

2010-12-06 Thread Alexander Belopolsky
Alexander Belopolsky 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 one. -- nosy: +

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

2010-05-19 Thread Arfrever Frehtes Taifersar Arahesis
Arfrever Frehtes Taifersar Arahesis added the comment: r81319 fixed 4 calls in pythonrun.c. -- ___ Python tracker ___ ___ Python-bugs-

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

2010-05-18 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file16458/pyunicode_asstringordefault.patch ___ Python tracker ___ ___ Python-

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

2010-05-18 Thread STINNER Victor
STINNER Victor 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 : Removed file: http://bugs.python.org/file16461/pythonrun-py3k.patch ___ Python tracker ___ ___ Python-bugs-list mai

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

2010-05-18 Thread STINNER Victor
STINNER Victor added the comment: r81324 fixes 2 calls in typeobject.c -- ___ Python tracker ___ ___ Python-bugs-list mailing list Uns

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

2010-05-18 Thread STINNER Victor
STINNER Victor added the comment: r81323 fixes 4 calls in _sqlite. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubsc

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

2010-05-18 Thread STINNER Victor
STINNER Victor added the comment: r81322 fixes 2 calls in textio.c. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

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

2010-05-18 Thread STINNER Victor
STINNER Victor 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 _

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

2010-05-18 Thread STINNER Victor
STINNER Victor added the comment: r81320 fixes a call in vgetargskeywords() (PyArg_ParseTupleAndKeywords). -- ___ Python tracker ___ _

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

2010-05-18 Thread STINNER Victor
STINNER Victor added the comment: r81314 fixes 2 calls in _PyModule_Clear(). -- ___ Python tracker ___ ___ Python-bugs-list mailing li

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

2010-05-16 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file14730/pymain.patch ___ Python tracker ___ ___ Python-bugs-list mailing lis

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

2010-05-16 Thread STINNER Victor
STINNER Victor added the comment: pymain.patch commited as r81250. Wait for the buildbot before backporting it to 3.1. -- ___ Python tracker ___

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

2010-05-16 Thread STINNER Victor
STINNER Victor added the comment: I fixed ssl.RAND_egd() in r81239 (issue #8477). Remove the other commited patches to see quickly which patches remain. -- ___ Python tracker __

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

2010-05-16 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file16443/ssl_rand_egd_unicode-py3k.patch ___ Python tracker ___ ___ Python-bu

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

2010-05-16 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file16502/unicode_fromformat_U.patch ___ Python tracker ___ ___ Python-bugs-li

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

2010-05-16 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file16442/object_pyunicode_asstring-py3k.patch ___ Python tracker ___ ___ Pyt

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

2010-03-21 Thread STINNER Victor
STINNER Victor 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 added the comment: object_pyunicode_asstring-py3k.patch commited as r78876. -- ___ Python tracker ___ ___ Python-bugs-l

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

2010-03-12 Thread STINNER Victor
STINNER Victor 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 _

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

2010-03-12 Thread STINNER Victor
STINNER Victor added the comment: I commited unicode_fromformat_U.patch as r78875. -- ___ Python tracker ___ ___ Python-bugs-list mail

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

2010-03-08 Thread STINNER Victor
STINNER Victor 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 file: http://bugs.python.

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

2010-03-08 Thread STINNER Victor
STINNER Victor added the comment: See also issue #8092. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

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

2010-03-05 Thread Marc-Andre Lemburg
Marc-Andre Lemburg 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 indentation (Tabs vs

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

2010-03-05 Thread STINNER Victor
STINNER Victor 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 PyRun_InteractiveOneFlags() - use _PyUnicode_AsStri

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

2010-03-05 Thread STINNER Victor
STINNER Victor 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. "". I wrote a function _PyUn

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

2010-03-04 Thread STINNER Victor
STINNER Victor 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 surrogates can be encoded to the file

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

2010-03-04 Thread STINNER Victor
STINNER Victor 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 PyObject_GenericSetAttr(). Note that the string