#8452: Code check: Pickling of nested classes
--------------------------------------------+-------------------------------
Reporter: mpatel | Owner: tbd
Type: enhancement | Status: needs_review
Priority: minor | Milestone: sage-4.3.4
Component: misc | Keywords:
Author: Florent Hivert, Mitesh Patel | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
--------------------------------------------+-------------------------------
Comment(by hivert):
Replying to [comment:3 mpatel]:
> The patch really just takes advantage of Sphinx's iteration over the
contents of the [documented] modules. Sphinx has a
[http://sphinx.pocoo.org/ext/doctest.html doctest extension], which blurs
the "line" between building the documentation and checking the code. If
the patch actually works, we could take it as an immediately available but
temporary solution while we consider other possibilities. But I don't
mind at all if we adopt a different approach.
I'm happy to report that the temporary solution is fully working. Running
a docbuild
I got
{{{
WARNING: Pickling of nested class
'sage.combinat.words.words.Words_all._python_object_alphabet' is probably
broken. Please set __metaclass__ of the parent class to
sage.misc.nested_class.NestedClassMetaclass.
}}}
And indeed:
{{{
----------------------------------------------------------------------
| Sage Version 4.3.4.alpha0, Release Date: 2010-03-03 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
**********************************************************************
* *
* Warning: this is a prerelease version, and it may be unstable. *
* *
**********************************************************************
Loading Sage library. Current Mercurial branch is: review
sage: sage: W = Words()
sage: sage: A = W._python_object_alphabet()
sage: sage: loads(dumps(A))
---------------------------------------------------------------------------
PicklingError Traceback (most recent call
last)
...
PicklingError: Can't pickle <class
'sage.combinat.words.words._python_object_alphabet'>: attribute lookup
sage.combinat.words.words._python_object_alphabet failed
}}}
I'll report it to the author and create the ticket tomorrow.
> We could create a new script `SAGE_LOCAL/bin/sage-analyze` with options
to run various checks on library source code. Users would call the script
directly or via `sage -analyze --option file ...`.
>
> Instead of starting completely from scratch, we could adapt or extend an
existing tool: [http://pychecker.sourceforge.net/ PyChecker],
[http://divmod.org/trac/wiki/DivmodPyflakes PyFlakes],
[http://www.logilab.org/project/pylint Pylint]. From my very limited
experience, I think Pylint is the most promising of these, as long as we
adjust the settings.
I think this is a very good idea. Nicolas advised me to use PyFlakes. It
work for what I need but I've no idea how to extend it.
> I think we could each review the other's contributions and maybe get an
assist from a third reviewer.
>
> I just noticed that I didn't put your name in the Author(s) field. I
apologize for that.
No problem. My work is already acknowledged as the author of #7448.
Symmetrically, You've done more than a review work on this ticket and
didn't add yourself as author... So please do as you consider fair. I
don't feel offended either way.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8452#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.