Mark Dickinson dicki...@gmail.com added the comment:
[Georg Brandl, on spark.py]
This is used by asdl_c.py which generates Python-ast.c -- it should be
updated.
The only issue here is a single comment, which reads:
# GenericASTMatcher. AST nodes must have __getitem__ and __cmp__
Still,
Mark Dickinson dicki...@gmail.com added the comment:
Here's a patch (against py3k) generated from the current state of the
py3k-issue1717 branch, for ease of review and testing.
The patch needs serious review; it should be considered a first draft,
and there are probably many more changes
Georg Brandl ge...@python.org added the comment:
Doc/extending/newtypes.rst
I'll fix this one after the patch has landed.
Misc/cheatsheet
This needs a general overhaul.
Misc/python-mode.el
I think this should be removed from the distribution; it's maintained
externally.
Mark Dickinson dicki...@gmail.com added the comment:
Still to do:
pybench needs updating to remove a cmp reference; since the changes
required for pybench are a little bit more substantial than simple cmp
replacement, I've broken this out into a separate issue: issue 4704.
There are many
Mark Dickinson dicki...@gmail.com added the comment:
Should Py_CmpToRich (in object.c) disappear?
It's currently used in longobject.c, but nowhere else as far as I can
tell. It shouldn't be too hard to update longobject.c to remove the use.
___
Python
Antoine Pitrou pit...@free.fr added the comment:
It shouldn't be too hard to update longobject.c to remove the use.
I'll do that one.
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1717
___
Antoine Pitrou pit...@free.fr added the comment:
It shouldn't be too hard to update longobject.c to remove the use.
I'll do that one.
Done in r67871, r67873.
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1717
Marc-Andre Lemburg m...@egenix.com added the comment:
Please remember to add back PyUnicode_Compare() if that hasn't already
been done.
Thanks,
--
Marc-Andre Lemburg
eGenix.com
2008-12-02: Released mxODBC.Connect 1.0.0
Changes by Martin v. Löwis mar...@v.loewis.de:
--
priority: deferred blocker - release blocker
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1717
___
Changes by Martin v. Löwis [EMAIL PROTECTED]:
--
priority: release blocker - deferred blocker
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
Mark Dickinson [EMAIL PROTECTED] added the comment:
More seriously, if cmp were to go into the standard library somewhere,
perhaps Raymond's class decorator (for filling in missing rich
comparisons) could go into the same place?
___
Python tracker [EMAIL
Raymond Hettinger [EMAIL PROTECTED] added the comment:
Moving cmp() somewhere other than builtins is not progress. IMO, it
needs to die off and the concept of it needs to disappear completely.
Code is better without it. Three-way comparisons are PITA to use --
their only virtue is as an
Marc-Andre Lemburg [EMAIL PROTECTED] added the comment:
On 2008-12-09 10:59, Raymond Hettinger wrote:
Raymond Hettinger [EMAIL PROTECTED] added the comment:
Moving cmp() somewhere other than builtins is not progress. IMO, it
needs to die off and the concept of it needs to disappear
Antoine Pitrou [EMAIL PROTECTED] added the comment:
The idea was to have one implementation of the work-around (ab) - (ba)
instead of 10 or so instances of this snippet in the Python stdlib
and probably a few hundred places in other code.
But what use-case does it solve, except for making
Marc-Andre Lemburg [EMAIL PROTECTED] added the comment:
On 2008-12-09 16:06, Antoine Pitrou wrote:
Antoine Pitrou [EMAIL PROTECTED] added the comment:
The idea was to have one implementation of the work-around (ab) - (ba)
instead of 10 or so instances of this snippet in the Python stdlib
Raymond Hettinger [EMAIL PROTECTED] added the comment:
Guido approved removing __builtin__.cmp() in 3.0.1. It was supposed to
have been taken out but was forgotten.
With respect to the DRY principle, I disagree about its utility here.
The code is so simple that it doesn't warrant cross-module
Mark Dickinson [EMAIL PROTECTED] added the comment:
Update patch to include fix for unittest.py and test_unittest.py.
Added file: http://bugs.python.org/file12278/remove_cmp5.patch
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
Christian Heimes [EMAIL PROTECTED] added the comment:
I've created a new branch to work on the issue:
svn+ssh://[EMAIL PROTECTED]/python/branches/py3k-issue1717. It's
easier to work on a branch than exchanging monster patches.
___
Python tracker [EMAIL
Marc-Andre Lemburg [EMAIL PROTECTED] added the comment:
Please put the PyUnicode_Compare() API back in there.
Removing __cmp__ really doesn't have anything to do with removing often
used helper functions for comparing certain object types and only
cripples the C API in a needless way.
Thanks.
Marc-Andre Lemburg [EMAIL PROTECTED] added the comment:
Instead of removing cmp(a, b) and replacing all uses with (ab)-(ba) I
think it's better to turn cmp() into a helper that applies this
operation in C rather than Python.
___
Python tracker [EMAIL
Changes by Guido van Rossum [EMAIL PROTECTED]:
--
nosy: -gvanrossum
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
___
Python-bugs-list
Christian Heimes [EMAIL PROTECTED] added the comment:
Marc-Andre, how do you like a function PyUnicode_Equal() instead of
PyUnicode_Compare()?
The old PyUnicode_Compare() function returns -1 for smaller value and
errors, 0 for equality and +1 for larger value. I find it confusing to
have one
Antoine Pitrou [EMAIL PROTECTED] added the comment:
IMO PyUnicode_Compare() should be replaced by a hypothetical
PyObject_RichCompare(), which allows to take shortcuts when comparing
strings of different length and a Py_EQ or Py_NE comparison is requested.
(see #3106 too)
--
nosy:
Marc-Andre Lemburg [EMAIL PROTECTED] added the comment:
On 2008-12-09 00:12, Christian Heimes wrote:
Christian Heimes [EMAIL PROTECTED] added the comment:
Marc-Andre, how do you like a function PyUnicode_Equal() instead of
PyUnicode_Compare()?
The old PyUnicode_Compare() function
Antoine Pitrou [EMAIL PROTECTED] added the comment:
I wrote:
IMO PyUnicode_Compare() should be replaced by a hypothetical
PyObject_RichCompare(), which allows to take shortcuts when comparing
strings of different length and a Py_EQ or Py_NE comparison is requested.
... and I didn't even
Marc-Andre Lemburg [EMAIL PROTECTED] added the comment:
On 2008-12-09 00:58, Antoine Pitrou wrote:
Antoine Pitrou [EMAIL PROTECTED] added the comment:
I wrote:
IMO PyUnicode_Compare() should be replaced by a hypothetical
PyObject_RichCompare(), which allows to take shortcuts when comparing
Mark Dickinson [EMAIL PROTECTED] added the comment:
It is in the builtins in Python 2.x, so keeping it there would make
porting easier, but then it's probably better to put it somewhere else
to make people aware of the fact that the underlying machinery has
changed.
from __past__ import cmp
Mark Dickinson [EMAIL PROTECTED] added the comment:
+1 for a speedy removal of cmp and tp_compare
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
___
Christian Heimes [EMAIL PROTECTED] added the comment:
We shouldn't remove the tp_compae slot in 3.0. That's going to break too
much 3rd party software. Instead of removing it, a deprecation warning
should be printed when the slot isn't 0.
___
Python tracker
Christian Heimes [EMAIL PROTECTED] added the comment:
Here is a longer patch that removes cmp, PyObject_Compare and cmpfunc.
The slots has been renamed to tp_reserved. If the slot is used by a type
an exception is raised to notify the user about possible issues.
Missing:
* fix unit tests
* add
Mark Dickinson [EMAIL PROTECTED] added the comment:
I'll work on fixing the unit tests if that's helpful.
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
Christian Heimes [EMAIL PROTECTED] added the comment:
Can you fix the decimal module and tests? You know more about the module
than me. I'm half through most of the others modules.
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
Mark Dickinson [EMAIL PROTECTED] added the comment:
Decimal fixes
Added file: http://bugs.python.org/file12265/remove_cmp_decimal.patch
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
Changes by Christian Heimes [EMAIL PROTECTED]:
Removed file: http://bugs.python.org/file12262/remove_cmp.patch
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
Christian Heimes [EMAIL PROTECTED] added the comment:
I've integrated Mark's patch and fixed more tests. Who wants to pick it
up from here?
Added file: http://bugs.python.org/file12267/remove_cmp2.patch
___
Python tracker [EMAIL PROTECTED]
Mark Dickinson [EMAIL PROTECTED] added the comment:
remove_cmp3.patch adds to Christian's patch to fix 6 more test_failures:
(test_distutils, test_kqueue, test_list, test_sort, test_sqlite,
test_userlist).
On OS X, the only remaining test failure is test_unittest.py.
Added file:
Mark Dickinson [EMAIL PROTECTED] added the comment:
About unittest:
unittest.TestLoader has an attribute sortTestMethodsUsing, which it
expects to be an old-style comparison.
Should this attribute be updated (and renamed?) to expect a key function
instead, or left as is?
Brett Cannon [EMAIL PROTECTED] added the comment:
On Sun, Dec 7, 2008 at 13:26, Mark Dickinson [EMAIL PROTECTED] wrote:
Mark Dickinson [EMAIL PROTECTED] added the comment:
About unittest:
unittest.TestLoader has an attribute sortTestMethodsUsing, which it
expects to be an old-style
Christian Heimes [EMAIL PROTECTED] added the comment:
The latest patch removes PyUnicode_Compare as well as lots of __cmp__
functions under Lib/. It also renames and redefines
PyUnicode_CompareWithASCIIString(). The simpler
PyUnicode_EqualToASCIIString() function is easier to use, too.
Georg Brandl [EMAIL PROTECTED] added the comment:
cmp() the function is also still there.
--
priority: high - critical
resolution: fixed -
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
Guido van Rossum [EMAIL PROTECTED] added the comment:
Bah. That means we'll have to start deprecating cmp() in 3.1, and won't
be able to remove it until 3.2 or 3.3. :-)
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
Georg Brandl [EMAIL PROTECTED] added the comment:
I hope the smiley really indicates a joke...
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
___
Guido van Rossum [EMAIL PROTECTED] added the comment:
Well what would you suggest we do?
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
___
Georg Brandl [EMAIL PROTECTED] added the comment:
I'd release 3.0.1 quickly, maybe also with the in-development
improvements to the io library that alleviate the factor-1000 slowdowns.
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
Changes by Raymond Hettinger [EMAIL PROTECTED]:
--
nosy: +rhettinger
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
___
Python-bugs-list
Raymond Hettinger [EMAIL PROTECTED] added the comment:
Since cmp() was documented as removed in whatsnew3.0, it may be fair
game to complete the removal, treating it as a bugfix.
If as Georg suggests it is done *very* quickly in 3.0.1 (say in the next
week or so), it is likely harmless and
Christian Heimes [EMAIL PROTECTED] added the comment:
A quick ballot on #python-dev resulted in 3 of 3 votes for removing
cmp() in a quick bug fix release.
About the io misery:
My quick fix for the buffer reallocation schema has made the situation a
bit better. For the 3.0.x series I like to
Guido van Rossum [EMAIL PROTECTED] added the comment:
OK, remove it in 3.0.1, provided that's released this year.
Performance fixes are always fair game for bugfix releases.
Please don't fix the what's new document (or undo the fix).
I do hope cmp() was already undocumented elsewhere.
Changes by Barry A. Warsaw [EMAIL PROTECTED]:
--
priority: critical - release blocker
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
___
Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:
Do the API functions PyObject_Compare() and PyObject_Cmp() also go away?
--
nosy: +amaury.forgeotdarc
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:
Do we also get rid of the tp_compare type slot? 6 types still use it,
they should convert this to a tp_richcompare slot
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
Benjamin Peterson [EMAIL PROTECTED] added the comment:
Yes, tp_compare should go.
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
___
Python-bugs-list
Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:
tp_richcompare is less convenient to implement than tp_compare. See for
example how in Objects/longobject.c, long_richcompare() calls long_compare()
*and* a helper method Py_CmpToRich.
Likewise, turning __cmp__ into the whole set of
Raymond Hettinger [EMAIL PROTECTED] added the comment:
Either take out the C-API functions or re-define them as:
lambda a, b: (a b) - (a b)
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
Raymond Hettinger [EMAIL PROTECTED] added the comment:
r67627 : complete the dedocumenting of cmp().
Amaury, I have a non-metaclass solution for you. Will post on ASPN. It
uses a class decorator to sniff-out *any* defined rich ordering
comparisons and the automatically fills-in those that are
Raymond Hettinger [EMAIL PROTECTED] added the comment:
FWIW, the tp_compare slot in setobject.c serves only say the cmp() isn't
defined. It can be ripped-out straight-away.
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
Mark Dickinson [EMAIL PROTECTED] added the comment:
Guido's patch breaks these tests:
test_descr test_hash test_long test_richcmp test_set
It looks like all these are easily fixed: all these tests were making
outdated assumptions and needed updating.
Here's a patch that fixes these
Benjamin Peterson [EMAIL PROTECTED] added the comment:
Thanks, Mark! Applied in r66920.
--
resolution: - fixed
status: open - closed
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
Mark Dickinson [EMAIL PROTECTED] added the comment:
Presumably any nonzero entries for tp_compare in type initializers
should be looked at closely, as well?
I see nonzero tp_compare entries in:
Modules/_tkinter.c
Modules/parsermodule.c
Objects/cellobject.c
Objects/descrobject.c
Benjamin Peterson [EMAIL PROTECTED] added the comment:
Let's lower the priority on this.
--
priority: release blocker - high
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
Changes by Barry A. Warsaw [EMAIL PROTECTED]:
--
priority: deferred blocker - release blocker
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
Changes by Barry A. Warsaw [EMAIL PROTECTED]:
--
priority: release blocker - deferred blocker
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
Changes by Barry A. Warsaw [EMAIL PROTECTED]:
--
priority: deferred blocker - release blocker
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
Georg Brandl [EMAIL PROTECTED] added the comment:
Bumping priority even further. This shouldn't make it past rc.
--
priority: critical - release blocker
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
Benjamin Peterson [EMAIL PROTECTED] added the comment:
Guido's patch breaks these tests:
test_descr test_hash test_long test_richcmp test_set
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
Brett Cannon [EMAIL PROTECTED] added the comment:
Since we are making 3.0 issues deferred blockers dropping the priority.
--
nosy: +brett.cannon
priority: release blocker - deferred blocker
___
Python tracker [EMAIL PROTECTED]
Georg Brandl [EMAIL PROTECTED] added the comment:
Additionally, there are still lots of references to __cmp__ in the
library which should be ripped out.
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
Guido van Rossum [EMAIL PROTECTED] added the comment:
Can someone other than me test and apply this? It seems still relevant,
and __cmp__ is not coming back.
--
assignee: gvanrossum -
___
Python tracker [EMAIL PROTECTED]
Benjamin Peterson [EMAIL PROTECTED] added the comment:
Ping
--
nosy: +benjamin.peterson
___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
___
___
Georg Brandl [EMAIL PROTECTED] added the comment:
Bumping priority.
--
nosy: +georg.brandl
priority: normal - critical
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
__
Guido van Rossum [EMAIL PROTECTED] added the comment:
__cmp__ is not coming back.
--
priority: low - normal
__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1717
__
___
New submission from Guido van Rossum:
Should I apply this? There are more places that reference __cmp__ in
the library. OTOH there are some folks who would like to see __cmp__
make a come-back as a shorthand for defining 6 comparison operators, for
totally-ordered types. (I'm still waiting
72 matches
Mail list logo