[issue25794] __setattr__ does not always overload operators

2017-05-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue25794] __setattr__ does not always overload operators

2017-05-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 4a86fe9d3f5e7af6f019ae22536eec228f04e22e by Serhiy Storchaka in 
branch '3.5':
[3.5] bpo-25794: Fix `type.__setattr__()` for non-interned attribute names. 
(GH-1652) (#1674)
https://github.com/python/cpython/commit/4a86fe9d3f5e7af6f019ae22536eec228f04e22e


--

___
Python tracker 

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



[issue25794] __setattr__ does not always overload operators

2017-05-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset 193f7e094f070cecbc6faea6dffafb80ea9e7536 by Serhiy Storchaka in 
branch '3.6':
[3.6] bpo-25794: Fix `type.__setattr__()` for non-interned attribute names. 
(GH-1652) (#1673)
https://github.com/python/cpython/commit/193f7e094f070cecbc6faea6dffafb80ea9e7536


--

___
Python tracker 

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



[issue25794] __setattr__ does not always overload operators

2017-05-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset e9f9b042781e3cb480315860bcdf7b7d22cba0f8 by Serhiy Storchaka in 
branch '2.7':
[2.7] bpo-25794: Fix `type.__setattr__()` for non-interned or unicode attribute 
names. (GH-1652) (#1675)
https://github.com/python/cpython/commit/e9f9b042781e3cb480315860bcdf7b7d22cba0f8


--

___
Python tracker 

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



[issue25794] __setattr__ does not always overload operators

2017-05-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1770

___
Python tracker 

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



[issue25794] __setattr__ does not always overload operators

2017-05-19 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1769

___
Python tracker 

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



[issue25794] __setattr__ does not always overload operators

2017-05-19 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1768

___
Python tracker 

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



[issue25794] __setattr__ does not always overload operators

2017-05-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset d896985bb2de49046f9b6879e906d1e4db255e23 by Serhiy Storchaka in 
branch 'master':
bpo-25794: Fix `type.__setattr__()` for non-interned attribute names. (#1652)
https://github.com/python/cpython/commit/d896985bb2de49046f9b6879e906d1e4db255e23


--

___
Python tracker 

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



[issue25794] __setattr__ does not always overload operators

2017-05-18 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1747

___
Python tracker 

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



[issue25794] __setattr__ does not always overload operators

2017-04-23 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Eryk, could you create a pull request? Please take into account my and Berker's 
comments on Rietveld.

--

___
Python tracker 

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



[issue25794] __setattr__ does not always overload operators

2017-04-16 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue25794] __setattr__ does not always overload operators

2017-04-14 Thread Louie Lu

Changes by Louie Lu :


--
nosy: +louielu

___
Python tracker 

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



[issue25794] __setattr__ does not always overload operators

2017-04-14 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
versions: +Python 3.7

___
Python tracker 

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



[issue25794] __setattr__ does not always overload operators

2015-12-15 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag
stage:  -> patch review
versions:  -Python 3.4

___
Python tracker 

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



[issue25794] __setattr__ does not always overload operators

2015-12-04 Thread Dominik Schmid

New submission from Dominik Schmid:

While implementing my own Integer class that keeps track of when operations are 
applied I noticed that setattr had a strange behaviour when I tried to wrap 
operator functions.

When the attribute string had a different id to its literal it failed to 
overload the operator.
Are we doing a 'is' rather than a '==' somewhere in setattr?


expected result: 
139723705431168a.__add__(b)= (5)a+b= (5)
139723705431168a.__add__(b)= (5)a+b= (5)
139723704361584a.__add__(b)= (5)a+b= (5)


actual result:
139723705431168a.__add__(b)= (5)a+b= (5)
139723705431168a.__add__(b)= (5)a+b= (5)
139723704361584a.__add__(b)= (5)a+b=
Traceback (most recent call last):
  File "/home/dom/Documents/leastOps/bug.py", line 41, in 
testSetattr(funcName3)
  File "/home/dom/Documents/leastOps/bug.py", line 28, in testSetattr
print '   a+b=', a+b
TypeError: unsupported operand type(s) for +: 'Integer' and 'Integer'



version:
2.7.10 (default, Oct 14 2015, 16:09:02) 
[GCC 5.2.1 20151010]
ubuntu 14.10

--
components: Interpreter Core
files: bug.py
messages: 255853
nosy: Dominik Schmid
priority: normal
severity: normal
status: open
title: __setattr__ does not always overload operators
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file41234/bug.py

___
Python tracker 

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



[issue25794] __setattr__ does not always overload operators

2015-12-04 Thread Eryk Sun

Changes by Eryk Sun :


Removed file: http://bugs.python.org/file41235/issue25794_1.patch

___
Python tracker 

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



[issue25794] __setattr__ does not always overload operators

2015-12-04 Thread Eryk Sun

Eryk Sun added the comment:

Normally Python code calls built-in setattr, which calls the C API 
PyObject_SetAttr. This API interns the attribute name before calling the type's 
tp_setattro or tp_setattr function. Interning the string is a critical step, 
since the implementation for updating slots assumes the name is interned. 

The __setattr__ slot wrapper calls wrap_setattr in Objects/typeobject.c. In 
line with how PyObject_SetAttr works, the attached patch interns the name in 
wrap_setattr before calling the wrapped setattrofunc. For good measure it also 
applies the same change to wrap_delattr, though that's not strictly necessary.

--
keywords: +patch
nosy: +eryksun
versions: +Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41235/issue25794_1.patch

___
Python tracker 

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



[issue25794] __setattr__ does not always overload operators

2015-12-04 Thread Eryk Sun

Eryk Sun added the comment:

This updated patch calls PyUnicode_Check to ensure the name is a string before 
calling PyUnicode_InternInPlace.

--
Added file: http://bugs.python.org/file41236/issue25794_2.patch

___
Python tracker 

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