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
Starting sage with python3: crash handler cannot return the source of the crash #23876
Comments
Commit: |
comment:1
For information once you fix this, the real crash is
New commits:
|
Branch: u/fbissey/python3_crash |
Author: François Bissey |
comment:2
OK, the patch makes building the documentation fail with python2.7 so it will have to be more subtle than that. |
comment:3
To get the Sage library to build at all, I need to make this change: diff --git a/src/sage/misc/package.py b/src/sage/misc/package.py
index a3c3e923f6..fd58ddab29 100644
--- a/src/sage/misc/package.py
+++ b/src/sage/misc/package.py
@@ -144,7 +144,7 @@ def pip_installed_packages():
'...'
"""
proc = subprocess.Popen(["pip", "list", "--no-index", "--format", "json"], stdout=subprocess.PIPE)
- stdout = str(proc.communicate()[0])
+ stdout = proc.communicate()[0]
return {package['name'].lower():package['version'] for package in json.loads(stdout)}
def list_packages(*pkg_types, **opts): What else do I need to do to get to your stage? Do you have an experimental Python 3 branch? |
comment:4
I don't understand half the problems you have building with python3. sage-on-gentoo just builds out of the box with python3.6. That being said your problem is with I do not mess anything just to get python3 to build (apart from pynac for side by side python install), if there is something helping that's just a side effect. I guess you have the same kind of issue python3 must expect stdout to be bytes when in python2 it was made a nice string. |
comment:5
I am just finishing a build of sage-on-gentoo with both python2.7 and 3.6 - documentation build with 2.7 using this patch instead of what's in the branch diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py
index f9dffc1ce3..d6013851fc 100644
--- a/src/sage/misc/sageinspect.py
+++ b/src/sage/misc/sageinspect.py
@@ -1636,8 +1636,6 @@ def _sage_getdoc_unformatted(obj):
# not a 'getset_descriptor' or similar.
if not isinstance(r, string_types):
return ''
- elif isinstance(r, text_type): # unicode (py2) = str (py3)
- return r.encode('utf-8', 'ignore')
else:
return r
I'll see if it survives doctesting in a couple of minutes. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:7
Survived doctesting with python2.7 so I pushed. I am fairly sure that's the only place |
comment:8
I would prefer to replace
by
I think that would work on Python 3 and the functionality would remain exactly the same on Python 2 since we already know at that point that it's either |
Reviewer: Jeroen Demeyer |
comment:10
Ok Jeroen, it does work at runtime with python3. Doing a full build to see if work as intended with python2 including building documentation. |
comment:11
Looks like it does the job for both python2 and python3 so I made a clean branch. New commits:
|
Changed branch from u/fbissey/python3_crash to u/fbissey/23876v2 |
comment:12
The comment If the comment is fixed and |
comment:13
Although... maybe the code could be restructured to be more clear:
|
comment:14
I'll give that a go in the morning, I agree it looks a bit better. |
Changed branch from u/fbissey/23876v2 to u/fbissey/python3_crash |
Changed reviewer from Jeroen Demeyer to none |
Changed branch from u/fbissey/python3_crash to u/fbissey/23876v2 |
Reviewer: Jeroen Demeyer |
comment:17
(Sorry, when I added my last comment, I messed up various other fields for this ticket: "Reviewer", "Commit", "Branch". I've tried to fix them.) |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:19
Ok that works with python3 and pass |
comment:20
+1 |
Changed branch from u/fbissey/23876v2 to |
because the function that is supposed to provide the information is itself crashing.
When starting sage with python3.6, sage crashes immediately. The crash report ends up with
This is not the source of the crash. But the function supposed to provide information on the origin of the crash is itself crashing because
docstring
is of typestr
whenbytes
is required.The code is in
_sage_getdoc_unformatted
(docstring
is the return value of this function)For things to work properly I currently invert the last two returns call. It is probably sub-optimal. But after that operation the crash report works and give us the real reason sage crashed in the first place.
CC: @fchapoton
Component: python3
Author: François Bissey
Branch/Commit:
7076e8d
Reviewer: Jeroen Demeyer
Issue created by migration from https://trac.sagemath.org/ticket/23876
The text was updated successfully, but these errors were encountered: