Issue548651
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2002-04-25 15:15 by theller, last changed 2022-04-10 16:05 by admin. This issue is now closed.
Files | ||||
---|---|---|---|---|
File name | Uploaded | Description | Edit | |
classmeth.diff | theller, 2002-12-06 18:51 | First try. |
Messages (11) | |||
---|---|---|---|
msg10507 - (view) | Author: Thomas Heller (theller) * ![]() |
Date: 2002-04-25 15:15 | |
The devel-docs about METH_CLASS: The method will be passed the type object as the first parameter rather than an instance of the type. This is used to create class methods, similar to what is created when using the classmethod() built-in function. New in version 2.3. The code does not do it in this way. The first parameter the function receives is NULL, the type object goes together with the remaining arguments in the second parameter (which is a tuple). See the thread with subject 'METH_CLASS' on python-dev at 2002-04-25, Guido agreed that this should be fixed. |
|||
msg10508 - (view) | Author: Thomas Heller (theller) * ![]() |
Date: 2002-05-24 09:53 | |
Logged In: YES user_id=11105 IMO this should be fixed before 2.3 is released, so I'm raising the priority to 7. |
|||
msg10509 - (view) | Author: Just van Rossum (jvr) * ![]() |
Date: 2002-11-26 10:30 | |
Logged In: YES user_id=92689 This has been open since april, and becomes immediately relevant with rhettingers dict.fromseq() classmethod addition: patch #643443. I hadn't seen this bug report before, but looking at Raymond's code I wondered why cls was passed as part of args instead of as the first arg of the C function. I ended up here... I think it's *crucial* this is fixed before the first alpha of 2.3 is released. Upping the priority by one... |
|||
msg10510 - (view) | Author: Thomas Heller (theller) * ![]() |
Date: 2002-12-06 08:19 | |
Logged In: YES user_id=11105 Will this be fixed before 2.3a? Now is the *last* chance to do this, since it changes the sematics of C code. In http://mail.python.org/pipermail/python-dev/2002- April/023574.html, Guido wrote the following: > Fred & I had a little whiteboard session. The docs indeed > disagree with the code, and we agree that the code should > be fixed. This requires some work: we'll have to introduce a > new kind of descriptor that wraps a PyMethodDef pointer > and creates a PyCFunction in response to the p_descr_get > call with the type as self. Fred will do this. Is this still the plan? Fred, are you going to implement this? |
|||
msg10511 - (view) | Author: Fred Drake (fdrake) ![]() |
Date: 2002-12-06 15:12 | |
Logged In: YES user_id=3066 I'd love to see this fixed. Priorities at work may not allow me to spend any time on this; patches would be welcome. |
|||
msg10512 - (view) | Author: Tim Peters (tim.peters) * ![]() |
Date: 2002-12-06 17:19 | |
Logged In: YES user_id=31435 This also affects the C implementation of the datetime module. While it would be very nice to get it fixed before alpha 1, it doesn't need to be fixed before beta 1. |
|||
msg10513 - (view) | Author: Thomas Heller (theller) * ![]() |
Date: 2002-12-06 18:51 | |
Logged In: YES user_id=11105 Ok, here's a first outline in form of a patch. Probably the same should be done for staticmethods. All the tests pass on Windows except bz2 and bsddb which I didn't build, and test_descr failes because Modules/xxsubtype.c needs to be updated. If this looks ok, I'm willing to continue - it didn't take much longer than an hour so far. |
|||
msg10514 - (view) | Author: Tim Peters (tim.peters) * ![]() |
Date: 2002-12-09 05:12 | |
Logged In: YES user_id=31435 Guido, does this patch match your and Fred's intent? I want to get this fixed, as it pops up a dozen times in the datetime project. Feel free to do a braindump on me tomorrow and make it my headache. |
|||
msg10515 - (view) | Author: Guido van Rossum (gvanrossum) * ![]() |
Date: 2002-12-09 18:31 | |
Logged In: YES user_id=6380 From a brief skim of the patch, it looks like this is indeed what's needed. I guess Tim can check it in (with my helpp, I'm sitting right behind him). |
|||
msg10516 - (view) | Author: Guido van Rossum (gvanrossum) * ![]() |
Date: 2002-12-09 18:39 | |
Logged In: YES user_id=6380 NB a small patch to test_descr is needed, as it currently contains a test that asserts the old behavior: *** test_descr.py 27 Nov 2002 16:29:26 -0000 1.168 --- test_descr.py 9 Dec 2002 18:38:20 -0000 *************** *** 1464,1475 **** a = (1, 2, 3) d = {'abc': 123} x, a1, d1 = spam.spamlist.classmeth(*a, **d) ! veris(x, None) ! vereq((spam.spamlist,) + a, a1) vereq(d, d1) x, a1, d1 = spam.spamlist().classmeth(*a, **d) ! veris(x, None) ! vereq((spam.spamlist,) + a, a1) vereq(d, d1) def staticmethods(): --- 1464,1475 ---- a = (1, 2, 3) d = {'abc': 123} x, a1, d1 = spam.spamlist.classmeth(*a, **d) ! veris(x, spam.spamlist) ! vereq(a, a1) vereq(d, d1) x, a1, d1 = spam.spamlist().classmeth(*a, **d) ! veris(x, spam.spamlist) ! vereq(a, a1) vereq(d, d1) def staticmethods(): |
|||
msg10517 - (view) | Author: Tim Peters (tim.peters) * ![]() |
Date: 2002-12-09 22:58 | |
Logged In: YES user_id=31435 Thanks, fellows! The changes were checked in, Include/descrobject.h; new revision: 2.12 Lib/test/test_descr.py; new revision: 1.169 Objects/descrobject.c; new revision: 2.32 Objects/dictobject.c; new revision: 2.136 Objects/typeobject.c; new revision: 2.197 I still need to fix the sandbox datetime code accordingly. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-10 16:05:16 | admin | set | github: 36495 |
2002-04-25 15:15:03 | theller | create |