delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/09/20/02:23:06

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
X-ASG-Debug-ID: 1190269362-03c700060000-w5GHUG
X-Barracuda-URL: http://128.138.128.141:8000/cgi-bin/mark.cgi
From: Mike MacFerrin <Michael DOT MacFerrin AT Colorado DOT EDU>
X-ASG-Orig-Subj: Python 2.5.1: Potential Bug in "print"
Subject: Python 2.5.1: Potential Bug in "print"
To: cygwin AT cygwin DOT com
X-Mailer: Mirapoint Webmail Direct 3.8.5-GA
MIME-Version: 1.0
Message-Id: <20070920002241.AHA56826@riddler.int.colorado.edu>
Date: Thu, 20 Sep 2007 00:22:41 -0600 (MDT)
X-Barracuda-Connect: omr-raz-2-pub.colorado.edu[128.138.123.155]
X-Barracuda-Start-Time: 1190269362
X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at Colorado.EDU
X-Barracuda-Spam-Score: 0.00
X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests=
X-Barracuda-Spam-Report: Code version 3.1, rules version 3.1.28918 Rule breakdown below pts rule name description ---- ---------------------- --------------------------------------------------
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Note-from-DJ: This may be spam

I'm a grad student in a Compiler Tools course, and (as part of the course) we're compiling a subset of the Python language down to C, and from there to x86 Assmebly.  Our code has to pass a lengthy series of test-suites for correctness (comparing the output of our compiled C Code with that of native Python code), and I stumbled across what seems to be a quirky bug in Cygwin Python 2.5.1 (the most recent install). 

To the point.  If I run a simple two-line Python module: 

  print 0.0 
  print -0.0 

...it gives the following output (as you'd expect): 

  0.0 
  0.0 

However, if I remove the first line: 

  print -0.0 

...I get... 

  -0.0 

It seems to matter whether I've previously called "print 0.0" in the module.  No other "print <float>" commands make a difference.  Obviously, that seems strange (and doesn't follow the Python language definition). 

That behavior doesn't show up in other installs of Python I've seen (IDLE, Windows command-line, or Linux command-line), just in Cygwin. 

I'm not sure if this bug has been identified yet (it's a quirky corner case, and I didn't see anything to this affect in the Archives), but I thought I'd throw that out there.  Run python and check for yourself if you wanna see it (from the shell it always prints "-0.0", but from a file it's inconsistent.  Either way, it should just spit out "0.0"). 

In the meantime, I'm a bit frustrated that my code fails certain tests at home on Cygwin (due to no error of my own), but otherwise passes on the professor's box (MacOS command line).  Eh, I s'pose it's better than vice-versa, but still. 

Any suggestions or workarounds? 

Thanks, 

- Mike 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019