This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Python 2.5.1: Potential Bug in "print"


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]