-
-
Notifications
You must be signed in to change notification settings - Fork 559
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
Implement the __init_extra__ protocol of categories for Cython classes. #15718
Comments
comment:1
It would probably be rather easy: Currently, we only look into the mro of the class; if the class is a Python class, then it is a subclass of the category's parent class (since the quest for It would detect a lot of Cython classes in which the call to |
comment:2
Replying to @simon-king-jena:
+1! For the record: this will require calling |
comment:3
Replying to @nthiery:
I disagree. If I recall correctly, we look up the whole class hierarchy and execute all |
comment:4
Replying to @simon-king-jena:
Yes! Still, some magic will be needed to bind each such method to the |
comment:5
Replying to @nthiery:
Do we need to bind it? We just want to call it. |
comment:6
Replying to @simon-king-jena:
Such as:
|
comment:7
I just tested: When one empties the coercion cache and the coerce_from_list, then calling |
comment:8
Replying to @simon-king-jena:
Well ... that works when |
comment:9
I guess it's fair enough to write in the specifications of the protocol that |
comment:10
Replying to @nthiery:
You'll have to be careful how you formulate that:
Famous last words... I've seen many cases happen in sage where little design issues (which, at the time perpetrated seemed perfectly reasonable) lead to weird, unforseen and silent failures. The problem this ticket is trying to fix is one of them. |
comment:11
Replying to @nbruin:
Note that the idea is to go up |
comment:12
Replying to @simon-king-jena:
Well, anything can be assigned to attributes in principle, regardless of whether something is a python class or not. Should we ever migrate to Python 3 then there are no unbound instancemethods at all: they are just plain functions there. So I'd say:
|
comment:13
Replying to @nbruin:
or use inspect.ismethod. |
comment:18
Very strange. The following does not work, even in Python:
I found that At what point is a coercion from ZZ requested before calling |
comment:19
Shoot! One needs to do
since |
Author: Simon King |
comment:21
To make sage start, it was also needed to declare that New commits:
|
Commit: |
comment:31
Replying to @simon-king-jena:
They do, on my machine at least. |
comment:32
Build fails. |
comment:33
The changes look fine to me. It can be set to positive review once the build errors are fixed. |
comment:34
It would be nice to have an explanation of what this branch does and which problem it solves. I would like to know why traversing the |
comment:35
Also: since this code seems to involve categories, why is it in |
comment:39
Setting new milestone based on a cursory review of ticket status, priority, and last modification date. |
comment:40
Setting a new milestone for this ticket based on a cursory review. |
comment:41
Stalled in |
Component: categories
Author: Simon King
Branch/Commit: u/mkoeppe/implement_the___init_extra___protocol_of_categories_for_cython_classes_ @
0ec1c06
Issue created by migration from https://trac.sagemath.org/ticket/15718
The text was updated successfully, but these errors were encountered: