Skip to content

Commit 84a00be

Browse files
author
Philip Guo
committed
fixed a bug so that "x=None" will render properly
1 parent be842c7 commit 84a00be

2 files changed

Lines changed: 2 additions & 28 deletions

File tree

‎TODO‎

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -141,27 +141,6 @@ else:
141141
the appropriate annotations would display when you stepped through the
142142
line of code immediately below each annotation.
143143

144-
---
145-
2011-01-16
146-
147-
Bug report from Peter Wentworth
148-
149-
'''
150-
I also have what I think is a bug report: your front-end javascript treats variables with the value None as if they are undefined. (They are reflected in the trace that we get from the server.)
151-
152-
X = 123
153-
z = 'hello'
154-
x = None
155-
y = 123
156-
157-
del y
158-
print(x)
159-
print(type(x))
160-
161-
---
162-
I changed your script - around line 293 of edu-python.js, you have a condition checking for undefined (search for the comment containing “which is OKAY!”). I just eliminated the check, and can’t figure out which cases I might have broken it for!
163-
'''
164-
165144
---
166145
2011-05-23
167146

@@ -206,12 +185,6 @@ Peter
206185
---
207186
2011-09-15
208187

209-
- Peter Wentworth told me that my Online Python Tutor doesn't properly
210-
render 'None' types. e.g.,:
211-
212-
z = None
213-
214-
215188
- Integrate Peter's Python 3 fork into one unified application, and
216189
perhaps deploy online on WebFaction, since they offer both Python 2.X
217190
and Python 3.X on their servers.

‎edu-python.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,8 @@ function updateOutput() {
315315
// iterate IN ORDER (it's possible that not all vars are in curEntry.globals)
316316
$.each(orderedGlobals, function(i, varname) {
317317
var val = curEntry.globals[varname];
318-
if (val != undefined) { // might not be defined at this line, which is OKAY!
318+
// (use '!==' to do an EXACT match against undefined)
319+
if (val !== undefined) { // might not be defined at this line, which is OKAY!
319320
tbl.append('<tr><td class="varname"></td><td class="val"></td></tr>');
320321
var curTr = tbl.find('tr:last');
321322
curTr.find("td.varname").html(varname);

0 commit comments

Comments
 (0)