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
Nested class name mangling can be wrong in case of double nesting #9107
Comments
Dependencies: #12808 |
comment:2
I think we should make this depend on #12808, because it cythonises nested classes. Here is my analysis:
|
comment:3
I think the attached patch solves the problem. I get:
The change is in Here: Since Bla.Bla1 is an instance of Now, without my patch, in the second run, Much BlaBla, but I think it works... Potential problems
Hence, Bla.Bla1.Bla11 is listed in the module under two different names. If you think it is bad, then one could probably modify the function when first_run is false, such that the name given in the first run is erased from the module. Moreover, the reviewer will likely find a speed regression, when excessively creating nested unique representations. But that's hardly realistic... |
Author: Simon King |
comment:4
Another problem: Source inspection does not work yet in the following example.
Even #11768 does not solve the problem. Shall that be dealt with on a different ticket? Or in one go? Probably on a different ticket, since I just find that even source inspection for A1 (which has a usual name) does not work... |
comment:5
For the record: If #11791 is applied after this ticket, source inspection in the example above works (and is doctested). |
comment:6
Is there a reviewer to fix name mangling of nested classes (needed in the category framework)? |
comment:7
This patch also fixes an issue that came up in #8899 regarding documentation of nested classes not appearing in the reference manual. See here for a description of the issue, see the thread on sage-combinat-devel. See here for the confirmation that this works: #8899 comment:31 |
comment:8
LGTM! |
Reviewer: Volker Braun |
comment:9
This causes trouble when building the documentation from scratch (i.e. after deleting 'devel/sage/doc/output`):
|
comment:11
Jeroen, can you elaborate a bit what went wrong? |
comment:12
Aha, now I see that the very long single line contains warnings about cross references that were not found. I'll try to identify them. |
comment:13
Aha, here is an example: The docstring of
Could this simply be a misspelling? Note that it is written
but should certainly be
If that's the case for the other warnings as well, then my patch would just uncover mistakes that happened earlier. |
comment:14
The same issue arose in #13851 (see comment 10). I'm not sure why those dots are there, and I personally think they should be removed, but someone intentionally put them there. |
comment:15
Replying to @jhpalmieri:
I think the dot is simply wrong - or is it ignored by Sphinx? Actually here it is even worse. The text is documentation of a functorial construction, but refers to a parent method - that can't possibly work without an explicit reference to the method which must include the class which the method belongs to. |
Attachment: trac_9107_fix_cross_reference.patch.gz Fix a cross reference in some functorial construction |
comment:16
Does the second patch fix the problem? I am now explicitly referring to the |
Commit: |
comment:75
Gosh, it turned out that using So I investigated a further and got lucky this time: if we replace I proposed this fix upstream: https://bitbucket.org/birkenfeld/sphinx/issue/777/latex-output-too-deeply-nested For the time being, I tweaked our conf.py to redefine and fix sphinx's Ok, now there just remains to check that all tests pass, and this will Cheers, New commits:
|
comment:76
Is there a reason why you don't patch the sphinx spkg directly? |
comment:77
Replying to @tscrim:
Lazyness mostly. If someone whats to create a patch, adapt the spkg, ... please go ahead! |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:79
Ok, there were a couple doctest failures, all to be expected since nested classes now have a correct name. Fixed now. So that's a needs review! |
comment:80
Here's a version with a patched version of the sphinx spkg. Although I think your pull request is based on v1.2 (but it still applied (for me) to our current v1.1). Could someone check to make sure I created the patch correctly (and tell me what I should do instead if it isn't right). New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:82
Replying to @tscrim:
Ah, that's nice: modifying standard spkgs is much simpler now that we have a single repository. Thanks!
It seems to apply as it's supposed to (modulo trivial line offset). I have made some minor improvement to the patch description. I am a bit nervous about the removal of the former change log in SPKG.txt. But if someone can confirm that this is the right thing to do, that's ok for me. Other than this, this sounds good to go! Thanks again, |
comment:83
Replying to @nthiery:
Do it! ;-) |
Changed reviewer from Volker Braun, Florent Hivert to Volker Braun, Florent Hivert, Travis Scrimshaw |
Changed author from Simon King to Simon King, Nicolas M. Thiéry |
comment:84
Then away we go. |
comment:85
Thanks for fixing this !!! |
Changed branch from public/nested_class-9107 to |
This comment has been minimized.
This comment has been minimized.
Changed commit from |
In the following class tree:
The names are set to
But
whereas one would expect
'Bla.Bla1.Bla11'
This breaks a lot of doc in categories and in particular in functorial constructions.
Apply
Depends on #12808
CC: @simon-king-jena @zabrocki
Component: categories
Author: Simon King, Nicolas M. Thiéry
Branch:
8b14e05
Reviewer: Volker Braun, Florent Hivert, Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/9107
The text was updated successfully, but these errors were encountered: