Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

classmethod(classmethod(foo)) -> SystemError #38845

Closed
anthonybaxter mannequin opened this issue Jul 13, 2003 · 4 comments
Closed

classmethod(classmethod(foo)) -> SystemError #38845

anthonybaxter mannequin opened this issue Jul 13, 2003 · 4 comments

Comments

@anthonybaxter
Copy link
Mannequin

anthonybaxter mannequin commented Jul 13, 2003

BPO 770465
Nosy @rhettinger

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2003-07-13.13:58:40.000>
created_at = <Date 2003-07-13.08:54:09.000>
labels = []
title = 'classmethod(classmethod(foo)) -> SystemError'
updated_at = <Date 2003-07-13.13:58:40.000>
user = 'https://bugs.python.org/anthonybaxter'

bugs.python.org fields:

activity = <Date 2003-07-13.13:58:40.000>
actor = 'anthonybaxter'
assignee = 'anthonybaxter'
closed = True
closed_date = None
closer = None
components = ['None']
creation = <Date 2003-07-13.08:54:09.000>
creator = 'anthonybaxter'
dependencies = []
files = []
hgrepos = []
issue_num = 770465
keywords = []
message_count = 4.0
messages = ['17045', '17046', '17047', '17048']
nosy_count = 2.0
nosy_names = ['anthonybaxter', 'rhettinger']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue770465'
versions = ['Python 2.2']

@anthonybaxter
Copy link
Mannequin Author

anthonybaxter mannequin commented Jul 13, 2003

Using 2.2.3 or current release22-maint:

>>> classmethod(classmethod(None)).__get__(1) 
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
SystemError: Objects/classobject.c:2022: bad argument
to internal function
(thanks to Steve Alexander for the one-line example)

This produces the error "classmethod is not callable"
in 2.3,
but no systemerror - dunno if 2.3 could provide a
better error message here.

A more realistic example (derived from the code that
originally tripped me up):

>>> class a:
...     def foo(self):
...         print "self is", self, type(self)
...     foo=classmethod(foo)
...     foo=classmethod(foo)
... 
>>> b=a()
>>> b.foo()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
SystemError: Objects/classobject.c:2022: bad argument
to internal function

@anthonybaxter anthonybaxter mannequin closed this as completed Jul 13, 2003
@anthonybaxter anthonybaxter mannequin self-assigned this Jul 13, 2003
@anthonybaxter anthonybaxter mannequin closed this as completed Jul 13, 2003
@anthonybaxter anthonybaxter mannequin self-assigned this Jul 13, 2003
@rhettinger
Copy link
Contributor

Logged In: YES
user_id=80475

This was fixed in revision 2.63 on Jun 18, 2003
and marked as a backport candidate. See SF bug bpo-753451.

@anthonybaxter
Copy link
Mannequin Author

anthonybaxter mannequin commented Jul 13, 2003

Logged In: YES
user_id=29957

Re-opening, assigning to myself to remind me to do the backport.

@anthonybaxter
Copy link
Mannequin Author

anthonybaxter mannequin commented Jul 13, 2003

Logged In: YES
user_id=29957

Backported. Thanks for the pointer!
(also fixed identical bug in Zope3's ContextMethod)

Checking in Objects/funcobject.c;
/cvsroot/python/python/dist/src/Objects/funcobject.c,v <--
funcobject.c
new revision: 2.50.4.4; previous revision: 2.50.4.3
done
Checking in Lib/test/test_descr.py;
/cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
<-- test_descr.py
new revision: 1.113.4.35; previous revision: 1.113.4.34
done

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant