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

The variable "name" is predefined in Sage #8323

Closed
roed314 opened this issue Feb 22, 2010 · 8 comments
Closed

The variable "name" is predefined in Sage #8323

roed314 opened this issue Feb 22, 2010 · 8 comments

Comments

@roed314
Copy link
Contributor

roed314 commented Feb 22, 2010

Try the following:

sage: name
'KodairaSymbol'
sage: type(name)
<type 'str'>

I'm not sure where this gets imported, but it seems wrong.

Component: misc

Author: Craig Citro

Reviewer: Paul Zimmermann

Merged: sage-4.3.4.alpha0

Issue created by migration from https://trac.sagemath.org/ticket/8323

@craigcitro
Copy link
Member

Author: Craig Citro

@craigcitro
Copy link
Member

comment:1

It's coming from near line 150 in sage/all.py:

#Deprecate the is_* functions from the top level
#All of these functions should be removed from the top level
#after a few releases, and this code should be removed.
#--Mike Hansen 9/25/2008
globs = globals()
from functools import wraps, partial
for name,func in globs.items():

... but then name and func are never deleted. (Ahh, scoping in Python.) Sure enough, func is defined, too:

sage: func
<function KodairaSymbol at 0x10940daa0>

So I'm attaching an obvious patch -- there might be something classier, but this works. (And yes, this is still necessary in Py3.)

@zimmermann6
Copy link

comment:2

After applying the patch, sage -t gives the same 22 failures as with vanilla 4.3.3
(see #7773). However it would be good to add one test to check that name and func
are undefined at start.

@craigcitro
Copy link
Member

Attachment: trac_8323.2.patch.gz

@craigcitro
Copy link
Member

comment:3

Ahh, good point. We don't really have a standard place to put doctests for build/startup stuff, so I picked sage/misc/misc.py. If anyone can think of a better place, I'm happy to hear. (I don't think it's worth creating a whole new file for until we have a few more tests.)

I've added a test and a new version of the patch.

@zimmermann6
Copy link

Reviewer: Paul Zimmermann

@zimmermann6
Copy link

comment:4

I've added a test and a new version of the patch.

great: positive review for me.

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Mar 2, 2010

Merged: sage-4.3.4.alpha0

@sagetrac-mvngu sagetrac-mvngu mannequin added this to the sage-4.3.4 milestone Mar 2, 2010
@sagetrac-mvngu sagetrac-mvngu mannequin removed the s: positive review label Mar 2, 2010
@sagetrac-mvngu sagetrac-mvngu mannequin closed this as completed Mar 2, 2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants