[issue19512] Avoid temporary Unicode strings, use identifiers to only create the string once

2013-11-19 Thread STINNER Victor

STINNER Victor added the comment:

No reaction, I close the issue. Reopen it if you still have complains ;-)

--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19512
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19512] Avoid temporary Unicode strings, use identifiers to only create the string once

2013-11-12 Thread STINNER Victor

STINNER Victor added the comment:

@Georg, Serhiy, Martin: Sorry for having commits directly without more review. 
I didn't expect negative feedback on such changes, I thaught to moving from 
literal C byte string to Python identifiers was a well accepted practice since 
identifiers are used in a lot of places in Python code base.

So what should I do now? Should I revert all changesets related to this issue, 
or can we keep these new identifiers and close the issue?

--
nosy: +loewis

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19512
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19512] Avoid temporary Unicode strings, use identifiers to only create the string once

2013-11-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bf9c77bac36d by Victor Stinner in branch 'default':
Issue #19512, #19526: Exclude the new _PyDict_DelItemId() function from the
http://hg.python.org/cpython/rev/bf9c77bac36d

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19512
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19512] Avoid temporary Unicode strings, use identifiers to only create the string once

2013-11-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 What is the problem with these changes?

Usually CPython team avoids code churn without serious reasons. Performance 
reasons for the change PySys_GetObject(stdout) to 
_PySys_GetObjectId(_PyId_stdout) are ridiculous. You changed hundreds lines of 
code for speed up interactive mode by perhaps several microseconds.

 Errors become more unlikely because objects are only initialized once, near 
 startup. So it put also less pressure on code handling errors :) (it is 
 usually the least tested part of the code)

If there are bugs in code handling errors, they should be fixed in maintenance 
releases too.

 You mean for PyRun_InteractiveOneObject()? Oh, it can be made private, but 
 what is the problem of adding yet another PyRun_Interactive*() function? 
 There are already a lot of them :-)

And this is a problem. Newly added function is not even documented.

 I also worked hard to support unencodable filenames: using char*, you cannot 
 support arbitrary Unicode filename on Windows. That's why a added many 
 various functions with Object suffix. Some examples: 
 PyWarn_ExplicitObject(), PyParser_ParseStringObject(), 
 PyImport_AddModuleObject(), etc.

One bug per bug report as Martin says.

 Another problem is that PyUnicode_FromString() failure is not handled 
 correctly in some cases. PyUnicode_FromString() can fail because an decoder 
 error, but also because of a MemoryError.

It can't fail on stdout because an decoder error.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19512
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19512] Avoid temporary Unicode strings, use identifiers to only create the string once

2013-11-07 Thread STINNER Victor

STINNER Victor added the comment:

 Another problem is that PyUnicode_FromString() failure is not handled 
 correctly in some cases. PyUnicode_FromString() can fail because an decoder 
 error, but also because of a MemoryError.

 It can't fail on stdout because an decoder error.

It can fail on stdout because of a memory allocation failure.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19512
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19512] Avoid temporary Unicode strings, use identifiers to only create the string once

2013-11-07 Thread Georg Brandl

Georg Brandl added the comment:

 You mean for PyRun_InteractiveOneObject()? Oh, it can be made private, but 
 what is the problem of adding yet another PyRun_Interactive*() function? 
 There are already a lot of them :-)

 And this is a problem. Newly added function is not even documented.

Serhiy is right. You have to be responsible with the Py* namespace, and keep 
new functions private unless they are useful enough to the outside and you 
document them.

In general, you changed lots of code without a single review.  Can you slow 
down a bit?

--
nosy: +georg.brandl

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19512
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19512] Avoid temporary Unicode strings, use identifiers to only create the string once

2013-11-07 Thread STINNER Victor

STINNER Victor added the comment:

 Serhiy is right. You have to be responsible with the Py* namespace, and keep 
 new functions private unless they are useful enough to the outside and you 
 document them.

I created the issue #19518 to discuss this part (but also to propose other 
enhancements related to Unicode).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19512
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19512] Avoid temporary Unicode strings, use identifiers to only create the string once

2013-11-07 Thread STINNER Victor

STINNER Victor added the comment:

 Errors become more unlikely because objects are only initialized once, near 
 startup. So it put also less pressure on code handling errors :) (it is 
 usually the least tested part of the code)

 If there are bugs in code handling errors, they should be fixed in 
 maintenance releases too.

Well, using identifiers doesn't solve directly all issues. For example, 
_PyDict_GetItemId() should be replaced with _PyDict_GetItemIdWithError() to be 
complelty safe. It just reduces the probability of bugs.

Using identifiers might add regressions for a minor gain (handling MemoryError 
better). As I did for issues #18048 and #19437 (related to issues found by 
failmalloc), I prefer to not backport such minor bugfixes to not risk a 
regression.

 You changed hundreds lines of code for speed up interactive mode by perhaps 
 several microseconds.

Again, performance is not the main motivation, please read again msg202293. Or 
maybe you disagree with this message?

Sorry, I didn't explain my changes in first messages of this issue. I created 
the issue to group my changesets to an issue, to explain why I did them. I 
didn't expect any discussion :-) But thank you for all your remarks.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19512
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19512] Avoid temporary Unicode strings, use identifiers to only create the string once

2013-11-07 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19512
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19512] Avoid temporary Unicode strings, use identifiers to only create the string once

2013-11-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 01c4a0af73cf by Victor Stinner in branch 'default':
Issue #19512, #19515: remove shared identifiers, move identifiers where they
http://hg.python.org/cpython/rev/01c4a0af73cf

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19512
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19512] Avoid temporary Unicode strings, use identifiers to only create the string once

2013-11-06 Thread STINNER Victor

STINNER Victor added the comment:

I changed the issue title to make it closer to the real changesets related to 
the issue.

--
title: Avoid most calls to PyUnicode_DecodeUTF8Stateful() in Python interactive 
mode - Avoid temporary Unicode strings, use identifiers to only create the 
string once

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19512
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19512] Avoid temporary Unicode strings, use identifiers to only create the string once

2013-11-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 77bebcf5c4cf by Victor Stinner in branch 'default':
Issue #19512: add _PyUnicode_CompareWithId() function
http://hg.python.org/cpython/rev/77bebcf5c4cf

New changeset 3f9f2cfae53b by Victor Stinner in branch 'default':
Issue #19512: Use the new _PyId_builtins identifier
http://hg.python.org/cpython/rev/3f9f2cfae53b

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19512
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com