[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2015-12-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: According to the results of recent poll [1], Py_SETREF is the most popular candidate. It was also one of leaders in previous poll [2], and this is a name used in original Antoine's proposition [3]. [1]

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-10-30 Thread Eldar Abusalimov
Changes by Eldar Abusalimov eldar.abusali...@gmail.com: -- nosy: +abusalimov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20440 ___ ___

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-10-14 Thread Stefan Krah
Changes by Stefan Krah stefan-use...@bytereef.org: -- nosy: -skrah ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20440 ___ ___ Python-bugs-list

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-03-18 Thread Jim Jewett
Jim Jewett added the comment: I am changing this from High to Release blocker, because I think 3.3 should make an explicit decision about whether to remove itself from the Affected Versions list. 3.4 probably should too, since it is now in bug-fix mode. Then this issue can go back to

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-03-18 Thread STINNER Victor
STINNER Victor added the comment: I am changing this from High to Release blocker, because I think 3.3 should make an explicit decision about whether to remove itself from the Affected Versions list. I don't understand. Which release does it block? There is no scheduled release in short

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-03-18 Thread Antoine Pitrou
Antoine Pitrou added the comment: The patch adds new public APIs (C macros), I don't think it should be committed to the maintenance branches. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20440

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-03-18 Thread Larry Hastings
Larry Hastings added the comment: Yeah, I'm not accepting this for 3.4 at this point, and I bet the other RMs feel the same way. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20440 ___

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-03-18 Thread Georg Brandl
Georg Brandl added the comment: Yes, this is new feature territory. -- priority: release blocker - high versions: +Python 3.5 -Python 2.7, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20440

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-27 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Are you referring to the Py_LOCAL_INLINE macro? I see that we have no Py_INLINE. Py_LOCAL_INLINE includes the static qualifier, and in fact, if there is no USE_INLINE defined, then all that it does is to add static. Would having a Py_INLINE(type)

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-27 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Well, Larry, I certainly am in no mood to start wrangling on python-dev. A 25 year old C standard is likely to be very mature and reliable by now. Why take risks? :) #Py_LOCAL_INLINE exists and demonstrates that we can make use of them when

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Poll: http://comments.gmane.org/gmane.comp.python.devel/145974 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20440 ___

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-26 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/issue20440 ___

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-26 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Barring c++, are we using any C compilers that don't support inlines? Imho these macros should be functions proper. Then we could do Py_Assign(target, Py_IncRef(obj)) It's 2014 already. -- ___ Python

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-26 Thread Stefan Krah
Stefan Krah added the comment: Barring c++, are we using any C compilers that don't support inlines? Not that I know of. libmpdec is C99, which seems to be supported by all obscure commercial compilers on snakebite. Also there have been no 3.x bug reports due to compilers choking on inline

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-26 Thread Larry Hastings
Larry Hastings added the comment: Barring c++, are we using any C compilers that don't support inlines? CPython advertises itself as C89 compliant, and C89 doesn't have inlines. You need to go to C99 to get inlines. And before you ask--yes, we support a compiler that is not C99 compliant:

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-25 Thread Tal Einat
Tal Einat added the comment: While we're bikeshedding, how about the more verbose PY_DECREF_AND_ASSIGN? That makes it clearer that an INCREF is not done. Regarding Kristján's suggestion of PY_ASSIGN and a complementary PY_STORE, IMO these names are too similar and the difference between them

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: While we're bikeshedding, how about the more verbose PY_DECREF_AND_ASSIGN? That makes it clearer that an INCREF is not done. Py_ASSIGN_AND_DECREF would be more correct. And Py_CLEAR can be renamed to Py_CLEAR_AND_XDECREF or Py_ASSIGN_NULL_AND_XDECREF.

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-25 Thread Tal Einat
Tal Einat added the comment: PY_ASSIGN_AND_DECREF could seem to imply that the assigned value is DECREF-ed. I think PY_DECREF_AND_ASSIGN makes it clearer that the original value is DECREF-ed. I like PY_ASSIGN_NULL_AND_DECREF, though for the same reason as above, I'd name it

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-25 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Better yet, embrace c++ and smart pointers :;-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20440 ___

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: These macros work as assignment with builtin decref, i.e. a smart replacement for = We could resolve this by calling them Py_ASSIGN Py_XASSIGN and having complementary macros Py_STORE/Py_XSTORE that will incref the new value. However, with an added

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-07 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Py_ASSIGN was proposed by Paul Pogonyshev in msg70798, and this also looks good to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20440 ___

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think Raymond's original concern still applies: The macros do add to the learning curve. I agree. But alternative solution is Victor's original patch which replaces potential bugs by inlined body of Py_REPLACE/Py_XREPLACE. This is explicit, but more

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-02-01 Thread Martin v . Löwis
Martin v. Löwis added the comment: I think Raymond's original concern still applies: The macros do add to the learning curve. I would personally expect that Py_REPLACE(op, op2) does an INCREF on op2, but it does not. Explicit is better than implicit. -- nosy: +loewis

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-01-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Unless some known bugs are being fixed, this should be 3.4 only. For example here is a bug very similar to a bug fixed in issue16447. class Nasty(str): def __del__(self): C.__qualname__ = other class C: pass C.__qualname__ = Nasty(abc)

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-01-30 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- priority: normal - high type: behavior - crash ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20440 ___

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-01-29 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Proposed patches replaced idiomatic code Py_DECREF(ptr); ptr = new_value; to Py_REPLACE(ptr, new_value); which is expanded to { PyObject *__tmp__ = ptr; ptr = new_value; Py_DECREF(__tmp__); } (and same for

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-01-29 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: Added file: http://bugs.python.org/file33803/py_replace-2.7.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20440 ___

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-01-29 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: Added file: http://bugs.python.org/file33802/py_replace-3.3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20440 ___

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-01-29 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- keywords: +patch Added file: http://bugs.python.org/file33801/py_replace-3.4.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20440 ___

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-01-29 Thread Antoine Pitrou
Antoine Pitrou added the comment: Something similar was proposed in issue3081. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20440 ___

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-01-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I do not understand why that issue was closed. Probably Py_SETREF is not the best name but this can be discussed. Adverse idea about Py_INCREF also looked questionable. But many people supported the introduction of a macro for safe replacement. And now we

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-01-29 Thread Brett Cannon
Brett Cannon added the comment: It all seems like a good idea to me and I like the Py_REPLACE naming (I was going to suggest Py_SWAP, but Py_XSWAP looks too weird to me). -- nosy: +brett.cannon ___ Python tracker rep...@bugs.python.org

[issue20440] Use Py_REPLACE/Py_XREPLACE macros

2014-01-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: Unless some known bugs are being fixed, this should be 3.4 only. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20440 ___