[issue27942] Default value identity regression

2017-12-19 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests:  -1087

___
Python tracker 

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



[issue27942] Default value identity regression

2017-03-31 Thread Donald Stufft

Changes by Donald Stufft :


--
pull_requests: +1087

___
Python tracker 

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



[issue27942] Default value identity regression

2016-11-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> The test that tests it all :) test_stdlib_validates

:)

--

___
Python tracker 

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



[issue27942] Default value identity regression

2016-11-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 41613bb27f80 by Yury Selivanov in branch '2.7':
Issue #27942: Fix memory leak in codeobject.c
https://hg.python.org/cpython/rev/41613bb27f80

New changeset 2c6825c9ecfd by Yury Selivanov in branch '3.5':
ssue #27942: Fix memory leak in codeobject.c
https://hg.python.org/cpython/rev/2c6825c9ecfd

New changeset b671ac7ae620 by Yury Selivanov in branch '3.6':
Merge 3.5 (issue #27942)
https://hg.python.org/cpython/rev/b671ac7ae620

New changeset c27269c0d619 by Yury Selivanov in branch 'default':
Merge 3.6 (issue #27942)
https://hg.python.org/cpython/rev/c27269c0d619

--

___
Python tracker 

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



[issue27942] Default value identity regression

2016-11-09 Thread Yury Selivanov

Yury Selivanov added the comment:

Thanks for the review, Serhiy!

--
priority: release blocker -> normal
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue27942] Default value identity regression

2016-11-09 Thread Yury Selivanov

Yury Selivanov added the comment:

> Interesting, what tests in test_ast leak? I expected that this branch is 
> executed in rare circumstances.

The test that tests it all :) test_stdlib_validates

--

___
Python tracker 

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



[issue27942] Default value identity regression

2016-11-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Good catch! The patch LGTM, thanks Yury.

Interesting, what tests in test_ast leak? I expected that this branch is 
executed in rare circumstances.

--

___
Python tracker 

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



[issue27942] Default value identity regression

2016-11-09 Thread Yury Selivanov

Yury Selivanov added the comment:

Looks like the attached patch also fixes

   test_trace leaked [12, 12, 12] references, sum=36

--

___
Python tracker 

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



[issue27942] Default value identity regression

2016-11-09 Thread Yury Selivanov

Yury Selivanov added the comment:

The patch is causing refleaks:

test_ast leaked [98, 98, 98] references, sum=294
test_code leaked [2, 2, 2] references, sum=6

Please review the attached patch fixing that.  Please review.

--
nosy: +benjamin.peterson, larry, ned.deily, yselivanov
priority: normal -> release blocker
resolution: fixed -> 
status: closed -> open
Added file: http://bugs.python.org/file45407/refleak.patch

___
Python tracker 

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



[issue27942] Default value identity regression

2016-09-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks Naoki and Josh for reviews.

Backported to 2.7 and 3.5 since the patch also fixes other issues.

Note that the result of ``arg is "str_value"`` is implementation detail. Other 
Python implementations may not intern string constants. Even CPython interns 
only strings constants consisting of ASCII alphanumerical characters.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 2.7, Python 3.5

___
Python tracker 

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



[issue27942] Default value identity regression

2016-09-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 78bea78d9335 by Serhiy Storchaka in branch '3.5':
Issue #27942: String constants now interned recursively in tuples and 
frozensets.
https://hg.python.org/cpython/rev/78bea78d9335

New changeset 0ce63a7651b9 by Serhiy Storchaka in branch '3.6':
Issue #27942: String constants now interned recursively in tuples and 
frozensets.
https://hg.python.org/cpython/rev/0ce63a7651b9

New changeset 44af6bd21b94 by Serhiy Storchaka in branch 'default':
Issue #27942: String constants now interned recursively in tuples and 
frozensets.
https://hg.python.org/cpython/rev/44af6bd21b94

New changeset 7cea3bf44acb by Serhiy Storchaka in branch '2.7':
Issue #27942: String constants now interned recursively in tuples and 
frozensets.
https://hg.python.org/cpython/rev/7cea3bf44acb

--
nosy: +python-dev

___
Python tracker 

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



[issue27942] Default value identity regression

2016-09-30 Thread Josh Rosenberg

Changes by Josh Rosenberg :


--
nosy: +josh.r

___
Python tracker 

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



[issue27942] Default value identity regression

2016-09-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue27942] Default value identity regression

2016-09-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Proposed patch interns string constants recursively in tuples and frozensets. 
This fixes issue26148 and issue25981.

--
keywords: +patch
stage:  -> patch review
versions: +Python 3.7
Added file: http://bugs.python.org/file44807/intern_string_constants.patch

___
Python tracker 

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



[issue27942] Default value identity regression

2016-09-24 Thread Raymond Hettinger

Raymond Hettinger added the comment:

It would be nice to get this fixed.

--
nosy: +rhettinger

___
Python tracker 

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



[issue27942] Default value identity regression

2016-09-24 Thread Kay Hayen

Kay Hayen added the comment:

Same with 3.6b1, still present.

--
nosy: +kayhayen

___
Python tracker 

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



[issue27942] Default value identity regression

2016-09-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This likely is an interference of issue27095 with issue26148. I consider this 
as a regression. This causes not only a waste of memory, but can affect a 
performance, since comparing non-identical strings is slower than comparing 
identical strings.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27942] Default value identity regression

2016-09-02 Thread Steven D'Aprano

Steven D'Aprano added the comment:

Can confirm the expected behaviour (printing True) in Python 2.4 through 2.7, 
3.3, Jython 2.5, and even venerable old Python 1.5 (where it prints 1).

But *not* IronPython 2.6, where it prints False.

In 3.6, the difference seems to be here:

py> f = defaultKeepsIdentity
py> f.__defaults__[0] is f.__code__.co_consts[1]
False
py> f.__defaults__[0] == f.__code__.co_consts[1]
True

This behaviour is not specified by the language. Caching and re-use of strings 
has always been subject to change. Nevertheless, perhaps it is time for this to 
be make a language feature: inside a function, any use of the same string 
literal should use the same object?

--
nosy: +steven.daprano

___
Python tracker 

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



[issue27942] Default value identity regression

2016-09-02 Thread Kay Hayen

New submission from Kay Hayen:

Consider this:

def defaultKeepsIdentity(arg = "str_value"):
print(arg is "str_value")

defaultKeepsIdentity()

This has been outputing "True" on every Python release I have seen so far, but 
not so on 3.6.0a4. Normally string values come from a "co_const" and will be 
"is" identical if used as literals in a module, but no longer in this case.

This seems wasteful at best, needlessly increasing the number of strings in 
usage. 

Yours,
Kay

--
components: Interpreter Core
messages: 274257
nosy: Kay.Hayen
priority: normal
severity: normal
status: open
title: Default value identity regression
type: resource usage
versions: Python 3.6

___
Python tracker 

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