A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-October.txt below:

List-Help: Delivered-To: mailing list gcc-announce@gcc.gnu.org Delivered-To: moderator for gcc-announce@gcc.gnu.org Received: (qmail 20621 invoked from network); 5 Oct 2000 23:58:16 -0000 Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII From: Gerald Pfeifer Sender: gcc-announce-owner@gcc.gnu.org To: gcc-announce@gcc.gnu.org Subject: GCC 2.96 Date: Fri, 6 Oct 2000 01:58:11 +0200 (CEST) It has come to our attention that some GNU/Linux distributions are currently shipping with ``GCC 2.96''. We would like to point out that GCC 2.96 is not a formal GCC release nor will there ever be such a release. Rather, GCC 2.96 has been the code- name for our development branch that will eventually become GCC 3.0. Current snapshots of GCC, and any version labeled 2.96, produce object files that are not compatible with those produced by either GCC 2.95.2 or the forthcoming GCC 3.0. Therefore, programs built with these snapshots will not be compatible with any official GCC release. Actually, C and Fortran code will probably be compatible, but code in other languages, most notably C++ due to incompatibilities in symbol encoding (``mangling''), the standard library and the application binary interface (ABI), is likely to fail in some way. Static linking against C++ libraries may make a binary more portable, at the cost of increasing file size and memory use. To avoid any confusion, we have bumped the version of our current development branch to GCC 2.97. Please note that both GCC 2.96 and 2.97 are development versions; we do not recommend using them for production purposes. Binaries built using any version of GCC 2.96 or 2.97 will not be portable to systems based on one of our regular releases. If you encounter a bug in a compiler labeled 2.96, we suggest you contact whoever supplied the compiler as we can not support 2.96 versions that were not issued by the GCC team. Please see http://gcc.gnu.org/snapshots.html if you want to use our latest snapshots. We suggest you use 2.95.2 if you are uncertain. The GCC Steering Committee --uThC8vgBh0-- From thomas@xs4all.net Fri Oct 6 01:29:11 2000 From: thomas@xs4all.net (Thomas Wouters) Date: Fri, 6 Oct 2000 02:29:11 +0200 Subject: [Python-Dev] forwarded message from Gerald Pfeifer In-Reply-To: <14813.6492.879919.445014@cj42289-a.reston1.va.home.com>; from fdrake@beopen.com on Thu, Oct 05, 2000 at 08:14:20PM -0400 References: <14813.6492.879919.445014@cj42289-a.reston1.va.home.com> Message-ID: <20001006022910.J12812@xs4all.nl> On Thu, Oct 05, 2000 at 08:14:20PM -0400, Fred L. Drake, Jr. wrote: > I just got this message from the gcc-announce list. We've seen bug > reports related to GCC 2.96 (which may or may not be the problem). We > need to be aware that these releases are out there and can be a > problem. > I've noticed that the version of GCC shipped with Mandrake 7.1 is > "gcc version 2.95.3 19991030 (prerelease)", which doesn't give my much > confidence either. ;( The 'unstable' branch of Debian currently ships with: gcc version 2.95.2 20000220 (Debian GNU/Linux) and it seems to be working fine. I did notice a problem, but it was related to glibc 2.1.94, not gcc: LONG_BIT was wrongly defined to 64. Tim's sanity-check, which checks LONG_BIT against (SIZEOF_LONG * 8), would have caught that one, but I found it on my machine before he checked in that fix ;) For me, that problem was caused by the /usr/include/bits/xopen_lim.h include file: /* Number of bits in a word of type ong int'. */ #if LONG_MAX == 2147483647 # define LONG_BIT 32 #else /* Safe assumption. */ # define LONG_BIT 64 #endif where LONG_MAX was not defined (yet). I fixed it 'manually' for more than just Python by adding #ifndef LONG_MAX #define LONG_MAX 2147483647 #endif above it. I had to laugh, though, when I saw that assuming longs had 64 bits is considered 'a safe assumption'. I guess most people use 64 bit machines nowadays ? :-) I'm not complaining about this, though. Woody (Debian's current unstable tree) is bleeding edge, and I'm fully prepared to live with it. In fact, I love it! But people testing out glibc 2.1.90+ should keep this in mind. I'm also wondering where to send my bugreport, but I think I'll read some documentation before I do that, first ;) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From fdrake@beopen.com Fri Oct 6 02:37:40 2000 From: fdrake@beopen.com (Fred L. Drake, Jr.) Date: Thu, 5 Oct 2000 21:37:40 -0400 (EDT) Subject: [Python-Dev] forwarded message from Gerald Pfeifer In-Reply-To: <20001006022910.J12812@xs4all.nl> References: <14813.6492.879919.445014@cj42289-a.reston1.va.home.com> <20001006022910.J12812@xs4all.nl> Message-ID: <14813.11492.123197.791450@cj42289-a.reston1.va.home.com> Thomas Wouters writes: > The 'unstable' branch of Debian currently ships with: > gcc version 2.95.2 20000220 (Debian GNU/Linux) > > and it seems to be working fine. I did notice a problem, but it was related I understand this to be the latest "stable" version of GCC, and it appearantly it has been accepted as such for a while now. > above it. I had to laugh, though, when I saw that assuming longs had 64 bits > is considered 'a safe assumption'. I guess most people use 64 bit machines > nowadays ? :-) Hey, my machine is 4294967296 bits! Forget those ancient 64 bit machines! ;-) > I'm not complaining about this, though. Woody (Debian's current unstable > tree) is bleeding edge, and I'm fully prepared to live with it. In fact, I > love it! But people testing out glibc 2.1.90+ should keep this in mind. I'm I'm less concerned about people who know they're deliberatly putting themselves on the bleeding edge than the people that pick up the latest version of some Linux distribution and find they have a buggy compiler because the distribution builders weren't as careful as perhaps they should have been. Putting together a professional grade Linux distro is still a very hard thing. There's no such thing as enough testing here! -Fred -- Fred L. Drake, Jr. BeOpen PythonLabs Team Member From MarkH@ActiveState.com Fri Oct 6 04:52:13 2000 From: MarkH@ActiveState.com (Mark Hammond) Date: Fri, 6 Oct 2000 14:52:13 +1100 Subject: [Python-Dev] RE: buffer overlow in PC/getpathp.c In-Reply-To: Message-ID: [Me, responding to Jeremy's request I look for potential buffer exploits on Windows...] > I will be happy to look into this. And was :-) If anyone has time over the next day or 2, any holes I either missed, or added(!) in http://sourceforge.net/patch/?func=detailpatch&patch_id=101801&group_id=547 0 would be appreciated! Thanks, Mark. From thomas.heller@ion-tof.com Fri Oct 6 08:20:56 2000 From: thomas.heller@ion-tof.com (Thomas Heller) Date: Fri, 6 Oct 2000 09:20:56 +0200 Subject: [Python-Dev] Proposal -- makefile patches and scripts to generate python RPMs References: <200010050744.JAA00782@loewis.home.cs.tu-berlin.de><200010051833.NAA14356@cj20424-a.reston1.va.home.com> <14812.64697.601359.920302@bitdiddle.concentric.net> Message-ID: <003d01c02f65$fb409550$4500a8c0@thomasnotebook> > I don't actually use a script to generate the RPM. I wrote a .spec > file by hand and use it to generate the RPMs using the rpm command. > I could check in the spec file, which I would end up changing every > time we do a release -- to update the version number, change the > Setup.in patch, etc. I should probably also include the patch file > along with the .spec file. > > I also wrote a smal distutils setup script for 2.0b2, which I should > check in somewhere. Not sure where... > Could you post this script? Thomas From loewis@informatik.hu-berlin.de Thu Oct 5 20:49:26 2000 From: loewis@informatik.hu-berlin.de (Martin von Loewis) Date: Thu, 5 Oct 2000 21:49:26 +0200 (MET DST) Subject: [Python-Dev] PEP 4: Deprecation of standard modules Message-ID: <200010051949.VAA04764@pandora.informatik.hu-berlin.de> I just finished a first draft of a PEP on deprecating (and eventually removing) modules from the standard Python library; it is available from http://python.sourceforge.net/peps/pep-0004.html If you have comments or suggestions on the proposed procedures, or the wording of the text, please send me a message. According to the PEP procedures (PEP 1), this is the preferred way of progressing this PEP (rather than discussing it on these lists), at least initially. Regards, Martin From loewis@informatik.hu-berlin.de Fri Oct 6 13:39:05 2000 From: loewis@informatik.hu-berlin.de (Martin von Loewis) Date: Fri, 6 Oct 2000 14:39:05 +0200 (MET DST) Subject: [Python-Dev] htmllib.HTMLescape() Message-ID: <200010061239.OAA13090@pandora.informatik.hu-berlin.de> > The difficulty, I assume, lies in figuring out which encodings > support what characters. It's not that difficult to write a set of new codecs; with the module below, I can do >>> import xmlenc >>> u'\u0416'.encode('latin-1-xml') 'Ж' >>> unicode('XɅY','latin-1-xml') u'X\u0245Y' The difficulty is that the algorithm is not very efficient if there are many unsupported characters in a string. Regards, Martin # Module implementing a set of new encodings of the form -xml # Copyright Martin v. Löwis # It currently supports hex character references only import codecs class CodecWrapper: def __init__(self,encoder,decoder): self.encoder = encoder self.decoder = decoder def encode(self,input,errors='strict'): try: return self.encoder(input,"strict") except ValueError: l = len(input) if l==1: return "&#x%x;" % ord(input), 1 s1,l1 = self.encode(input[:l/2]) s2,l2 = self.encode(input[l/2:]) return s1+s2,l1+l2 def decode(self,input,errors='strict'): input = str(input) # might be buffer object pos = input.find("&#x") if pos == -1: return self.decoder(input,errors) r1,l1 = self.decode(input[:pos],errors) end = input.find(";",pos) try: if end==-1: raise ValueError # goto failure code below val = int(input[pos+3:end],16) r2,l2 = self.decode(input[end+1:],errors) return r1+unichr(val)+r2,l1+end-pos+l2 except ValueError: # how to deal with errors in decode? r2,l2 = self.decode(input[pos+2:],errors) return r1+"&#x"+r2,l1+3+l2 def mkreader(self): r = codecs.StreamReader() r.decode = self.decode r.encode = self.encode return r def mkwriter(self): r = codecs.StreamWriter() r.decode = self.decode r.encode = self.encode return r def search_function(encoding): if not encoding.endswith("-xml"): return None enc,dec,reader,writer = codecs.lookup(encoding[:-4]) c = CodecWrapper(enc,dec) return c.encode,c.decode,c.mkreader,c.mkwriter codecs.register(search_function) From jeremy@beopen.com Fri Oct 6 15:54:03 2000 From: jeremy@beopen.com (Jeremy Hylton) Date: Fri, 6 Oct 2000 10:54:03 -0400 (EDT) Subject: [Python-Dev] Proposal -- makefile patches and scripts to generate python RPMs In-Reply-To: <003d01c02f65$fb409550$4500a8c0@thomasnotebook> References: <200010050744.JAA00782@loewis.home.cs.tu-berlin.de> <200010051833.NAA14356@cj20424-a.reston1.va.home.com> <14812.64697.601359.920302@bitdiddle.concentric.net> <003d01c02f65$fb409550$4500a8c0@thomasnotebook> Message-ID: <14813.59275.350667.580400@bitdiddle.concentric.net> --cQL1MOyU0I Content-Type: text/plain; charset=us-ascii Content-Description: message body text Content-Transfer-Encoding: 7bit Here is the setup script I used to build the Tk RPMs. The name and version part is a mess and I would welcome suggestions on how to fix it. The problem is that Tkinter gets built against a particular version of Python and a particular version of Tcl/Tk. I want the name of the RPM to indiciate both versions, but didn't seem an obvious way to accomplish it. Thus, I put the Python version number in the name and the Tcl/Tk version number in the version. Otherwise, I think this is pretty straightforward distutils stuff (although the documentation was out of date last I checked). I've attached three files. I wrote setup.py and setup.cfg. Distutils created MANIFEST. Jeremy --cQL1MOyU0I Content-Type: text/plain Content-Disposition: inline; filename="setup.py" Content-Transfer-Encoding: 7bit #! /usr/bin/env python """Tkinter is the Python interface to the Tk GUI toolkit. Tk offers native look and feel on most major platforms, including Unix, Windows, and Macintosh. The Tkinter-2.0 RPM contains the Python C extension module for Python 2.0. The Python source files are distributed with the main Python distribution.""" from distutils.core import setup, Extension setup(name="Tkinter-2.0", version="8.0", description="Python interface to Tk GUI toolkit", author="Python development team", author_email="pythoneers@beopen.com", url="http://www.pythonlabs.com/products/python2.0/", licence="Modified CNRI Open Source License", ext_modules=[Extension("_tkinter", ["src/_tkinter.c", "src/tkappinit.c"], define_macros=[('WITH_APPINIT', None)], library_dirs=["/usr/X11R6/lib"], libraries=["tk8.0", "tcl8.0", "X11"], )], long_description = __doc__ ) --cQL1MOyU0I Content-Type: text/plain Content-Disposition: inline; filename="setup.cfg" Content-Transfer-Encoding: 7bit [bdist_rpm] packager = Jeremy Hylton vendor = BeOpen PythonLabs --cQL1MOyU0I Content-Type: text/plain Content-Disposition: inline; filename="MANIFEST" Content-Transfer-Encoding: 7bit setup.py src/_tkinter.c src/tkappinit.c --cQL1MOyU0I-- From jeremy@beopen.com Fri Oct 6 20:11:43 2000 From: jeremy@beopen.com (Jeremy Hylton) Date: Fri, 6 Oct 2000 15:11:43 -0400 (EDT) Subject: [Python-Dev] linuxaudiodev module Message-ID: <14814.9199.422989.273484@bitdiddle.concentric.net> I just fixed a number of major bugs in the undocumented linuxaudiodev module. I ended up spending about an hour reading the excellent Open Sound System (OSS) Programmer's Guide to figure out what the module was trying to do and why it wasn't working on my Linux box. After reading the module and the OSS guide, it is clear to me that we need a complete re-write. The module itself is just a wrapper around a bunch of read, write, and ioctl calls. It could all be implemented in pure Python. I propose we develop a Python module for Python 2.1 and call it osslib. There is nothing at all that is Linux-specific about the interface being used. The OSS guide mentions a plethora of platforms that it supports. In the interim, I have fixed some of the most egregious problems. I would appreciate it if Linux users could try out the fixes and the new test case. On my machine it still sounds awful, but at least the sound can be heard. Jeremy From akuchlin@mems-exchange.org Fri Oct 6 20:17:39 2000 From: akuchlin@mems-exchange.org (Andrew Kuchling) Date: Fri, 6 Oct 2000 15:17:39 -0400 Subject: [Python-Dev] linuxaudiodev module In-Reply-To: <14814.9199.422989.273484@bitdiddle.concentric.net>; from jeremy@beopen.com on Fri, Oct 06, 2000 at 03:11:43PM -0400 References: <14814.9199.422989.273484@bitdiddle.concentric.net> Message-ID: <20001006151739.A31189@kronos.cnri.reston.va.us> On Fri, Oct 06, 2000 at 03:11:43PM -0400, Jeremy Hylton wrote: >After reading the module and the OSS guide, it is clear to me that we >need a complete re-write. The module itself is just a wrapper around >a bunch of read, write, and ioctl calls. It could all be implemented >in pure Python. So, is there any point in releasing linuxaudiodev at all, then, if it needs a complete rewrite? --amk From DavidA@ActiveState.com Fri Oct 6 20:39:21 2000 From: DavidA@ActiveState.com (David Ascher) Date: Fri, 6 Oct 2000 12:39:21 -0700 (Pacific Daylight Time) Subject: [Python-Dev] linuxaudiodev module In-Reply-To: <14814.9199.422989.273484@bitdiddle.concentric.net> Message-ID: > I propose we develop a Python module for Python 2.1 and call it > osslib. There is nothing at all that is Linux-specific about the > interface being used. The OSS guide mentions a plethora of platforms > that it supports. Have you evaluated http://net.indra.com/~tim/ossmodule/ ? From jeremy@beopen.com Fri Oct 6 20:47:27 2000 From: jeremy@beopen.com (Jeremy Hylton) Date: Fri, 6 Oct 2000 15:47:27 -0400 (EDT) Subject: [Python-Dev] linuxaudiodev module In-Reply-To: <20001006151739.A31189@kronos.cnri.reston.va.us> References: <14814.9199.422989.273484@bitdiddle.concentric.net> <20001006151739.A31189@kronos.cnri.reston.va.us> Message-ID: <14814.11343.988335.520786@bitdiddle.concentric.net> >>>>> "AMK" == Andrew Kuchling writes: AMK> On Fri, Oct 06, 2000 at 03:11:43PM -0400, Jeremy Hylton wrote: >> After reading the module and the OSS guide, it is clear to me >> that we need a complete re-write. The module itself is just a >> wrapper around a bunch of read, write, and ioctl calls. It could >> all be implemented in pure Python. AMK> So, is there any point in releasing linuxaudiodev at all, then, AMK> if it needs a complete rewrite? I would be include to chuck it, except that it also shipped with 1.6. I would hestitate to deprecate it so far into the release process. jeremy From jeremy@beopen.com Fri Oct 6 20:47:48 2000 From: jeremy@beopen.com (Jeremy Hylton) Date: Fri, 6 Oct 2000 15:47:48 -0400 (EDT) Subject: [Python-Dev] linuxaudiodev module In-Reply-To: References: <14814.9199.422989.273484@bitdiddle.concentric.net> Message-ID: <14814.11364.360443.940965@bitdiddle.concentric.net> I had no idea it existed. Jeremy From jeremy@beopen.com Fri Oct 6 20:54:35 2000 From: jeremy@beopen.com (Jeremy Hylton) Date: Fri, 6 Oct 2000 15:54:35 -0400 (EDT) Subject: [Python-Dev] linuxaudiodev module In-Reply-To: References: <14814.9199.422989.273484@bitdiddle.concentric.net> Message-ID: <14814.11771.731237.214646@bitdiddle.concentric.net> >>>>> "DA" == David Ascher writes: DA> Have you evaluated http://net.indra.com/~tim/ossmodule/ Okay. I took a quick look. It's really old (July 1997). It looks like a more reasonable wrapping than linuxaudiodev, although I would want to review it more carefully against the OSS programmer's guide. I would prefer a pure Python solution, because the code would be shorter and easier to read and maintain. It may be, however, that the ossmodule is still up-to-date; if so, it may be easier to use it than to rewrite it. Jeremy From ping@lfw.org Fri Oct 6 22:13:39 2000 From: ping@lfw.org (Ka-Ping Yee) Date: Fri, 6 Oct 2000 16:13:39 -0500 (CDT) Subject: [Python-Dev] linuxaudiodev module In-Reply-To: <14814.9199.422989.273484@bitdiddle.concentric.net> Message-ID: On Fri, 6 Oct 2000, Jeremy Hylton wrote: > After reading the module and the OSS guide, it is clear to me that we > need a complete re-write. The module itself is just a wrapper around > a bunch of read, write, and ioctl calls. It could all be implemented > in pure Python. True. I think your osslib is a good idea. I wanted to take on this sort of project myself a few weeks ago but never had the time to really get started. From playing with the test script, i think all we care about having in C is audioop (and that's just for ulaw conversion). I would like to fix audioop so we can expect it to be present as a standard module; then we can have a module written in Python that provides uniform sound support for all platforms. > On my machine it still sounds awful, but at least the > sound can be heard. It should not sound awful. If it sounds too loud and scratchy, then maybe you need to use audioop to convert from Sun .au (ulaw) to raw samples first. This was the case with the Spanish inquisition clip. -- ?!ng From jeremy@beopen.com Fri Oct 6 23:28:57 2000 From: jeremy@beopen.com (Jeremy Hylton) Date: Fri, 6 Oct 2000 18:28:57 -0400 (EDT) Subject: [Python-Dev] linuxaudiodev module In-Reply-To: References: <14814.9199.422989.273484@bitdiddle.concentric.net> Message-ID: <14814.21033.195290.728159@bitdiddle.concentric.net> >>>>> "KPY" == Ka-Ping Yee writes: >> On my machine it still sounds awful, but at least the sound can >> be heard. KPY> It should not sound awful. If it sounds too loud and scratchy, KPY> then maybe you need to use audioop to convert from Sun .au KPY> (ulaw) to raw samples first. This was the case with the KPY> Spanish inquisition clip. I don't think I know how to do that. I tried using sox to convert audiotest.au to audiotest.raw and it sounded just as bad on my machine. Perhaps I have my machine configured incorrectly, although CDs and Real Audio sound fine. Have you tried the new code, BTW? Does the test work on your machine? Jeremy From tim_one@email.msn.com Fri Oct 6 23:28:53 2000 From: tim_one@email.msn.com (Tim Peters) Date: Fri, 6 Oct 2000 18:28:53 -0400 Subject: [Python-Dev] test_StringIO broken Message-ID: test test_StringIO failed -- Writing: "'abcde'", expected: 'abcdefg' 1 test failed: test_StringIO This on Win98SE, broke sometime late this afternoon (EDT). Working elsewhere? From jeremy@beopen.com Fri Oct 6 23:59:41 2000 From: jeremy@beopen.com (Jeremy Hylton) Date: Fri, 6 Oct 2000 18:59:41 -0400 (EDT) Subject: [Python-Dev] test_StringIO broken In-Reply-To: References: Message-ID: <14814.22877.882280.651958@bitdiddle.concentric.net> The test was changed in a number of ways, but whoever checked it in didn't actually run the regression test! Also, the last messsage I see printed is: Failed to catch ValueError writing to closed StringIO. This ain't a case of forgetting to generate new output. This is just plain wrong. Jeremy From thomas@xs4all.net Fri Oct 6 23:56:08 2000 From: thomas@xs4all.net (Thomas Wouters) Date: Sat, 7 Oct 2000 00:56:08 +0200 Subject: [Python-Dev] test_StringIO broken In-Reply-To: ; from tim_one@email.msn.com on Fri, Oct 06, 2000 at 06:28:53PM -0400 References: Message-ID: <20001007005608.K12812@xs4all.nl> On Fri, Oct 06, 2000 at 06:28:53PM -0400, Tim Peters wrote: > test test_StringIO failed -- Writing: "'abcde'", expected: 'abcdefg' > 1 test failed: test_StringIO > This on Win98SE, broke sometime late this afternoon (EDT). Working > elsewhere? No. Fails the same way on my Linux box. And the problem is probably that the test was updated (two tests were uncommented) but the output file wasn't updated. Jim Fulton did the checkin, so he looks like the right person to fix it (and manually check that the generated output file is *correct*, of course ! ;) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From DavidA@ActiveState.com Sat Oct 7 00:01:37 2000 From: DavidA@ActiveState.com (David Ascher) Date: Fri, 6 Oct 2000 16:01:37 -0700 (Pacific Daylight Time) Subject: [Python-Dev] linuxaudiodev module In-Reply-To: <14814.11771.731237.214646@bitdiddle.concentric.net> Message-ID: > Okay. I took a quick look. It's really old (July 1997). It looks > like a more reasonable wrapping than linuxaudiodev, although I would > want to review it more carefully against the OSS programmer's guide. > > I would prefer a pure Python solution, because the code would be > shorter and easier to read and maintain. It may be, however, that the > ossmodule is still up-to-date; if so, it may be easier to use it than > to rewrite it. Absolutely. I just remember some announcement about it. I suspect that what I remember is not that old, so it may make sense to do a little more digging than I did in the archives... --david From thomas@xs4all.net Fri Oct 6 23:58:19 2000 From: thomas@xs4all.net (Thomas Wouters) Date: Sat, 7 Oct 2000 00:58:19 +0200 Subject: [Python-Dev] test_StringIO broken In-Reply-To: <14814.22877.882280.651958@bitdiddle.concentric.net>; from jeremy@beopen.com on Fri, Oct 06, 2000 at 06:59:41PM -0400 References: <14814.22877.882280.651958@bitdiddle.concentric.net> Message-ID: <20001007005819.L12812@xs4all.nl> On Fri, Oct 06, 2000 at 06:59:41PM -0400, Jeremy Hylton wrote: > Also, the last messsage I see printed is: > Failed to catch ValueError writing to closed StringIO. > This ain't a case of forgetting to generate new output. This is just > plain wrong. Hm, are you sure you re-built your modules before doing that ? The output looks okay on my linux box, in any case. The last message is 'Caught expected ValueError writing to closed StringIO: I/O operation on closed file', for me. If you recompiled cStringIO, something odd is going on ;) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From jeremy@beopen.com Sat Oct 7 00:06:32 2000 From: jeremy@beopen.com (Jeremy Hylton) Date: Fri, 6 Oct 2000 19:06:32 -0400 (EDT) Subject: [Python-Dev] test_StringIO broken In-Reply-To: <20001007005819.L12812@xs4all.nl> References: <14814.22877.882280.651958@bitdiddle.concentric.net> <20001007005819.L12812@xs4all.nl> Message-ID: <14814.23288.490631.990498@bitdiddle.concentric.net> >>>>> "TW" == Thomas Wouters writes: TW> On Fri, Oct 06, 2000 at 06:59:41PM -0400, Jeremy Hylton wrote: >> Also, the last messsage I see printed is: Failed to catch >> ValueError writing to closed StringIO. >> This ain't a case of forgetting to generate new output. This is >> just plain wrong. TW> Hm, are you sure you re-built your modules before doing that ? This is probably what went wrong for me. Jeremy From guido@python.org Sat Oct 7 14:51:12 2000 From: guido@python.org (Guido van Rossum) Date: Sat, 07 Oct 2000 08:51:12 -0500 Subject: [Python-Dev] Tcl and Unicode In-Reply-To: Your message of "Fri, 06 Oct 2000 16:09:03 MST." <200010062309.QAA32052@slayer.i.sourceforge.net> References: <200010062309.QAA32052@slayer.i.sourceforge.net> Message-ID: <200010071351.IAA02962@cj20424-a.reston1.va.home.com> > Fix for next iteration of SF bug 115690 (Unicode headaches in IDLE). The > parsing functions in support of auto-indent weren't expecting Unicode > strings, but text.get() can now return them (although it remains muddy as > to exactly when or why that can happen). Fixed that with a Big Hammer. I apologize, I should have explained when text.get() returns Unicode: Any string returned from Tcl/Tk that contains a byte with the 8th bit set is translated from UTF-8 into Unicode, unless the translation fails (in which case the original raw 8-bit string is returned as a fallback). This *should* be correct because Tcl/Tk always uses UTF-8 internally. (Even though it is "lenient" when receiving strings -- if a sequence of characters has no valid Unicode representation, it appears to falls back to Latin-1; I don't know the details of this algorithm.) --Guido van Rossum (home page: http://www.python.org/~guido/) From tim_one@email.msn.com Sat Oct 7 19:43:55 2000 From: tim_one@email.msn.com (Tim Peters) Date: Sat, 7 Oct 2000 14:43:55 -0400 Subject: [Python-Dev] Tcl and Unicode In-Reply-To: <200010071351.IAA02962@cj20424-a.reston1.va.home.com> Message-ID: >> Fix for next iteration of SF bug 115690 (Unicode headaches in >> IDLE). ... [Guido] > I apologize, I should have explained when text.get() returns Unicode: > > Any string returned from Tcl/Tk that contains a byte with the 8th bit > set is translated from UTF-8 into Unicode, unless the translation > fails (in which case the original raw 8-bit string is returned as a > fallback). Except that's *why* it was muddy : in the specific case that popped up in the bug, text.get() appeared to return a Unicode string of length 1 containing only a newline. No high-bit byte appeared to be involved. However, that was an illusion I didn't unmask until later. All is clear now. > This *should* be correct because Tcl/Tk always uses UTF-8 internally. > (Even though it is "lenient" when receiving strings -- if a sequence > of characters has no valid Unicode representation, it appears to falls > back to Latin-1; I don't know the details of this algorithm.) Dunno, but wouldn't be surprised if they had a notion of default encoding, and that it simply appears to be Latin-1 to us because American Windows uses a superset of Latin-1. If BeOpen would like to buy me a version of Chinese Windows, happy to lend it to you . as-american-as-they-come-ly y'rs - tim From guido@python.org Sun Oct 8 02:41:11 2000 From: guido@python.org (Guido van Rossum) Date: Sat, 07 Oct 2000 20:41:11 -0500 Subject: [Python-Dev] linuxaudiodev module In-Reply-To: Your message of "Fri, 06 Oct 2000 18:28:57 -0400." <14814.21033.195290.728159@bitdiddle.concentric.net> References: <14814.9199.422989.273484@bitdiddle.concentric.net> <14814.21033.195290.728159@bitdiddle.concentric.net> Message-ID: <200010080141.UAA19858@cj20424-a.reston1.va.home.com> I think I fixed the linuxaudio test -- see if it sounds reasonable now! The crux of the matter seemed to be that the last, optional argument to setparameters(), meaning "emulate the format if the sound card doesn't support it", is not supported right. It suppresses the error message, and the ioctl to set the format succeeds, but the emulation doesn't work (at least not on my system, or on Jeremy's). So I've used a subterfuge: assuming most sound cards support signed 16-bit native-endian format, I convert the data to that format, and use the appropriate format code: AFMT_S16_LE for little-endian machines, AFMT_S16_BE for big-endian machines. I've only tested little-endian. I use the new sys.byteorder variable to determine the endianness. I use the audioop module to do the conversion. Much simpler than sox! (Oh feeling of nostalgia... I wrote several of the file format handlers for sox, and fixed lots of bugs in it too... I even started the audio file formats FAQ, now maintained by Chris Bagwell, who also took over sox...) Downside: test_linuxaudiodev will now be skipped if you don't have the audioop enabled in your Setup file. But that's fixed easily. By the way -- the checkin freeze for the release candidate should go in just about now... --Guido van Rossum (home page: http://www.python.org/~guido/) From tim_one@email.msn.com Sun Oct 8 11:32:36 2000 From: tim_one@email.msn.com (Tim Peters) Date: Sun, 8 Oct 2000 06:32:36 -0400 Subject: [Python-Dev] A standard lexer? In-Reply-To: <00f201bfe475$d5e00c40$f2a6b5d4@hagrid> Message-ID: Blast from the past! [/F] > for phrase, action in lexicon: > p.append("(?:%s)(?P#%d)" % (phrase, len(p))) [Tim] > How about instead enhancing existing (?P pattern) notation, to > set a new match object attribute to name if & when pattern matches? > Then arbitrary info associated with a named pattern can be gotten at > via dicts via the pattern name, & the whole mess should be more > readable. [/F Sent: Sunday, July 02, 2000 6:35 PM] > I just added "lastindex" and "lastgroup" attributes to the match object. > > "lastindex" is the integer index of the last matched capturing group, > "lastgroup" the corresponding name (or None, if the group didn't have > a name). both attributes are None if no group were matched. Reviewing this before 2.0 has been on my todo list for 3+ months, and finally got to it. Good show! I converted some of my by-hand scanners to use lastgroup, and like it a whole lot. I know you understand why this is Good, so here's a simple example of an "after" tokenizer for those who don't (this one happens to tokenize REXX-like PARSE stmts): import re _token = re.compile(r""" (?P \s+) | (?P [a-zA-Z_]\w*) | (?P \.) | (?P \d+) | (?P [-+=()]) | (?P " [^"\\\n]* (?: \\. [^"\\\n]*)* " | ' [^'\\\n]* (?: \\. [^'\\\n]*)* ' ) """, re.VERBOSE).match del re (T_SPACE, T_VAR, T_DONTCARE, T_NUMBER, T_PUNC, T_STRING, T_EOF, ) = range(7) # For debug output. _enum2name = ["T_SPACE", "T_VAR", "T_DONTCARE", "T_NUMBER", "T_PUNC", "T_STRING", "T_EOF", ] _group2action = { "space": (T_SPACE, None), "var": (T_VAR, None), "dontcare": (T_DONTCARE, None), "number": (T_NUMBER, int), "punc": (T_PUNC, None), "string": (T_STRING, eval), } def tokenize(s, tokeneater): i, n = 0, len(s) while i < n: m = _token(s, i) if not m: raise ParseError(s, i) group = m.lastgroup enum, action = _group2action[group] val = m.group(group) if action is not None: val = action(val) tokeneater(enum, val) i = m.end() tokeneater(T_EOF, None) The tokenize function here used to be a mass of if/elif stmts trying to figure out which group had matched. Now it's all table-driven: easier to write, reuse & maintain, and quicker to boot. +1. the-aged-may-be-slow-but-they-never-forget -ly y'rs - tim From Fredrik Lundh" Message-ID: <016b01c03117$a3cb6a80$766940d5@hagrid> guido: > > This *should* be correct because Tcl/Tk always uses UTF-8 internally. > > (Even though it is "lenient" when receiving strings -- if a sequence > > of characters has no valid Unicode representation, it appears to falls > > back to Latin-1; I don't know the details of this algorithm.) Tcl/Tk uses a 16-bit (UCS-2) unicode string type internally, but their 8-bit strings use UTF-8. When converting from external 8-bit strings to unicode, they convert valid UTF-8 sequences to unicode characters just like Python, but "a lead-byte not followed by enough trail-bytes represents itself." (in other words, it's cast from an unsigned char to an unsigned short). And the chance that any reasonable Latin-1 string would contain a UTF-8 lead bytes followed by the right number of UTF-8 trail bytes is close to zero... (in case anyone wonders, Python's codec thinks that "close to zero" isn't good enough, so it raises an exception instead) tim: > Dunno, but wouldn't be surprised if they had a notion of default encoding, > and that it simply appears to be Latin-1 to us because American Windows uses > a superset of Latin-1. They have a system encoding, but it's not used here -- it's just that Latin-1 is a subset of Unicode... From thomas@xs4all.net Sun Oct 8 12:14:33 2000 From: thomas@xs4all.net (Thomas Wouters) Date: Sun, 8 Oct 2000 13:14:33 +0200 Subject: [Python-Dev] Release candidate Message-ID: <20001008131433.M12812@xs4all.nl> Is there any chance we can get the 'release candidate' released on the SF File Module thingy as well ? Mailman uses this for the betas, for instance, and I think it would attract that bit more attention to it. I believe the 'release' gets listed on various SF pages that way. -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From barry@scottb.demon.co.uk Sun Oct 8 15:36:45 2000 From: barry@scottb.demon.co.uk (Barry Scott) Date: Sun, 8 Oct 2000 15:36:45 +0100 Subject: [Python-Dev] Python 2.0b2 note for Windows developers In-Reply-To: Message-ID: <000401c03135$2ebd4ec0$060210ac@private> Tim, Two requests: 1. Can you ship the .PDB files for the debug images so devo's do not need to build the python sources to debug extensions. And Yes I know the .ZIP will be huge. If you want a compromise only include the .PDB for python20_d.dll. 2. Place the files into libs, pyd etc dirs. I had to extract the groups into the right places which is a bit tedious and error prone. BArry > -----Original Message----- > From: python-dev-admin@python.org [mailto:python-dev-admin@python.org]On > Behalf Of Tim Peters > Sent: 27 September 2000 23:40 > To: PythonDev; Python list > Subject: [Python-Dev] Python 2.0b2 note for Windows developers > > > Since most Python users on Windows don't have any use for them, I trimmed > the Python 2.0b2 installer by leaving out the debug-build .lib, .pyd, .exe > and .dll files. If you want them, they're available in a separate zip > archive; read the Windows Users notes at > > http://www.pythonlabs.com/products/python2.0/download_python2.0b2.html > > for info and a download link. If you don't already know *why* you might > want them, trust me: you don't want them . > > they-don't-even-make-good-paperweights-ly y'rs - tim > > > > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > http://www.python.org/mailman/listinfo/python-dev > From ping@lfw.org Sun Oct 8 19:19:51 2000 From: ping@lfw.org (Ka-Ping Yee) Date: Sun, 8 Oct 2000 11:19:51 -0700 (PDT) Subject: [Python-Dev] linuxaudiodev module In-Reply-To: <14814.21033.195290.728159@bitdiddle.concentric.net> Message-ID: On Fri, 6 Oct 2000, Jeremy Hylton wrote: > > Have you tried the new code, BTW? Does the test work on your machine? Works okay (i updated after Guido's last edit). Sounds fine to me. But it bugs me that some of the descriptions say "audio" and others say "format". This seems arbitrary -- is there a reason? Excerpt of Modules/linuxaudiodev.c: { 8, »­­­­­AFMT_MU_LAW, "Logarithmic mu-law audio" }, { 8, »­­­­­AFMT_A_LAW, "Logarithmic A-law audio" }, { 8,»­­­­­­AFMT_U8, "Standard unsigned 8-bit audio" }, { 8, »­­­­­AFMT_S8, "Standard signed 8-bit audio" }, { 16, »­­­­­AFMT_U16_BE, "Big-endian 16-bit unsigned format" }, { 16, »­­­­­AFMT_U16_LE, "Little-endian 16-bit unsigned format" }, { 16, »­­­­­AFMT_S16_BE, "Big-endian 16-bit signed format" }, { 16, »­­­­­AFMT_S16_LE, "Little-endian 16-bit signed format" }, If you don't mind, i'd prefer something like: { 8, »­­­­­AFMT_MU_LAW, "logarithmic mu-law 8-bit audio" }, { 8, »­­­­­AFMT_A_LAW, "logarithmic A-law 8-bit audio" }, { 8,»­­­­­­AFMT_U8, "linear unsigned 8-bit audio" }, { 8, »­­­­­AFMT_S8, "linear signed 8-bit audio" }, { 16, »­­­­­AFMT_U16_BE, "linear unsigned 16-bit big-endian audio" }, { 16, »­­­­­AFMT_U16_LE, "linear unsigned 16-bit little-endian audio" }, { 16, »­­­­­AFMT_S16_BE, "linear signed 16-bit big-endian audio" }, { 16, »­­­­­AFMT_S16_LE, "linear signed 16-bit little-endian audio" }, The above conforms to: "audio" where ::= "logarithmic" ("mu-law" | "A-law") | "linear" ("unsigned" | "signed") ::= "8-bit" | "16-bit" ("big-endian" | "little-endian") -- ?!ng "Simple, yet complex." -- Lenore Snell From tim_one@email.msn.com Sun Oct 8 20:28:55 2000 From: tim_one@email.msn.com (Tim Peters) Date: Sun, 8 Oct 2000 15:28:55 -0400 Subject: [Python-Dev] Python 2.0b2 note for Windows developers In-Reply-To: <000401c03135$2ebd4ec0$060210ac@private> Message-ID: [Barry] > Two requests: > > 1. Can you ship the .PDB files for the debug images so devo's > do not need to build the python sources to debug extensions. > And Yes I know the .ZIP will be huge. If you want a > compromise only include the .PDB for python20_d.dll. Sure! Most .pdb files are highly compressible, and the zip size hit isn't anything to worry about. > 2. Place the files into libs, pyd etc dirs. I had to extract > the groups into the right places which is a bit tedious > and error prone. No. If you want a directory structure that doesn't match the actual build directory structure, I can't read your mind, and have no reason to believe that the specific artificial structure you have in mind is of use to anyone but you. Don't be so helpless : write a tiny Python script to move the files where you want them after unpacking. What I upload will be an exact image of the build directory structure. Most feedback I've gotten is that people want exactly that, because they *want* to compile Python themselves and just want to avoid jumping thru all the snaky hoops needed to compile the 3rd-party subprojects (from _tkinter to zlib). alphabetically y'rs - tim From guido@python.org Sun Oct 8 21:52:54 2000 From: guido@python.org (Guido van Rossum) Date: Sun, 08 Oct 2000 15:52:54 -0500 Subject: [Python-Dev] linuxaudiodev module In-Reply-To: Your message of "Sun, 08 Oct 2000 11:19:51 MST." References: Message-ID: <200010082052.PAA27119@cj20424-a.reston1.va.home.com> > But it bugs me that some of the descriptions say "audio" and others say > "format". This seems arbitrary -- is there a reason? Okay, you're right. (But there are sooooo many other things wrong with the code still... E.g. the bogus reference to "ctl". :-( ) --Guido van Rossum (home page: http://www.python.org/~guido/) From paul@prescod.net Mon Oct 9 07:04:55 2000 From: paul@prescod.net (Paul Prescod) Date: Sun, 08 Oct 2000 23:04:55 -0700 Subject: [Python-Dev] A standard lexer? References: Message-ID: <39E16007.5F1DDF9A@prescod.net> Tim Peters wrote: > > ... > > Reviewing this before 2.0 has been on my todo list for 3+ months, and > finally got to it. Good show! I converted some of my by-hand scanners to > use lastgroup, and like it a whole lot. I know you understand why this is > Good, so here's a simple example of an "after" tokenizer for those who don't > (this one happens to tokenize REXX-like PARSE stmts): Is there a standard technique for taking a regexp like this and applying it to data fed in a little at a time? Other than buffering the data forever? That's something else I would like in a "standard Python lexer", if that's the goal. -- Paul Prescod - Not encumbered by corporate consensus Simplicity does not precede complexity, but follows it. - http://www.cs.yale.edu/homes/perlis-alan/quotes.html From guido@beopen.com Thu Oct 5 14:16:14 2000 From: guido@beopen.com (Guido van Rossum) Date: Thu, 5 Oct 2000 09:16:14 -0400 Subject: [Python-Dev] htmllib.HTMLescape() References: <200010042031.WAA17378@pandora.informatik.hu-berlin.de> Message-ID: <000701c031f4$59507440$7aa41718@reston1.va.home.com> Note that cgi.escape() does this too. --Guido ----- Original Message ----- From: "Martin von Loewis" To: Cc: Sent: Wednesday, October 04, 2000 4:31 PM Subject: [Python-Dev] htmllib.HTMLescape() > > Someone just pointed out on c.l.py that we need an HTMLescape() > > function that takes a string and converts special characters to > > entities. I'm not on python-dev, so could you please forward this > > and find out whether I need to run a PEP? > > Doesn't xml.sax.saxutils.escape do what you want (together with > htmlentitydefs)? I was going to say that this is quite a small change > to warrant a PEP - but there are two obvious approaches (working from > scratch, or working on top of xml.sax.saxutils.escape - perhaps > modifying and relocating that function), so *some* design probably > needs to be recorded in a PEP. > > Regards, > Martin > > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > http://www.python.org/mailman/listinfo/python-dev > From loewis@informatik.hu-berlin.de Mon Oct 9 15:01:10 2000 From: loewis@informatik.hu-berlin.de (Martin von Loewis) Date: Mon, 9 Oct 2000 16:01:10 +0200 (MET DST) Subject: [Python-Dev] htmllib.HTMLescape() In-Reply-To: <000701c031f4$59507440$7aa41718@reston1.va.home.com> (guido@beopen.com) References: <200010042031.WAA17378@pandora.informatik.hu-berlin.de> <000701c031f4$59507440$7aa41718@reston1.va.home.com> Message-ID: <200010091401.QAA21515@pandora.informatik.hu-berlin.de> > Note that cgi.escape() does this too. Indeed. That justifies a PEP that proposes to concentrate the functionality in one place, deprecating the other places. One approach would be to enhance the codec facilites, so that "string".encode("iso-entities") becomes possible - but that is already in the middle of discussing the PEP. Regards, Martin From jeremy@beopen.com Mon Oct 9 15:35:48 2000 From: jeremy@beopen.com (Jeremy Hylton) Date: Mon, 9 Oct 2000 10:35:48 -0400 (EDT) Subject: [Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Modules zlibmodule.c,2.35,2.36 In-Reply-To: <200010091418.HAA08765@slayer.i.sourceforge.net> References: <200010091418.HAA08765@slayer.i.sourceforge.net> Message-ID: <14817.55236.288126.338665@bitdiddle.concentric.net> Thanks. I didn't get to it on Friday. Jeremy From trentm@ActiveState.com Mon Oct 9 23:56:00 2000 From: trentm@ActiveState.com (Trent Mick) Date: Mon, 9 Oct 2000 15:56:00 -0700 Subject: [Python-Dev] test_sre.py fails on Win64 because PyOS_CheckStack *never* fails In-Reply-To: <000b01c02e4c$2ac63980$766940d5@hagrid>; from effbot@telia.com on Wed, Oct 04, 2000 at 11:43:41PM +0200 References: <20001004141737.A16659@ActiveState.com> <000b01c02e4c$2ac63980$766940d5@hagrid> Message-ID: <20001009155600.A27929@ActiveState.com> [Trent notes that PyOS_CheckStack never fails on Win64 hence test_[s]re.py fail on the overflow checks] [Fredrik gives me a simple test C program to test PyOS_CHeckStack independently (The test program is included at the bottom of this email.)] SOrry I took so long to reply to this but I spent a little bit of time playing with PyOS_CheckStack on Win32 and Win64 and I am now just frustrated. Here is what I found: - The simple test program shows that PyOS_CheckStack will fire as intended on both Win32 and Win64 with either Visual C's default optimization OR no optimization. - The simple test program will *not* fire as intended with the '-O2' optimization which Python *does* use for pythonrun.c (where PyOS_CheckStack lives). So, likely the '-O2' optimization will optimize-away the _alloca() call. Fine. But why then does it *not* get optimized away when pythonrun.c is compiled? Does the context around other code in the same file affect that optimization? - When I apply this patch to _sre.c on *Win32* (basically the same test as the test file that Fredrik gave me to try) the "callme(0)" call *never* returns -- infinite loop. Note that this happens on the Release *and* Debug builds so nothing is being optimized away. *************** *** 560,565 **** --- 560,569 ---- } #endif + + + void callme(int i); + LOCAL(int) SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern, int level) { *************** *** 578,583 **** --- 582,588 ---- TRACE(("|%p|%p|ENTER %d\n", pattern, ptr, level)); #if defined(USE_STACKCHECK) + callme(0); if (level % 10 == 0 && PyOS_CheckStack()) return SRE_ERROR_RECURSION_LIMIT; #endif *************** *** 2337,2340 **** --- 2342,2357 ---- Py_InitModule("_" MODULE, _functions); } + void callme(int i) + { + char buf[100000]; + if (PyOS_CheckStack()) + return; + printf("%d\n", i); + memset(buf, 0, sizeof buf); + callme(i+1); + } + + + #endif /* !defined(SRE_RECURSIVE) */ - I am not smart enough and/or (you decide :) do not have the inclination to figure this out (i.e. start looking at assembly code) just so _sre can use stack checking instead of the existing RECURSION_LIMIT framework (albeit the limited general usefullness of this) on Win64 so that test_sre.py can pass. Would it be alright for me to apply: *** python/dist/src/Include/pythonrun.h Sat Sep 16 09:31:31 2000 --- python/dist/src/Include/pythonrun.h Sun Oct 8 10:20:02 2000 *************** *** 88,94 **** to a 8k margin. */ #define PYOS_STACK_MARGIN 2048 ! #if defined(WIN32) && defined(_MSC_VER) /* Enable stack checking under Microsoft C */ #define USE_STACKCHECK #endif --- 88,94 ---- to a 8k margin. */ #define PYOS_STACK_MARGIN 2048 ! #if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) /* Enable stack checking under Microsoft C */ #define USE_STACKCHECK #endif to disable stack checking on Win64 until Win64 become more mainstream and others can bang away at this? The important thing, I would think, is getting the test suite passing for Python 2.0. ------- test file mentioned above -------------------------------- #include #include int __inline PyOS_CheckStack() { __try { _alloca(100000); return 0; } __except (EXCEPTION_EXECUTE_HANDLER) { /* just ignore all errors */ } return 1; } void callme(int i) { char buf[100000]; if (PyOS_CheckStack()) return; printf("%d\n", i); memset(buf, 0, sizeof buf); callme(i+1); } int main() { callme(0); } ----------------------------------------------------- -- Trent Mick TrentM@ActiveState.com From jeremy@beopen.com Tue Oct 10 01:26:27 2000 From: jeremy@beopen.com (Jeremy Hylton) Date: Mon, 9 Oct 2000 20:26:27 -0400 (EDT) Subject: [Python-Dev] Pre-release copies of the 2.0c1 source tarball Message-ID: <14818.25139.747635.586267@bitdiddle.concentric.net> I have placed pre-release copies of the 2.0 release candidate 1 source tarballs at ftp://python.beopen.com/pub/python/2.0c1/. We reserve the right two change these without notice prior to the official release :-). Jeremy From nas@arctrix.com Mon Oct 9 20:06:08 2000 From: nas@arctrix.com (Neil Schemenauer) Date: Mon, 9 Oct 2000 12:06:08 -0700 Subject: [Python-Dev] test_import failing Message-ID: <20001009120608.A13588@glacier.fnational.com> I assume the CVS sources are basicly the same as 2.0c1. Anyhow, test_import is failing on my Debian machine. The script is creating "@test.py" and then trying to import it. "." is not in sys.path for some reason. Neil From jeremy@beopen.com Tue Oct 10 03:17:31 2000 From: jeremy@beopen.com (Jeremy Hylton) Date: Mon, 9 Oct 2000 22:17:31 -0400 (EDT) Subject: [Python-Dev] Re: test_import failing In-Reply-To: <20001009120608.A13588@glacier.fnational.com> References: <20001009120608.A13588@glacier.fnational.com> Message-ID: <14818.31803.227516.852814@bitdiddle.concentric.net> I assume that you are running the test some way other than using "make test." It seems that make test executes python this way -- PYTHONPATH= ./python -- which causes the current directory to be added to the path. If you run python without having the current directory on your path test_import file fail. Unless you are having a different problem, this isn't important enough to fix in 2.0c1, although it seems good to fix for 2.0 final. Jeremy PS We have left GC turned on by default in 2.0c1 and plan to do the same for 2.0 final. From fdrake@beopen.com Tue Oct 10 03:09:34 2000 From: fdrake@beopen.com (Fred L. Drake, Jr.) Date: Mon, 9 Oct 2000 22:09:34 -0400 (EDT) Subject: [Python-Dev] test_import failing In-Reply-To: <20001009120608.A13588@glacier.fnational.com> References: <20001009120608.A13588@glacier.fnational.com> Message-ID: <14818.31326.292172.223405@cj42289-a.reston1.va.home.com> Neil Schemenauer writes: > I assume the CVS sources are basicly the same as 2.0c1. Anyhow, > test_import is failing on my Debian machine. The script is > creating "@test.py" and then trying to import it. "." is not in > sys.path for some reason. Jeremy & I finally figured this out. "make test" runs python with PYTHONPATH set to '' (an empty string). This is decidedly different from running with PYTHONPATH unset (I consider this a bug that should be fixed in 2.1). The empty string is interpreted as the current directory (as expected), so running "make test" adds the current directory to sys.path, but running the regression test (test_import or regrtest) as a script does not. We decided not to fix this now, since it's too late to be sure it's the right change, and adjusting the test case also means a very late change. So whoever runs the tests is responsible for making sure the current directory is on sys.path. (*Really* bogus!) -Fred -- Fred L. Drake, Jr. BeOpen PythonLabs Team Member From fdrake@beopen.com Tue Oct 10 03:20:11 2000 From: fdrake@beopen.com (Fred L. Drake, Jr.) Date: Mon, 9 Oct 2000 22:20:11 -0400 (EDT) Subject: [Python-Dev] Re: test_import failing In-Reply-To: <14818.31803.227516.852814@bitdiddle.concentric.net> References: <20001009120608.A13588@glacier.fnational.com> <14818.31803.227516.852814@bitdiddle.concentric.net> Message-ID: <14818.31963.385267.336885@cj42289-a.reston1.va.home.com> Jeremy Hylton writes: > Unless you are having a different problem, this isn't important enough > to fix in 2.0c1, although it seems good to fix for 2.0 final. And it's questionable how many bugs are hiding here as well. I count two: - test_import.py assumes the current directory is on the path; this is just plain fragile, and should explicitly pick the directory off of test_support.TESTFN, and add it to sys.path for the duration of the test (which does indeed fix this bug) - Modules/getpath.c interprets an empty definition of $PYTHONPATH as adding '' to sys.path, where I assert it should not add anything to sys.path. Everywhere else I've recall seeing an environment variable used as a data source, the test is done like this: char *cp = getenv("VARIABLE"); if (cp != NULL && cp[0] != '\0') { ... } (with some spelling variations). -Fred -- Fred L. Drake, Jr. BeOpen PythonLabs Team Member From Jeremy Hylton Tue Oct 10 07:52:48 2000 From: Jeremy Hylton (Jeremy Hylton) Date: Mon, 9 Oct 2000 23:52:48 -0700 (PDT) Subject: [Python-Dev] Python 2.0 release candidate 1 Message-ID: <200010100652.XAA74600@python.beopen.com> Python 2.0c1 is released. The BeOpen PythonLabs and our cast of SourceForge volunteers have fixed many bugs since the beta releases last month. Please pick up the new release at http://www.pythonlabs.com/products/python2.0/ There's a tarball, a Windows installer, RedHat RPMs, online documentation, and a long list of fixed bugs. The final release of Python 2.0 will be next week. We would appreciate feedback on the release candidate in order to fix any remaining bugs before the final release. Confirmation of build and test success on less common platforms is also helpful.n All major reported bugs have been fixed in the release candidate. We do not plan to make any changes between now and the final release, except to fix bugs reported in the next week. We encourage potential users of Python 2.0 to try the release candidate with their programs and report any remaining bugs. To report a new bug, use the SourceForge bug tracker http://sourceforge.net/bugs/?func=addbug&group_id=5470 Python 2.0 has many new features, including the following: - Augmented assignment, e.g. x += 1 - List comprehensions, e.g. [x**2 for x in range(10)] - Extended import statement, e.g. import Module as Name - Extended print statement, e.g. print >> file, "Hello" - Collection of cyclical garbage For a fuller discussion of the changes in Python 2.0, please see the article "What's New in Python 2.0" by Andrew Kuchling and Moshe Zadke: http://starship.python.net/crew/amk/python/writing/new-python/ -- Jeremy Hylton From tismer@appliedbiometrics.com Tue Oct 10 11:33:36 2000 From: tismer@appliedbiometrics.com (Christian Tismer) Date: Tue, 10 Oct 2000 13:33:36 +0300 Subject: [Python-Dev] Stackless Python 1.2 + Continuations 0.9 Message-ID: <39E2F080.86ED1DA3@appliedbiometrics.com> ANNOUNCING: Stackless Python 1.2 A Python Implementation That Does Not Use The C Stack * plus the real toy * Continuation Module 0.9 Continuations as First Class Objects with support for MicroThreads What is it? A plugin-replacement for core Python. It should run any program which runs under Python 1.5.2 . But it does not need space on the C stack. For further info, see the new site at http://www.stackless.com You might also want to join the mailing list at http://starship.python.net/mailman/listinfo/stackless Major changes in this release: Extra reference counting reduces continuation frame creation Better exception handling avoids cycles. Next to come: - A port to Python 2.0 will be the first thing to do. - Long-term project is a complete redesign and rewrite for inclusion with Python 2.1 ciao - Christian Tismer / Mission Impossible 5oftware Team

Stackless Python 1.2 + Continuations 0.9 - a version of Python 1.5.2 that does not need space on the C stack, first-class callable continuation objects for Python, and Microthread-support. (10-Oct-2000)

-- http://www.python.org/mailman/listinfo/python-list From guido@python.org Tue Oct 10 14:04:39 2000 From: guido@python.org (Guido van Rossum) Date: Tue, 10 Oct 2000 08:04:39 -0500 Subject: [Python-Dev] test_import failing In-Reply-To: Your message of "Mon, 09 Oct 2000 22:09:34 -0400." <14818.31326.292172.223405@cj42289-a.reston1.va.home.com> References: <20001009120608.A13588@glacier.fnational.com> <14818.31326.292172.223405@cj42289-a.reston1.va.home.com> Message-ID: <200010101304.IAA13010@cj20424-a.reston1.va.home.com> > Neil Schemenauer writes: > > I assume the CVS sources are basicly the same as 2.0c1. Anyhow, > > test_import is failing on my Debian machine. The script is > > creating "@test.py" and then trying to import it. "." is not in > > sys.path for some reason. > > Jeremy & I finally figured this out. "make test" runs python with > PYTHONPATH set to '' (an empty string). This is decidedly different > from running with PYTHONPATH unset (I consider this a bug that should > be fixed in 2.1). > The empty string is interpreted as the current directory (as > expected), so running "make test" adds the current directory to > sys.path, but running the regression test (test_import or regrtest) as > a script does not. > We decided not to fix this now, since it's too late to be sure it's > the right change, and adjusting the test case also means a very late > change. So whoever runs the tests is responsible for making sure the > current directory is on sys.path. (*Really* bogus!) Proper fix, which I will check in momentarily: put import sys sys.path.insert(0, os.curdir) in front of test_import.py; and add del sys.path[0] to the end. --Guido van Rossum (home page: http://www.python.org/~guido/) From guido@python.org Tue Oct 10 14:06:54 2000 From: guido@python.org (Guido van Rossum) Date: Tue, 10 Oct 2000 08:06:54 -0500 Subject: [Python-Dev] Re: test_import failing In-Reply-To: Your message of "Mon, 09 Oct 2000 22:20:11 -0400." <14818.31963.385267.336885@cj42289-a.reston1.va.home.com> References: <20001009120608.A13588@glacier.fnational.com> <14818.31803.227516.852814@bitdiddle.concentric.net> <14818.31963.385267.336885@cj42289-a.reston1.va.home.com> Message-ID: <200010101306.IAA13031@cj20424-a.reston1.va.home.com> > And it's questionable how many bugs are hiding here as well. I > count two: > > - test_import.py assumes the current directory is on the path; this > is just plain fragile, and should explicitly pick the directory > off of test_support.TESTFN, and add it to sys.path for the > duration of the test (which does indeed fix this bug) I'll fix this. > - Modules/getpath.c interprets an empty definition of $PYTHONPATH as > adding '' to sys.path, where I assert it should not add anything > to sys.path. Everywhere else I've recall seeing an environment > variable used as a data source, the test is done like this: > > char *cp = getenv("VARIABLE"); > if (cp != NULL && cp[0] != '\0') { > ... > } > > (with some spelling variations). Agreed, but please *don't fix this in 2.0!* Who knows how many other hidden bugs (in 3rd party code) this will trigger... OK to fix it after 2.0final is released. --Guido van Rossum (home page: http://www.python.org/~guido/) From mal@lemburg.com Tue Oct 10 13:58:09 2000 From: mal@lemburg.com (M.-A. Lemburg) Date: Tue, 10 Oct 2000 14:58:09 +0200 Subject: [Python-Dev] LICENSE file in Python 2.0c1 Message-ID: <39E31261.166F1601@lemburg.com> I've just had a glance at the releas candidate 1. The file LICENSE has grown somewhat, but not as much as I feared... looking at the contents I find the following as only reference to the CNRI license (which holds all the surprises we talked about in the early beta stages): """ CNRI OPEN SOURCE LICENSE AGREEMENT ---------------------------------- Python 1.6 is made available subject to the terms and conditions in CNRI's License Agreement. This Agreement together with Python 1.6 may be located on the Internet using the following unique, persistent identifier (known as a handle): 1895.22/1012. This Agreement may also be obtained from a proxy server on the Internet using the following URL: http://hdl.handle.net/1895.22/1012. """ Such a note is nice and short, but not legally binding and confusing since it is not clear whether the "handle" for the document will always return the same license text or if it will return a license text at all. It would be more appropriate to include the original CNRI license text, IMHO. Or is there some hidden motivation behind using the handle ? -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/ From thomas.heller@ion-tof.com Tue Oct 10 14:06:05 2000 From: thomas.heller@ion-tof.com (Thomas Heller) Date: Tue, 10 Oct 2000 15:06:05 +0200 Subject: [Python-Dev] distutils and bdist_wininst confusion: clarification Message-ID: <01be01c032ba$dc889ba0$4500a8c0@thomasnotebook> There has been some confusion about distutils, especially the bdist_wininst command. I hope I can clarify these things with this post. 1. The current Distutils version 1.0, which is also included in the Python 2.0 release candidate is perfectly usable apart from one bug: You should create windows installers (by running 'setup.py bdist_wininst' or 'setup.py bdist --formats=wininst') ONLY with an external zip utility (info-zip would do). Using the zipfile module results in corrupted installations (all files are created with zero length). Details about the cause for this can be found in the patch I posted to SF. 2. I submitted a patch to SF http://sourceforge.net/patch/?func=detailpatch&patch_id=101844&group_id=5470 which corrects this bug. Normally I would have checked this code in immediately, because it is in _my_ code, and that's what my checkin rights are for ;-). I did not because I did not want to interfere with the release process of python 2.0 rc 1. 3. How does bdist_wininst work? bdist_wininst creates a self-extracting zipfile from two components: a stub program (wininst.exe) plus a zip-file containing the code to be distributed. Because I did not liked wininst.exe as binary file checked in into CVS, the actual bytes of this exe are included base64-encoded in the bdist_wininst.py module as string. I'm not sure whether this is a wise design or not, but that is a different topic. The downside of this design is that when the source to wininst.exe changes, it must be recompiled, and bdist_wininst.py must be regenerated. The context-diffs for bdist_wininst.py are so very large. 4. To understand the patch, you should know the following: Distutils is a separate toplevel module in the repository on sourceforge. Parts of this repository are symbolically linked somewhere into the python tree. Thus, this patch must be applied to the distutils _module_ in the repository. Distutils directory structure is as follows: distutils dd distutils command doc dist inst examples sample1 sample2 sample3 misc test text Relevant part of python directory structure: python dist src Lib distutils command The source code for wininst.exe is in CVS in the distutils/misc directory. The patch I posted to SF does not include the compiled wininst.exe, neither does it include the (regenerated) bdist_wininst.py module. 5. If nobody objects, I will check in the changes I made tomorrow, recompile the exe, regenerate the bdist_wininst.py, and everything should be fine again. Greg will then hopefully, when he is back, increase the distutils version number to 1.0.1 (or whatever) and this version will then be delivered with python 2.0 final. Sorry for the confusion. Cheers, Thomas From guido@python.org Tue Oct 10 15:36:57 2000 From: guido@python.org (Guido van Rossum) Date: Tue, 10 Oct 2000 09:36:57 -0500 Subject: [Python-Dev] LICENSE file in Python 2.0c1 In-Reply-To: Your message of "Tue, 10 Oct 2000 14:58:09 +0200." <39E31261.166F1601@lemburg.com> References: <39E31261.166F1601@lemburg.com> Message-ID: <200010101436.JAA13237@cj20424-a.reston1.va.home.com> > I've just had a glance at the releas candidate 1. The file LICENSE > has grown somewhat, but not as much as I feared... Since when? It hasn't changed since it was first released, for 2.0b1. > looking > at the contents I find the following as only reference to the > CNRI license (which holds all the surprises we talked about in > the early beta stages): > > """ > CNRI OPEN SOURCE LICENSE AGREEMENT > ---------------------------------- > > Python 1.6 is made available subject to the terms and conditions in > CNRI's License Agreement. This Agreement together with Python 1.6 may > be located on the Internet using the following unique, persistent > identifier (known as a handle): 1895.22/1012. This Agreement may also > be obtained from a proxy server on the Internet using the following > URL: http://hdl.handle.net/1895.22/1012. > """ > > Such a note is nice and short, but not legally binding and > confusing since it is not clear whether the "handle" for the > document will always return the same license text or if it > will return a license text at all. Why do you say it's not legally binding? The CNRI license explicitly allows you to use this exact text instead of including the whole CNRI license. > It would be more appropriate to include the original CNRI license > text, IMHO. Or is there some hidden motivation behind using the > handle ? I was just trying to save space. ActivePython does the same thing as far as I remember. BTW, I haven't heard from CNRI in two weeks, but the last thing I heard from them was that their lawyers had talked to Stallman's lawyer and that they were optimistic about a successful resolution. --Guido van Rossum (home page: http://www.python.org/~guido/) From guido@python.org Tue Oct 10 15:41:50 2000 From: guido@python.org (Guido van Rossum) Date: Tue, 10 Oct 2000 09:41:50 -0500 Subject: [Python-Dev] distutils and bdist_wininst confusion: clarification In-Reply-To: Your message of "Tue, 10 Oct 2000 15:06:05 +0200." <01be01c032ba$dc889ba0$4500a8c0@thomasnotebook> References: <01be01c032ba$dc889ba0$4500a8c0@thomasnotebook> Message-ID: <200010101441.JAA13276@cj20424-a.reston1.va.home.com> Thomas, thanks for the explanation. I agree that you can check in the changes yourself as you proposed. There's one issue I still don't understand (not having the time to read the full distutils docs): how does a typical Windows developer decide whether to use an external zip utility or the zipfile module? --Guido van Rossum (home page: http://www.python.org/~guido/) From thomas.heller@ion-tof.com Tue Oct 10 14:58:32 2000 From: thomas.heller@ion-tof.com (Thomas Heller) Date: Tue, 10 Oct 2000 15:58:32 +0200 Subject: [Python-Dev] distutils and bdist_wininst confusion: clarification References: <01be01c032ba$dc889ba0$4500a8c0@thomasnotebook> <200010101441.JAA13276@cj20424-a.reston1.va.home.com> Message-ID: <020001c032c2$3060fa40$4500a8c0@thomasnotebook> > Thomas, thanks for the explanation. I agree that you can check in the > changes yourself as you proposed. > > There's one issue I still don't understand (not having the time to > read the full distutils docs): how does a typical Windows developer > decide whether to use an external zip utility or the zipfile module? I'm afraid it is not documented. Distutils first tries to spawn an external zip program, then tries the zipfile module, if nothing is found, a warning is issued. So, the windows developer currently _must_ install zip.exe somewhere in the path. (As often, the default is wrong, because a zip utility is not included in windows). Thomas From mal@lemburg.com Tue Oct 10 15:03:14 2000 From: mal@lemburg.com (M.-A. Lemburg) Date: Tue, 10 Oct 2000 16:03:14 +0200 Subject: [Python-Dev] LICENSE file in Python 2.0c1 References: <39E31261.166F1601@lemburg.com> <200010101436.JAA13237@cj20424-a.reston1.va.home.com> Message-ID: <39E321A2.2BD99E35@lemburg.com> Guido van Rossum wrote: > > > I've just had a glance at the releas candidate 1. The file LICENSE > > has grown somewhat, but not as much as I feared... > > Since when? It hasn't changed since it was first released, for 2.0b1. Since the old 1.5.2 LICENSE file. > > looking > > at the contents I find the following as only reference to the > > CNRI license (which holds all the surprises we talked about in > > the early beta stages): > > > > """ > > CNRI OPEN SOURCE LICENSE AGREEMENT > > ---------------------------------- > > > > Python 1.6 is made available subject to the terms and conditions in > > CNRI's License Agreement. This Agreement together with Python 1.6 may > > be located on the Internet using the following unique, persistent > > identifier (known as a handle): 1895.22/1012. This Agreement may also > > be obtained from a proxy server on the Internet using the following > > URL: http://hdl.handle.net/1895.22/1012. > > """ > > > > Such a note is nice and short, but not legally binding and > > confusing since it is not clear whether the "handle" for the > > document will always return the same license text or if it > > will return a license text at all. > > Why do you say it's not legally binding? The CNRI license explicitly > allows you to use this exact text instead of including the whole CNRI > license. Sure, but not including the verbatim text will produce an unpleasent feeling of not being sure about the completeness of the license text. In a law suit the above construct would certainly not hold, since URLs only describe the location of information and don't hold any information about the validity or origin of it. The situation would be a little better if CNRI had provided a PGP signature or fingerprint of the license, since this is (in some countries) a legally accepted way of determining those two criteria. Just a side note: the URL given for the license results in a redirect to a different URL - http://www.handle.net/python_licenses/python1.6_9-5-00.html (note the date !): this doesn't really give the impression of persistent unchangeable information. Not that there's much to fear about... but why add any extra areas of uncertainty ? > > It would be more appropriate to include the original CNRI license > > text, IMHO. Or is there some hidden motivation behind using the > > handle ? > > I was just trying to save space. ActivePython does the same thing as > far as I remember. Space?... the download is 3.9 Megs ;-) > BTW, I haven't heard from CNRI in two weeks, but the last thing I > heard from them was that their lawyers had talked to Stallman's lawyer > and that they were optimistic about a successful resolution. Great ! This would be really good news indeed :-) -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/ From just@letterror.com Tue Oct 10 16:47:00 2000 From: just@letterror.com (Just van Rossum) Date: Tue, 10 Oct 2000 16:47:00 +0100 Subject: [Python-Dev] Re: [Stackless] Stackless Python 1.2 + Continuations 0.9 In-Reply-To: <39E2F080.86ED1DA3@appliedbiometrics.com> Message-ID: In response to the new release of Stackless Python (see http://www.stackless.com/), here's a new stackless binary for MacPython 1.5.2: http://starship.python.net/~just/MacStacklessPython.sit.hqx (The archive contains a replacement for the PythonCore shared library) Just From guido@python.org Tue Oct 10 16:50:07 2000 From: guido@python.org (Guido van Rossum) Date: Tue, 10 Oct 2000 10:50:07 -0500 Subject: [Python-Dev] LICENSE file in Python 2.0c1 In-Reply-To: Your message of "Tue, 10 Oct 2000 16:03:14 +0200." <39E321A2.2BD99E35@lemburg.com> References: <39E31261.166F1601@lemburg.com> <200010101436.JAA13237@cj20424-a.reston1.va.home.com> <39E321A2.2BD99E35@lemburg.com> Message-ID: <200010101550.KAA18130@cj20424-a.reston1.va.home.com> > > > Such a note is nice and short, but not legally binding and > > > confusing since it is not clear whether the "handle" for the > > > document will always return the same license text or if it > > > will return a license text at all. > > > > Why do you say it's not legally binding? The CNRI license explicitly > > allows you to use this exact text instead of including the whole CNRI > > license. > > Sure, but not including the verbatim text will produce an > unpleasent feeling of not being sure about the completeness > of the license text. > > > > In a law suit the above construct would > certainly not hold, since URLs only describe the location of > information and don't hold any information about the validity > or origin of it. The situation would be a little better if CNRI > had provided a PGP signature or fingerprint of the license, > since this is (in some countries) a legally accepted way of > determining those two criteria. > > Just a side note: the URL given for the license results in a > redirect to a different URL - > http://www.handle.net/python_licenses/python1.6_9-5-00.html > (note the date !): this doesn't really give the impression of > persistent unchangeable information. > > Funny... I agree that's not very confidence-inspiring. CNRI always advertises handles as better than URLs for long-term persistent documents, but it's clear that they didn't think of this! Or maybe (warning: fake conspiracy theory ahead :-) they intend to change the license terms after the fact... > Not that there's much to fear about... but why add any extra areas > of uncertainty ? Agreed. I'll add the full text back in. > > I was just trying to save space. ActivePython does the same thing as > > far as I remember. > > Space?... the download is 3.9 Megs ;-) I meant less text for the reader to wade through. But you've convinced me already. --Guido van Rossum (home page: http://www.python.org/~guido/) From bjorn@roguewave.com Tue Oct 10 19:35:15 2000 From: bjorn@roguewave.com (Bjorn Pettersen) Date: Tue, 10 Oct 2000 12:35:15 -0600 Subject: [Python-Dev] Re: Python 2.0 release candidate 1 References: <200010100652.XAA74600@python.beopen.com> Message-ID: <39E36163.33291FAB@roguewave.com> Are there any instructions on how to build this for Win64/itanium anywhere? -- bjorn Jeremy Hylton wrote: > > Python 2.0c1 is released. The BeOpen PythonLabs and our cast of > SourceForge volunteers have fixed many bugs since the beta releases > last month. Please pick up the new release at > > http://www.pythonlabs.com/products/python2.0/ > > There's a tarball, a Windows installer, RedHat RPMs, online > documentation, and a long list of fixed bugs. > > The final release of Python 2.0 will be next week. We would > appreciate feedback on the release candidate in order to fix any > remaining bugs before the final release. Confirmation of build and > test success on less common platforms is also helpful.n > > All major reported bugs have been fixed in the release candidate. We > do not plan to make any changes between now and the final release, > except to fix bugs reported in the next week. We encourage potential > users of Python 2.0 to try the release candidate with their programs > and report any remaining bugs. > > To report a new bug, use the SourceForge bug tracker > http://sourceforge.net/bugs/?func=addbug&group_id=5470 > > Python 2.0 has many new features, including the following: > > - Augmented assignment, e.g. x += 1 > - List comprehensions, e.g. [x**2 for x in range(10)] > - Extended import statement, e.g. import Module as Name > - Extended print statement, e.g. print >> file, "Hello" > - Collection of cyclical garbage > > For a fuller discussion of the changes in Python 2.0, please see the > article "What's New in Python 2.0" by Andrew Kuchling and Moshe Zadke: > http://starship.python.net/crew/amk/python/writing/new-python/ > > -- Jeremy Hylton > > -- > http://www.python.org/mailman/listinfo/python-list From trentm@ActiveState.com Tue Oct 10 20:51:55 2000 From: trentm@ActiveState.com (Trent Mick) Date: Tue, 10 Oct 2000 12:51:55 -0700 Subject: Building for Win64 (was: Re: [Python-Dev] Re: Python 2.0 release candidate 1) In-Reply-To: <39E36163.33291FAB@roguewave.com>; from bjorn@roguewave.com on Tue, Oct 10, 2000 at 12:35:15PM -0600 References: <200010100652.XAA74600@python.beopen.com> <39E36163.33291FAB@roguewave.com> Message-ID: <20001010125155.B3221@ActiveState.com> On Tue, Oct 10, 2000 at 12:35:15PM -0600, Bjorn Pettersen wrote: > Are there any instructions on how to build this for Win64/itanium > anywhere? > Um... not really. I did/am doing the Win64 port but I have not really given the information required to build it, which, I agree, kind of sucks. I have not done so because: - the Python build system on Windows uses DevStudio project files - AFAIK there is no DevStudio yet for Win64 (if there were, building Python would be trivial, just setup a new configuration in DevStudio) - I am currently using a cross-compiler for Win64 provided by Intel (as part of a contract that ActiveState has to port Python to Win64 and other OSes for the IA-64 platform). I don't know if there is a publicly available compiler for Win64 (I haven't looked). - My method for building for Win64 involves: (1) exporting Win32 build makefile from the Python *.dsp files from within DevStudio. (2) running a hack script of my own to convert those to makefile to ones that will build for Win64 (these makefiles are extremely specific to my system, i.e. it is a hack) (3) run those makefiles I *could* checkin this hack script of mine and provide some documentation in Python's standard readme, if the other python-dev'ers would be ammenable to this. [Note: my files would be isolated to one directory, say PCbuild/win64.] As I said, I have not done this because I expected to just wait until DevStudio for Win64 came on the scene and then the build system for it would fit in smoothly to the current .dsp's. I would rather not become a separate provider of the Win64 build scripts because I don't want to support them outside of Python's mechanisms (i.e. through SourceForge). In other words, I'll check them into the Python core if others think that that is okay, otherwise I am afraid the answer is "please wait until DevStudio for Win64 comes along". Trent -- Trent Mick TrentM@ActiveState.com From bjorn@roguewave.com Tue Oct 10 21:24:00 2000 From: bjorn@roguewave.com (Bjorn Pettersen) Date: Tue, 10 Oct 2000 14:24:00 -0600 Subject: Building for Win64 (was: Re: [Python-Dev] Re: Python 2.0 release candidate 1) References: <200010100652.XAA74600@python.beopen.com> <39E36163.33291FAB@roguewave.com> <20001010125155.B3221@ActiveState.com> Message-ID: <39E37AE0.C7380FFD@roguewave.com> To answer some of your questions: - there is no win64 devstudio (and I haven't found a way of getting the current devstudio to use the new compiler) - Intel does have a native compiler for win64 (don't use it, see below). - If you look in ia64xdevsdk\bin\win64 there is a cl.exe which is the Microsoft compiler. It works MUCH better. It's also binary compatible with the Intel ecl compiler, and they didn't have any problems with us switching. My main interest is in having a python version that runs on the itanium box with socket support (they included socket support in sdk2 didn't they?) I.e. no need to provide a build mechanism for my needs if you can refer me to an executable ;-) -- bjorn Trent Mick wrote: > > On Tue, Oct 10, 2000 at 12:35:15PM -0600, Bjorn Pettersen wrote: > > Are there any instructions on how to build this for Win64/itanium > > anywhere? > > > > Um... not really. I did/am doing the Win64 port but I have not really given > the information required to build it, which, I agree, kind of sucks. I have > not done so because: > > - the Python build system on Windows uses DevStudio project files > - AFAIK there is no DevStudio yet for Win64 (if there were, building Python > would be trivial, just setup a new configuration in DevStudio) > - I am currently using a cross-compiler for Win64 provided by Intel (as > part of a contract that ActiveState has to port Python to Win64 and other > OSes for the IA-64 platform). I don't know if there is a publicly > available compiler for Win64 (I haven't looked). > - My method for building for Win64 involves: > (1) exporting Win32 build makefile from the Python *.dsp files from > within DevStudio. > (2) running a hack script of my own to convert those to makefile to ones > that will build for Win64 (these makefiles are extremely specific to > my system, i.e. it is a hack) > (3) run those makefiles > > I *could* checkin this hack script of mine and provide some documentation in > Python's standard readme, if the other python-dev'ers would be ammenable to > this. [Note: my files would be isolated to one directory, say PCbuild/win64.] > As I said, I have not done this because I expected to just wait until > DevStudio for Win64 came on the scene and then the build system for it would > fit in smoothly to the current .dsp's. > > I would rather not become a separate provider of the Win64 build scripts > because I don't want to support them outside of Python's mechanisms (i.e. > through SourceForge). In other words, I'll check them into the Python core > if others think that that is okay, otherwise I am afraid the answer is > "please wait until DevStudio for Win64 comes along". > > Trent > > -- > Trent Mick > TrentM@ActiveState.com From trentm@ActiveState.com Tue Oct 10 21:20:42 2000 From: trentm@ActiveState.com (Trent Mick) Date: Tue, 10 Oct 2000 13:20:42 -0700 Subject: [Python-Dev] Monterey (64-bit AIX) screws up the poll() implementation, I think Message-ID: <20001010132042.B22561@ActiveState.com> test_poll.py currently fails on Monterey (64-bit AIX) because of a difference in the system poll() function as compared to Linux. On Linux (and as required by the Signle Unix Specification: http://www.opengroup.org/onlinepubs/007908799/xsh/poll.html) if you "poll()" a bogus file descriptor you get a POLLNVAL return value in the 'revents' field of the structure sent to poll(). This is tested like so in test_poll.py: # returns NVAL for invalid file descriptor FD = 42 try: os.close(FD) except OSError: pass p = select.poll() p.register(FD) r = p.poll() assert r[0] == (FD, select.POLLNVAL) Monterey decided to return -1 instead. [Aside: However, 'revents's type is "short" so the Python interface to poll() (using PyInt_FromLong) actually interprets that as -32768 instead.] Questions: 1. Can anybody offer an opinion if this is Python's or Monterey's problem? 2. Can anybody tell me where I can browse the POSIX spec to see if this breaks POSIX compliance as well? 3. Could someone (Vladimir?) run this test program on a normal AIX box and tell me what the output is (does the return value == POLLNVAL?)? ---------------------------------------------------------------------- #include #include #define NFDS 1 int main(void) { struct pollfd ufds[NFDS]; int pollResult; printf("hello\n"); /* poll for any event on a bogus file descriptor */ ufds[0].fd = 42; ufds[0].events = POLLIN | POLLPRI | POLLOUT; pollResult = poll(ufds, NFDS, -1); if (pollResult != 1) { printf("*** poll result was %d, I expected 1.\n", pollResult); } printf("ufds[0].revents = %hd\n", ufds[0].revents); printf("POLLNVAL = %ld\n", POLLNVAL); return 0; } ---------------------------------------------------------------------- Thanks, Trent -- Trent Mick TrentM@ActiveState.com From trentm@ActiveState.com Tue Oct 10 21:30:03 2000 From: trentm@ActiveState.com (Trent Mick) Date: Tue, 10 Oct 2000 13:30:03 -0700 Subject: Building for Win64 (was: Re: [Python-Dev] Re: Python 2.0 release candidate 1) In-Reply-To: <39E37AE0.C7380FFD@roguewave.com>; from bjorn@roguewave.com on Tue, Oct 10, 2000 at 02:24:00PM -0600 References: <200010100652.XAA74600@python.beopen.com> <39E36163.33291FAB@roguewave.com> <20001010125155.B3221@ActiveState.com> <39E37AE0.C7380FFD@roguewave.com> Message-ID: <20001010133003.C22561@ActiveState.com> On Tue, Oct 10, 2000 at 02:24:00PM -0600, Bjorn Pettersen wrote: > - If you look in ia64xdevsdk\bin\win64 there is a cl.exe which is the > Microsoft compiler. It works MUCH better. It's also binary compatible > with the Intel ecl compiler, and they didn't have any problems with us > switching. Yes, I knew that that was there. I remember either some earlier problem with it or some recommnedation to use the ecl.exe one. Anyway, ecl has worked for me well enough, I just haven't tried the one in Win64/. > My main interest is in having a python version that runs on the itanium > box with socket support (they included socket support in sdk2 didn't > they?) I.e. no need to provide a build mechanism for my needs if you can > refer me to an executable ;-) Well, Python's test_socket runs on my Win64 box so yes, socket support is there. As far as referring you to an exe, I would rather not go down that distribution road in preference to checking in my build scripts. Trent -- Trent Mick TrentM@ActiveState.com From mal@lemburg.com Tue Oct 10 21:37:30 2000 From: mal@lemburg.com (M.-A. Lemburg) Date: Tue, 10 Oct 2000 22:37:30 +0200 Subject: [Python-Dev] -Wall output for the Python 2.0c1 Message-ID: <39E37E0A.90176759@lemburg.com> FYI, Here's what gcc -Wall gives on Linux: ceval.c: In function `eval_code2': ceval.c:345: warning: `v' might be used uninitialized in this function ceval.c:346: warning: `w' might be used uninitialized in this function ceval.c:347: warning: `u' might be used uninitialized in this function ceval.c:348: warning: `t' might be used uninitialized in this function errors.c: In function `PyErr_Format': errors.c:409: warning: value computed is not used errors.c:415: warning: value computed is not used -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/ From mal@lemburg.com Tue Oct 10 21:45:00 2000 From: mal@lemburg.com (M.-A. Lemburg) Date: Tue, 10 Oct 2000 22:45:00 +0200 Subject: [Python-Dev] What will happen to cycle GC in the 2.0 final ? Message-ID: <39E37FCC.9925555A@lemburg.com> It was mentioned early in the beta phase that cycle GC would be enabled only during the beta cycle and disabled in the final. Is this still true ? -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/ From tim_one@email.msn.com Tue Oct 10 21:47:06 2000 From: tim_one@email.msn.com (Tim Peters) Date: Tue, 10 Oct 2000 16:47:06 -0400 Subject: [Python-Dev] Monterey (64-bit AIX) screws up the poll() implementation, I think In-Reply-To: <20001010132042.B22561@ActiveState.com> Message-ID: [Trent Mick] > test_poll.py currently fails on Monterey (64-bit AIX) because of > a difference in the system poll() function as compared to Linux. > > On Linux (and as required by the Signle Unix Specification: > http://www.opengroup.org/onlinepubs/007908799/xsh/poll.html) if > you "poll()" a bogus file descriptor you get a POLLNVAL return value in > the 'revents' field of the structure sent to poll(). > ... > Monterey decided to return -1 instead. [Aside: However, 'revents's type is > "short" so the Python interface to poll() (using PyInt_FromLong) actually > interprets that as -32768 instead.] > > Questions: > 1. Can anybody offer an opinion if this is Python's or Monterey's > problem? Both. "Another day, another incompatible flavor of Unix(tm)." In the early days, Guido actually hoped he could get away without a massive hack like autoconf . > 2. Can anybody tell me where I can browse the POSIX spec to see if this > breaks POSIX compliance as well? Nowhere: ISO/ANSI stds are generally never available online. They get the bulk of their money from selling standards. http://webstore.ansi.org/ is a good place to buy. There are about 20 POSIX-related stds documents; the C API spec is US$245.00. You may get a cheaper answer on comp.unix.aix, of course. may-be-worth-more-than-$245-to-weed-out-the-wrong-answers-though-ly y'rs - tim From tim_one@email.msn.com Tue Oct 10 21:58:54 2000 From: tim_one@email.msn.com (Tim Peters) Date: Tue, 10 Oct 2000 16:58:54 -0400 Subject: [Python-Dev] What will happen to cycle GC in the 2.0 final ? In-Reply-To: <39E37FCC.9925555A@lemburg.com> Message-ID: [M.-A. Lemburg] > It was mentioned early in the beta phase that cycle GC would be > enabled only during the beta cycle and disabled in the final. > > Is this still true ? No, and it probably never was : the intent of enabling gc during the betas was to determine *whether* to enable it for the final release. The beta experience with gc was very good: a few subtle problems were uncovered, and Neil fixed them quickly. It should probably get a ton of performance testing that never happened, but then so should have all of 2.0 -- no particular reason to pick on gc alone for that. full-cycle-ahead-ly y'rs - tim From fdrake@beopen.com Tue Oct 10 22:13:47 2000 From: fdrake@beopen.com (Fred L. Drake, Jr.) Date: Tue, 10 Oct 2000 17:13:47 -0400 (EDT) Subject: [Python-Dev] -Wall output for the Python 2.0c1 In-Reply-To: <39E37E0A.90176759@lemburg.com> References: <39E37E0A.90176759@lemburg.com> Message-ID: <14819.34443.951260.635718@cj42289-a.reston1.va.home.com> M.-A. Lemburg writes: > ceval.c: In function `eval_code2': > ceval.c:345: warning: `v' might be used uninitialized in this function > ceval.c:346: warning: `w' might be used uninitialized in this function > ceval.c:347: warning: `u' might be used uninitialized in this function > ceval.c:348: warning: `t' might be used uninitialized in this function These would be a real tedium to fix, and I'm not convinced the loss of clarity is worth it. From looking at the code in the DUP_TOPX code, I'm led to think that the compiler just isn't smart enough (it should figure out that oparg won't change before the second case statement, and figure it out more carefully. I'll bet *that* would remove these warnings and still right in all cases. > errors.c: In function `PyErr_Format': > errors.c:409: warning: value computed is not used > errors.c:415: warning: value computed is not used Fixed. -Fred -- Fred L. Drake, Jr. BeOpen PythonLabs Team Member From guido@python.org Wed Oct 11 00:16:42 2000 From: guido@python.org (Guido van Rossum) Date: Tue, 10 Oct 2000 18:16:42 -0500 Subject: [Python-Dev] pythonlabs.com website down -- 2.0c1 still available! Message-ID: <200010102316.SAA20071@cj20424-a.reston1.va.home.com> We're experiencing a serious problem with the pythonlabs.com website. Unfortunately the site is down with no estimated time for when it will be back up. Our bestest brains are working on the problem! In the mean time, the Python 2.0c1 source tree can be downloaded from this address: http://www.beopen.com/products/python2.0/BeOpen-Python-2.0c1.tar.gz The Windows installer is here: http://www.beopen.com/products/python2.0/BeOpen-Python-2.0c1.exe And the 2.0c1 documentation is still here (on-line browseable and downloadable): http://www.python.org/doc/2.0c1/ If the outage lasts for more than a day, we'll find another place to hold the full distribution. --Guido van Rossum (home page: http://www.python.org/~guido/) From tim_one@email.msn.com Tue Oct 10 23:47:19 2000 From: tim_one@email.msn.com (Tim Peters) Date: Tue, 10 Oct 2000 18:47:19 -0400 Subject: [Python-Dev] -Wall output for the Python 2.0c1 In-Reply-To: <14819.34443.951260.635718@cj42289-a.reston1.va.home.com> Message-ID: [MAL] > ceval.c: In function `eval_code2': > ceval.c:345: warning: `v' might be used uninitialized in this function > ceval.c:346: warning: `w' might be used uninitialized in this function > ceval.c:347: warning: `u' might be used uninitialized in this function > ceval.c:348: warning: `t' might be used uninitialized in this function [Fred] > These would be a real tedium to fix, and I'm not convinced the loss > of clarity is worth it. I'll take this one. It looks easy to fix, and to my eye doing *everything* needed for oparg == 5 in a single block (ditto for 4, 3, 2, 1 in their own blocks) would be much clearer than the current distributed trickiness (faster, too -- the code now is branching more than computing). > From looking at the code in the DUP_TOPX code, I'm led to think that > the compiler just isn't smart enough (it should figure out that oparg > won't change before the second case statement, and figure it out more > carefully. I'll bet *that* would remove these warnings and still right > in all cases. I agree, except that it wasn't trivial for *me* to decide the compiler was being stupid. Code that's obviously correct is better than code that's not obviously wrong. >> errors.c: In function `PyErr_Format': >> errors.c:409: warning: value computed is not used >> errors.c:415: warning: value computed is not used Thanks! > Fixed. Thanks! From thomas@xs4all.net Tue Oct 10 23:49:37 2000 From: thomas@xs4all.net (Thomas Wouters) Date: Wed, 11 Oct 2000 00:49:37 +0200 Subject: [Python-Dev] -Wall output for the Python 2.0c1 In-Reply-To: <14819.34443.951260.635718@cj42289-a.reston1.va.home.com>; from fdrake@beopen.com on Tue, Oct 10, 2000 at 05:13:47PM -0400 References: <39E37E0A.90176759@lemburg.com> <14819.34443.951260.635718@cj42289-a.reston1.va.home.com> Message-ID: <20001011004937.Q12812@xs4all.nl> On Tue, Oct 10, 2000 at 05:13:47PM -0400, Fred L. Drake, Jr. wrote: > M.-A. Lemburg writes: > > ceval.c: In function `eval_code2': > > ceval.c:345: warning: `v' might be used uninitialized in this function > > ceval.c:346: warning: `w' might be used uninitialized in this function > > ceval.c:347: warning: `u' might be used uninitialized in this function > > ceval.c:348: warning: `t' might be used uninitialized in this function > These would be a real tedium to fix, and I'm not convinced the loss > of clarity is worth it. From looking at the code in the DUP_TOPX > code, I'm led to think that the compiler just isn't smart enough (it > should figure out that oparg won't change before the second case > statement, and figure it out more carefully. I'll bet *that* would > remove these warnings and still right in all cases. Well, I'm certain I compiled my code (which included DUP_TOPX) with -Wall sometime before, and I didn't get those warnings then. Probably depends on the version of gcc. As a colleague of mine would say, "insert clue" (into gcc, that is ;) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From guido@python.org Wed Oct 11 00:57:38 2000 From: guido@python.org (Guido van Rossum) Date: Tue, 10 Oct 2000 18:57:38 -0500 Subject: [Python-Dev] Re: pythonlabs.com website down -- 2.0c1 still available! In-Reply-To: Your message of "Tue, 10 Oct 2000 18:16:42 EST." <200010102316.SAA20071@cj20424-a.reston1.va.home.com> References: <200010102316.SAA20071@cj20424-a.reston1.va.home.com> Message-ID: <200010102357.SAA20163@cj20424-a.reston1.va.home.com> I wrote: > We're experiencing a serious problem with the pythonlabs.com website. > Unfortunately the site is down with no estimated time for when it will > be back up. Our bestest brains are working on the problem! With the help of Digital Creations' bestest brain, Jim Fulton, the site is back up in record time. We'll try not to break it again, Jim! And thanks to Digital Creations for helping us out on such a short notice. --Guido van Rossum (home page: http://www.python.org/~guido/) From fdrake@beopen.com Wed Oct 11 01:57:11 2000 From: fdrake@beopen.com (Fred L. Drake, Jr.) Date: Tue, 10 Oct 2000 20:57:11 -0400 (EDT) Subject: [Python-Dev] -Wall output for the Python 2.0c1 In-Reply-To: <20001011004937.Q12812@xs4all.nl> References: <39E37E0A.90176759@lemburg.com> <14819.34443.951260.635718@cj42289-a.reston1.va.home.com> <20001011004937.Q12812@xs4all.nl> Message-ID: <14819.47847.268859.42306@cj42289-a.reston1.va.home.com> Thomas Wouters writes: > Well, I'm certain I compiled my code (which included DUP_TOPX) with -Wall > sometime before, and I didn't get those warnings then. Probably depends on > the version of gcc. As a colleague of mine would say, "insert clue" (into > gcc, that is ;) This is very reasonable. I don't think we'll give you too many demerits for this. ;) -Fred -- Fred L. Drake, Jr. BeOpen PythonLabs Team Member From tim_one@email.msn.com Wed Oct 11 05:40:41 2000 From: tim_one@email.msn.com (Tim Peters) Date: Wed, 11 Oct 2000 00:40:41 -0400 Subject: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: Message-ID: We need a glibc expert! Anyone qualify? [Huaiyu Zhu] > ... > This is very likely to be a 2.0 bug. Or a 1.5.2 bug. I have to keep saying this stuff is a platform-dependent crap shoot, because it is (I too prefer that Python underflow silently by default, though). > Just to make sure, I have used freshly downloaded source code of > both 1.5.2 and 2.0b2, then > ./configure > make > ./python > > from math import * > exp(-746) > > I got 0.0 from 1.5.2 but OverflowError: math range error from 2.0b2. > > The file mathmodule.c has quite some differences between the two versions, > mostly related to the ANSIfication. I'm not sure where the problem is. It's not in mathmodule.c. > I haven't tried the 2.0c1 yet, as the site is not available. Can > other Unix users confirm this behavior? I went over to Guido's and forced him to try it. He sees the same behavior: after building 1.5.2 and some flavor of 2.0 w/ the same gcc and libraries, 1.5.2 Python silently returns 0 and (some flavor of) 2.0 raises OverflowError. But there is no code in Python that accounts for the difference. Running it under the debugger, the platform exp leaves errno at 0 under 1.5.2 but sets errno to ERANGE (34) under 2.0. Since the platform exp was the only conceivable cause for this difference, it's not surprising that the debugger confirmed that the platform exp is in fact the cause. So the remaining question is why the same exp from the same library has different errno behavior depending on which version of Python it's called from. *That* one we couldn't answer, after a fruitless time digging thru the Byzantine glibc source code trying to reverse engineer it. Their exp *can* display different error behavior at runtime depending on several obscure things, but they're too obscure to relate back clearly to anything Python is doing. The 2.0 behavior (set errno to ERANGE on exp underflow) appears to be what the glibc exp author believes POSIX mandates, and is one of their exp's possible runtime behaviors, and your own little C program (which you posted earlier) suggests that's the default behavior under gcc + glibc. So presumably 1.5.2 config was such as to inhibit the default behavior. However, nobody changed this on purpose, so it smells like an unintended side effect of some other (currently unknown) config change. I don't know what to do next. I can't pursue it myself, and you've seen from the lack of replies to your posts that I'm the only who'll even listen to you . Guido suggests that one big change in 2.0 is that we're including a lot more std headers than we used to. It could well be that one of those #defines some God-forsaken preprocessor symbol one of whose five meanings (documented or not) is "use POSIX-conformant libm error reporting", but which someone #include'd in 2.0 to make (who knows?) sockets work right on some other flavor of Unix. Don't know. Unix config is a mess, and so is glibc. Best hope now is for someone intimately familiar with glibc internals to jump in and own this. staring-at-the-python-source-remains-pointless-for-this-one-ly y'rs - tim From huaiyu_zhu@yahoo.com Wed Oct 11 09:12:37 2000 From: huaiyu_zhu@yahoo.com (Huaiyu Zhu) Date: Wed, 11 Oct 2000 01:12:37 -0700 (PDT) Subject: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: Message-ID: [Tim Peters] > We need a glibc expert! Anyone qualify? If there is none here, maybe someone cares to ask in some gcc or gnu news groups? > The 2.0 behavior (set errno to ERANGE on exp underflow) appears to be what > the glibc exp author believes POSIX mandates, and is one of their exp's > possible runtime behaviors, and your own little C program (which you posted > earlier) suggests that's the default behavior under gcc + glibc. So > presumably 1.5.2 config was such as to inhibit the default behavior. > However, nobody changed this on purpose, so it smells like an unintended > side effect of some other (currently unknown) config change. So can we set a flag to explicitly discount ERANGE? There are only 19 lines in the source code that contain ERANGE, and 8 lines containing math_error. All the latter are in Modules/{c,}mathmodule.c. Could we just add an ifdef IEEE754 on these 8 lines? This would go a long way to aleviate this problem before we find a perfect solution, if there is one. > I don't know what to do next. I can't pursue it myself, and you've seen > from the lack of replies to your posts that I'm the only who'll even listen > to you . Guido suggests that one big change in 2.0 is that we're > including a lot more std headers than we used to. It could well be that one > of those #defines some God-forsaken preprocessor symbol one of whose five > meanings (documented or not) is "use POSIX-conformant libm error reporting", > but which someone #include'd in 2.0 to make (who knows?) sockets work right > on some other flavor of Unix. Don't know. Unix config is a mess, and so is > glibc. Best hope now is for someone intimately familiar with glibc > internals to jump in and own this. I'm not interested in where this comes from - the only thing that matters is that it worked in 1.5.2 and breaks in 2.0. Whether the 1.5.2 behavior was intended or not, it's not a bug. The 2.0 behavior is a bug. If Posix conflicts with IEEE floating point arithmetic, then confirming to Posix in this regard is a bug. I would suggest the next thing to do is to introduce an IEEE754 flag and let those who do not like it to voice their opinions. Since this is the same behavior as 1.5.2 I doubt any running code would be broken by this. Huaiyu From thomas@xs4all.net Wed Oct 11 09:26:14 2000 From: thomas@xs4all.net (Thomas Wouters) Date: Wed, 11 Oct 2000 10:26:14 +0200 Subject: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: ; from tim_one@email.msn.com on Wed, Oct 11, 2000 at 12:40:41AM -0400 References: Message-ID: <20001011102614.R12812@xs4all.nl> On Wed, Oct 11, 2000 at 12:40:41AM -0400, Tim Peters wrote: > We need a glibc expert! Anyone qualify? No, at least not me ;) > So the remaining question is why the same exp from the same library has > different errno behavior depending on which version of Python it's called > from. *That* one we couldn't answer, after a fruitless time digging thru > the Byzantine glibc source code trying to reverse engineer it. Their exp > *can* display different error behavior at runtime depending on several > obscure things, but they're too obscure to relate back clearly to anything > Python is doing. Well, I've seen & heard about compilers doing slightly different things depending on ANSI or K&R style C, so perhaps the presence of ANSI C definitions triggered this. I sincerely doubt it, though, but you never know, and it's fairly easy to test. > I don't know what to do next. I can't pursue it myself, and you've seen > from the lack of replies to your posts that I'm the only who'll even listen > to you . Guido suggests that one big change in 2.0 is that we're > including a lot more std headers than we used to. It could well be that one > of those #defines some God-forsaken preprocessor symbol one of whose five > meanings (documented or not) is "use POSIX-conformant libm error reporting", > but which someone #include'd in 2.0 to make (who knows?) sockets work right > on some other flavor of Unix. Don't know. Unix config is a mess, and so is > glibc. Best hope now is for someone intimately familiar with glibc > internals to jump in and own this. Actually, there was some activity to define the right combination of _GNU_SOURCE, _POSIX_SOURCE, _XOPEN_SOURCE, _BSD_SOURCE, et al, but I'm not sure what the end result was. If any #define changes the behaviour of glibc, these would definately be it ! A simple test might be to compile 1.5.2 with the config.h from 2.0, and manually add whatever _*_SOURCE defines aren't in 1.5.2. (They reside in Python.h and config.h, currently.) I'll see if I can reproduce it on the glibc almost-2.2 (that is, glibc-2.1.94) systems here, and do some of the above tests. Computers-suck-ly y'rs, -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From thomas@xs4all.net Wed Oct 11 09:31:49 2000 From: thomas@xs4all.net (Thomas Wouters) Date: Wed, 11 Oct 2000 10:31:49 +0200 Subject: [Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.207,2.208 In-Reply-To: <200010110704.AAA12861@slayer.i.sourceforge.net>; from tim_one@users.sourceforge.net on Wed, Oct 11, 2000 at 12:04:52AM -0700 References: <200010110704.AAA12861@slayer.i.sourceforge.net> Message-ID: <20001011103148.S12812@xs4all.nl> On Wed, Oct 11, 2000 at 12:04:52AM -0700, Tim Peters wrote: > default: > fprintf(stderr, "Invalid argument to DUP_TOPX: %d!\n", oparg); Hm, this fprintf is stray debugging code, added because I wasn't sure that a SystemError wouldn't crash the interpreter, given that the stack is utterly fu*d up at this point and we don't know what the compiler thinks is the stack size or block size here. (The snippet doesn't show it, but it also raises a SystemError.) Is it okay if I remove/comment this fprintf() before 2.0 final ? (At least it didn't say "awoogah, stray debugging code detected, this machine will self-destruct in 10 seconds" :-) Another-day-another-demerit -ly y'rs, -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From tim_one@email.msn.com Wed Oct 11 10:52:59 2000 From: tim_one@email.msn.com (Tim Peters) Date: Wed, 11 Oct 2000 05:52:59 -0400 Subject: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: Message-ID: [Huaiyu Zhu] > ... > So can we set a flag to explicitly discount ERANGE? There are > only 19 lines in the source code that contain ERANGE, and 8 lines > containing math_error. > All the latter are in Modules/{c,}mathmodule.c. Could we just > add an ifdef IEEE754 on these 8 lines? This would go a long way to > aleviate this problem before we find a perfect solution, if there > is one. That would stop the exception on exp() underflow, which is what you're concerned about. It would also stop exceptions on exp() overflow, and on underflow and overflow for all other math functions too. I doubt Guido will ever let Python ignore overflow by default, #ifdef'ed or not. A semantic change that jarring certainly won't happen for 2.0 (which is just a week away). > ... > I'm not interested in where this comes from - the only thing that > matters is that it worked in 1.5.2 and breaks in 2.0. The behavior of underflowing exp() is hardly the only thing that matters, although it's becoming clear it may be the only thing you care about <0.9 wink>. I would like to change that too for 2.0, but give a thought to the other consequences. If some change to the Python config screwed up exp(-1000) for you, what else is going wrong? You're not going to get an answer to that until we know exactly "where this comes from". > Whether the 1.5.2 behavior was> intended or not, it's not a bug. The > 2.0 behavior is a bug. If Posix conflicts with IEEE floating point > arithmetic, then confirming to Posix in this regard is a bug. POSIX doesn't conflict w/ 754 here, as 754 is silent on the matter of errno, as is POSIX on 754 issues. It was Python's decision (not POSIX's) to raise an exception when errno gets set. Python wasn't designed to support 754, and makes no claim to support any part of it, so conformance to 754 may be presented as a feature request, but trying to beat Python over the head with it won't work: there's no bug here, in the strong sense that no documented (or even intended!) behavior has changed. What happened is that one platform accident got changed to a different platform accident. You certainly get sympathy for that, but not enough to buy radical last-minute changes. > I would suggest the next thing to do is to introduce an IEEE754 > flag and let those who do not like it to voice their opinions. Nothing like that will happen without a PEP first. I would like to see *serious* 754 support myself, but that depends too on many platform experts contributing real work (if everyone ran WinTel, I could do it myself ). > Since this is the same behavior as 1.5.2 I doubt any running code would be > broken by this. Ignoring ERANGE entirely is not at all the same behavior as 1.5.2, and current code certainly relies on detecting overflows in math functions. It would also break code on platforms that were setting errno to ERANGE all along on underflow (as POSIX appears to require, and ANSI C doesn't appear to forbid; I don't know of such a platform for sure offhand, but to judge from their manpages, HPUX looks like one). In no case can you expect to see overflow ignored in 2.0. I want to know where this comes from, so we have *some* handle on what other surprises may be lurking. If no progress is made on determining the true cause over the next few days, I'll hack mathmodule.c to ignore ERANGE in the specific case the result returned is a zero (which would "fix" your exp underflow problem without stopping overflow detection). Since this will break code on any platform where errno was set to ERANGE on underflow in 1.5.2, I'll need to have a long discussion w/ Guido first. I *believe* that much is actually sellable for 2.0, because it moves Python in a direction I know he likes regardless of whether he ever becomes a 754 True Believer. like-herding-cats-indeed-ly y'rs - tim From tim_one@email.msn.com Wed Oct 11 11:02:05 2000 From: tim_one@email.msn.com (Tim Peters) Date: Wed, 11 Oct 2000 06:02:05 -0400 Subject: [Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.207,2.208 In-Reply-To: <20001011103148.S12812@xs4all.nl> Message-ID: > > default: > > fprintf(stderr, "Invalid argument > to DUP_TOPX: %d!\n", oparg); [Thomas Wouters] > Hm, this fprintf is stray debugging code, added because I wasn't > sure that a SystemError wouldn't crash the interpreter, given that the > stack is utterly fu*d up at this point and we don't know what the > compiler thinks is the stack size or block size here. (The snippet > doesn't show it, but it also raises a SystemError.) Is it okay if I > remove/comment this fprintf() before 2.0 final ? Suggest replacing it with: assert(!"Invalid argument to DUP_TOPX"); Then there's no cost in release mode, but we have a useful check in debug mode. ("assert(!string)" is a handy C debugging idiom more people should know about! It's semantically the same as assert(0) (i.e. will fail if ever reached), but unlike using a comment, using a string gets a useful msg displayed if it ever does fail). > (At least it didn't say "awoogah, stray debugging code detected, this > machine will self-destruct in 10 seconds" :-) Beats "Unto the root this day a brother is born" . > Another-day-another-demerit -ly y'rs, That's a funny thing about working on Python: collect 5 demerits and you can exchange them for 1 brownie point! If you're not leaving crap behind, you're not eating enough Python code. continuous-recoding-is-as-effective-as-it-is-rare-ly y'rs - tim From guido@python.org Wed Oct 11 15:39:06 2000 From: guido@python.org (Guido van Rossum) Date: Wed, 11 Oct 2000 09:39:06 -0500 Subject: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: Your message of "Wed, 11 Oct 2000 05:52:59 -0400." References: Message-ID: <200010111439.JAA02783@cj20424-a.reston1.va.home.com> Incidentally, math.exp(800) returns inf in 1.5, and raises OverflowError in 2.0. So at least it's consistent. --Guido van Rossum (home page: http://www.python.org/~guido/) From Moshe Zadka Wed Oct 11 13:38:21 2000 From: Moshe Zadka (Moshe Zadka) Date: Wed, 11 Oct 2000 15:38:21 +0300 (IDT) Subject: [Python-Dev] OS Dependant Bugs Message-ID: Many of the sourceforge bugs are platform dependant. Unfortunately, it is impossible, from the main bugs page, to see which are platform dependant, and which platform the occur on. I suggest that, until SF supports it properly, each bug report we enter will have an optional [Platform] in front, if it seems to be platform dependant. Any opinions? Anyone thinks submitting an SF request to add this field is foolish? -- Moshe Zadka There is no IGLU cabal. http://advogato.org/person/moshez From guido@python.org Wed Oct 11 15:41:47 2000 From: guido@python.org (Guido van Rossum) Date: Wed, 11 Oct 2000 09:41:47 -0500 Subject: [Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.207,2.208 In-Reply-To: Your message of "Wed, 11 Oct 2000 06:02:05 -0400." References: Message-ID: <200010111441.JAA02813@cj20424-a.reston1.va.home.com> > Suggest replacing it with: > > assert(!"Invalid argument to DUP_TOPX"); Actually, I would recommend Py_FatalError("Invalid argument to DUP_TOPX") It's not quite the same since it also triggers in release mode. If, as Thomas says, this should never happen and can only be caused by garbled bytecode, a fatal error is proper rather than a SystemError. --Guido van Rossum (home page: http://www.python.org/~guido/) From Moshe Zadka Wed Oct 11 13:41:27 2000 From: Moshe Zadka (Moshe Zadka) Date: Wed, 11 Oct 2000 15:41:27 +0300 (IDT) Subject: [Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.207,2.208 In-Reply-To: <200010111441.JAA02813@cj20424-a.reston1.va.home.com> Message-ID: On Wed, 11 Oct 2000, Guido van Rossum wrote: > Py_FatalError("Invalid argument to DUP_TOPX") > > It's not quite the same since it also triggers in release mode. If, > as Thomas says, this should never happen and can only be caused by > garbled bytecode, a fatal error is proper rather than a SystemError. Can't user Python code, fiddling around with bytecode, produce garbled bytecode? In that case, it seems even better to raise an exception. Unless I misunderstand the discussion completely. jumping-to-discussions-in-the-middle-ly y'rs, Z. -- Moshe Zadka There is no IGLU cabal. http://advogato.org/person/moshez From fdrake@beopen.com Wed Oct 11 14:42:57 2000 From: fdrake@beopen.com (Fred L. Drake, Jr.) Date: Wed, 11 Oct 2000 09:42:57 -0400 (EDT) Subject: [Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.207,2.208 In-Reply-To: <200010110704.AAA12861@slayer.i.sourceforge.net> References: <200010110704.AAA12861@slayer.i.sourceforge.net> Message-ID: <14820.28257.836222.958973@cj42289-a.reston1.va.home.com> Tim Peters writes: > Update of /cvsroot/python/python/dist/src/Python > Attempt to fix bogus gcc -Wall warnings reported by Marc-Andre Lemburg, > by making the DUP_TOPX code utterly straightforward. This also gets rid > of all normal-case internal DUP_TOPX if/branches, and allows replacing one > POP() with TOP() in each case, so is a good idea regardless. Tim, There's still one left: gcc -Wall -O2 -Wstrict-prototypes -I../../Python/../Include -I.. -DHAVE_CONFIG_H -c -o ceval.o ../../Python/ceval.c ../../Python/ceval.c: In function `eval_code2': ../../Python/ceval.c:346: warning: `w' might be used uninitialized in this function Cruising through this code, it looks like the problem might be in the PRINT_NEWLINE case: case PRINT_NEWLINE: if (stream == NULL || stream == Py_None) { w = PySys_GetObject("stdout"); if (w == NULL) PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); } if (w != NULL) { /* If PRINT_NEWLINE is the opcode, w might not be initialized * here (I think), since I don't see it initialize before the * switch. Since we can't initialize it to NULL with the case * (doing so would break the PRINT_NEWLINE_TO case), it would * have to be initialized before the main loop is entered. */ err = PyFile_WriteString("\n", w); if (err == 0) PyFile_SoftSpace(w, 0); } Py_XDECREF(stream); stream = NULL; break; Ok.... yep, initializing that seems to work. I'll check in the fix for this one after I've run the regression test. -Fred -- Fred L. Drake, Jr. BeOpen PythonLabs Team Member From guido@python.org Wed Oct 11 15:54:14 2000 From: guido@python.org (Guido van Rossum) Date: Wed, 11 Oct 2000 09:54:14 -0500 Subject: [Python-Dev] OS Dependant Bugs In-Reply-To: Your message of "Wed, 11 Oct 2000 15:38:21 +0300." References: Message-ID: <200010111454.JAA03006@cj20424-a.reston1.va.home.com> > Many of the sourceforge bugs are platform dependant. Unfortunately, it is > impossible, from the main bugs page, to see which are platform dependant, > and which platform the occur on. > > I suggest that, until SF supports it properly, each bug report we enter > will have an optional [Platform] in front, if it seems to be platform > dependant. > > Any opinions? Anyone thinks submitting an SF request to add this field > is foolish? I think it's sufficient (actually better) if the platform name is mentioned in the summary. Note that you can edit the summary of existing bug reports. --Guido van Rossum (home page: http://www.python.org/~guido/) From guido@python.org Wed Oct 11 15:54:54 2000 From: guido@python.org (Guido van Rossum) Date: Wed, 11 Oct 2000 09:54:54 -0500 Subject: [Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.207,2.208 In-Reply-To: Your message of "Wed, 11 Oct 2000 15:41:27 +0300." References: Message-ID: <200010111454.JAA03020@cj20424-a.reston1.va.home.com> > Can't user Python code, fiddling around with bytecode, produce garbled > bytecode? In that case, it seems even better to raise an exception. Yes, they can produce garbled bytecode, and if that is detected, it's not safe to proceed. So a fatal error is the right thing. --Guido van Rossum (home page: http://www.python.org/~guido/) From Moshe Zadka Wed Oct 11 13:56:17 2000 From: Moshe Zadka (Moshe Zadka) Date: Wed, 11 Oct 2000 15:56:17 +0300 (IDT) Subject: [Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.207,2.208 In-Reply-To: <200010111454.JAA03020@cj20424-a.reston1.va.home.com> Message-ID: On Wed, 11 Oct 2000, Guido van Rossum wrote: > > Can't user Python code, fiddling around with bytecode, produce garbled > > bytecode? In that case, it seems even better to raise an exception. > > Yes, they can produce garbled bytecode, and if that is detected, it's > not safe to proceed. So a fatal error is the right thing. The problem with letting Python code cause fatal errors is that it makes restricted execution much more difficult. Well, something to think about for 2.1... -- Moshe Zadka There is no IGLU cabal. http://advogato.org/person/moshez From akuchlin@mems-exchange.org Wed Oct 11 14:56:50 2000 From: akuchlin@mems-exchange.org (Andrew Kuchling) Date: Wed, 11 Oct 2000 09:56:50 -0400 Subject: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: <20001011102614.R12812@xs4all.nl>; from thomas@xs4all.net on Wed, Oct 11, 2000 at 10:26:14AM +0200 References: <20001011102614.R12812@xs4all.nl> Message-ID: <20001011095650.A17931@kronos.cnri.reston.va.us> On Wed, Oct 11, 2000 at 10:26:14AM +0200, Thomas Wouters wrote: >Actually, there was some activity to define the right combination of >_GNU_SOURCE, _POSIX_SOURCE, _XOPEN_SOURCE, _BSD_SOURCE, et al, but I'm not >sure what the end result was. If any #define changes the behaviour of glibc, >these would definately be it ! A simple test might be to compile 1.5.2 with That seems the likely cause. Another faint possibility might be threading, since 2.0 automatically uses threads but 1.5.2 needs to have them enabled. (Perhaps Tim remembered this and supplied --with-thread to the 1.5.2 configure script.) --amk From guido@python.org Wed Oct 11 16:03:00 2000 From: guido@python.org (Guido van Rossum) Date: Wed, 11 Oct 2000 10:03:00 -0500 Subject: [Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.207,2.208 In-Reply-To: Your message of "Wed, 11 Oct 2000 15:56:17 +0300." References: Message-ID: <200010111503.KAA03123@cj20424-a.reston1.va.home.com> > > > Can't user Python code, fiddling around with bytecode, produce garbled > > > bytecode? In that case, it seems even better to raise an exception. > > > > Yes, they can produce garbled bytecode, and if that is detected, it's > > not safe to proceed. So a fatal error is the right thing. > > The problem with letting Python code cause fatal errors is that it makes > restricted execution much more difficult. Well, something to think about > for 2.1... Huh? In restricted execution you shouldn't be allowed to mess with bytecode! --Guido van Rossum (home page: http://www.python.org/~guido/) From guido@python.org Wed Oct 11 16:25:32 2000 From: guido@python.org (Guido van Rossum) Date: Wed, 11 Oct 2000 10:25:32 -0500 Subject: [Python-Dev] Re: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: Your message of "Wed, 11 Oct 2000 09:56:50 -0400." <20001011095650.A17931@kronos.cnri.reston.va.us> References: <20001011102614.R12812@xs4all.nl> <20001011095650.A17931@kronos.cnri.reston.va.us> Message-ID: <200010111525.KAA03324@cj20424-a.reston1.va.home.com> Bingo! 1.5.2 links with -lieee while 2.0 doesn't. Removing -lieee from the 1.5.2 link line makes is raise OverflowError too. Adding it to the 2.0 link line makes it return 0.0 for exp(-1000) and inf for exp(1000). Next question: what changed in the configure script, and why? --Guido van Rossum (home page: http://www.python.org/~guido/) From thomas@xs4all.net Wed Oct 11 15:24:37 2000 From: thomas@xs4all.net (Thomas Wouters) Date: Wed, 11 Oct 2000 16:24:37 +0200 Subject: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: <20001011102614.R12812@xs4all.nl>; from thomas@xs4all.net on Wed, Oct 11, 2000 at 10:26:14AM +0200 References: <20001011102614.R12812@xs4all.nl> Message-ID: <20001011162436.T12812@xs4all.nl> On Wed, Oct 11, 2000 at 10:26:14AM +0200, Thomas Wouters wrote: [ Py2.0 mathmodule behaves differently when doing math.exp(-1000) and such ] > Actually, there was some activity to define the right combination of > _GNU_SOURCE, _POSIX_SOURCE, _XOPEN_SOURCE, _BSD_SOURCE, et al, but I'm not > sure what the end result was. If any #define changes the behaviour of glibc, > these would definately be it ! A simple test might be to compile 1.5.2 with > the config.h from 2.0, and manually add whatever _*_SOURCE defines aren't in > 1.5.2. (They reside in Python.h and config.h, currently.) I'll see if I can > reproduce it on the glibc almost-2.2 (that is, glibc-2.1.94) systems here, > and do some of the above tests. Well, that was no success. I do see the difference between 1.5.2 and 2.0, but *damned* if I can figure out where it comes from. It doesn't seem to be any of the properly placed defines, and it doesn't seem to be the changes in mathmodule itself. Not autoconf, either. What I did: old tree (stock Python 1.5.2): math.exp(-1000) returns 0.0 new tree (current CVS): math.exp(-1000) raises OverflowError (No difference between threads enabled and disabled.) Use new config.h in old tree: math.exp(-1000) returned 0.0 Add _GNU_SOURCE and _XOPEN_SOURCE definitions (respectively 1 and 500, just like new Python.h does) to Python.h in old tree: math.exp(-1000) returns 0.0 Copy mathmodule.c and mymath.h from old tree to new tree: math.exp(-1000) raises OverflowError Copy new mathmodule.c to old tree (adding an 'include math.h' because the old Python.h isn't doing that): math.exp(-1000) returns 0.0 Copy config.h and Python.h from new tree to old one (removing the include of unicodestring.h and codecs.h, and including mymalloc.h rather than pymem.h to make it compile): math.exp(-1000) returns 0.0 So, as far as I can tell, it's not related to any code in mathmodule.c itself, nor any defines in config.h or Python.h. mymath.h isn't used either, as far as I can tell it only contains stuff for broken math stuff on obscure platforms. Sounds like time for that glibc expert right about now ;-P -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From akuchlin@mems-exchange.org Wed Oct 11 15:32:23 2000 From: akuchlin@mems-exchange.org (Andrew Kuchling) Date: Wed, 11 Oct 2000 10:32:23 -0400 Subject: [Python-Dev] Re: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: <200010111525.KAA03324@cj20424-a.reston1.va.home.com>; from guido@python.org on Wed, Oct 11, 2000 at 10:25:32AM -0500 References: <20001011102614.R12812@xs4all.nl> <20001011095650.A17931@kronos.cnri.reston.va.us> <200010111525.KAA03324@cj20424-a.reston1.va.home.com> Message-ID: <20001011103223.C17931@kronos.cnri.reston.va.us> On Wed, Oct 11, 2000 at 10:25:32AM -0500, Guido van Rossum wrote: >1.5.2 links with -lieee while 2.0 doesn't. >Next question: what changed in the configure script, and why? The patch from revisions 1.138 to 1.139 of configure.in is: 853c1139,1142 < AC_CHECK_LIB(ieee, __fpu_control) --- > AC_CHECK_FUNC(__fpu_control, > [], > [AC_CHECK_LIB(ieee, __fpu_control) > ]) The check-in comment is "Only link with -lieee when it's necessary". If it only checks for -lieee when the __fpu_control function is defined, perhaps the function disappeared in glibc 2.1. --amk From thomas@xs4all.net Wed Oct 11 15:32:45 2000 From: thomas@xs4all.net (Thomas Wouters) Date: Wed, 11 Oct 2000 16:32:45 +0200 Subject: [Python-Dev] Re: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: <200010111525.KAA03324@cj20424-a.reston1.va.home.com>; from guido@python.org on Wed, Oct 11, 2000 at 10:25:32AM -0500 References: <20001011102614.R12812@xs4all.nl> <20001011095650.A17931@kronos.cnri.reston.va.us> <200010111525.KAA03324@cj20424-a.reston1.va.home.com> Message-ID: <20001011163244.U12812@xs4all.nl> On Wed, Oct 11, 2000 at 10:25:32AM -0500, Guido van Rossum wrote: > 1.5.2 links with -lieee while 2.0 doesn't. Removing -lieee from the > 1.5.2 link line makes is raise OverflowError too. Adding it to the > 2.0 link line makes it return 0.0 for exp(-1000) and inf for > exp(1000). Ack, that's the one thing I didn't check: link libraries ;-P > Next question: what changed in the configure script, and why? Well, that's easy. Old configure.in: # Linux requires this for correct f.p. operations AC_CHECK_LIB(ieee, __fpu_control) New configure.in: # Linux requires this for correct f.p. operations AC_CHECK_FUNC(__fpu_control, [], [AC_CHECK_LIB(ieee, __fpu_control) ]) I remember the patch that did this, on SF. It was titled "don't link with -lieee if it isn't necessary" or something. Not sure what it would break, but mayhaps declaring -lieee necessary on glibc systems is the right fix ? (For the non-autoconf readers among us: the first snippet writes a test program to see if the function '__fpu_control' exists when linking with -lieee in addition to $LIBS, and if so, adds -lieee to $LIBS. The second snippet writes a test program to see if the function '__fpu_control' exists with the current collection of $LIBS. If it doesn't, it tries it again with -lieee, and adds -lieee to $LIBS if it finds it then.) Pesonally, I think the patch should just be reversed... The comment above the check certainly could be read as 'Linux requires -lieee for correct f.p. operations', and perhaps that's how it was meant. -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From skip@mojam.com (Skip Montanaro) Wed Oct 11 17:31:48 2000 From: skip@mojam.com (Skip Montanaro) (Skip Montanaro) Date: Wed, 11 Oct 2000 11:31:48 -0500 (CDT) Subject: [Python-Dev] -Wall output for the Python 2.0c1 In-Reply-To: References: <14819.34443.951260.635718@cj42289-a.reston1.va.home.com> Message-ID: <14820.38388.827883.710489@beluga.mojam.com> Tim> I'll take this one. It looks easy to fix ... Seems to me like a patch that ought to wait until after 2.0final. It's definitely not a show-stopping bug... Skip From thomas@xs4all.net Wed Oct 11 19:04:31 2000 From: thomas@xs4all.net (Thomas Wouters) Date: Wed, 11 Oct 2000 20:04:31 +0200 Subject: [Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.207,2.208 In-Reply-To: <200010111503.KAA03123@cj20424-a.reston1.va.home.com>; from guido@python.org on Wed, Oct 11, 2000 at 10:03:00AM -0500 References: <200010111503.KAA03123@cj20424-a.reston1.va.home.com> Message-ID: <20001011200431.V12812@xs4all.nl> On Wed, Oct 11, 2000 at 10:03:00AM -0500, Guido van Rossum wrote: > > > > Can't user Python code, fiddling around with bytecode, produce garbled > > > > bytecode? In that case, it seems even better to raise an exception. > > > Yes, they can produce garbled bytecode, and if that is detected, it's > > > not safe to proceed. So a fatal error is the right thing. > > The problem with letting Python code cause fatal errors is that it makes > > restricted execution much more difficult. Well, something to think about > > for 2.1... > Huh? In restricted execution you shouldn't be allowed to mess with > bytecode! Well, I can see what Moshe means. You get a code object passed in, say, an untrusted pickle or some such. You want to execute it, but you don't want it to ruin your life. Causing the entire program to quit could be considered 'ruining'. On the other hand, if you can hand-tweak bytecode streams in that degree, you can f** up a lot more. On the one foot, though, most of the calls to Py_FatalError (as far as I can see) deal with initialization failures, or structures to which tweaked bytecode would not have access. On the other foot, it's probably possible to tweak bytecode to *get* access to those structures, or at least structures that don't like being dereferenced or DECREF'd. And there's probably more to consider, but I haven't got any public appendages left, and there might be children listening ;) All in all, Guido's probably right... If something like this happens, you don't want to continue. If the argument to DUP_TOPX is something other than what compile.c generates (between 1 and 5, inclusive, that is) something strange is going on internally. Better to quit now than delete c:\command.com by 'accident'. If people can do this to code being run in restricted environments, they can probably do worse things, too! Now I just need an OK from Jeremy, as the maitre d', and I'll check it in. -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From guido@python.org Wed Oct 11 22:19:28 2000 From: guido@python.org (Guido van Rossum) Date: Wed, 11 Oct 2000 16:19:28 -0500 Subject: [Python-Dev] Re: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: Your message of "Wed, 11 Oct 2000 16:32:45 +0200." <20001011163244.U12812@xs4all.nl> References: <20001011102614.R12812@xs4all.nl> <20001011095650.A17931@kronos.cnri.reston.va.us> <200010111525.KAA03324@cj20424-a.reston1.va.home.com> <20001011163244.U12812@xs4all.nl> Message-ID: <200010112119.QAA03651@cj20424-a.reston1.va.home.com> Thanks for digging deeper into this. > Pesonally, I think the patch should just be reversed... The comment above > the check certainly could be read as 'Linux requires -lieee for correct f.p. > operations', and perhaps that's how it was meant. No, the configure patch is right. Tim will check in a change that treats ERANGE with a return value of 0.0 as underflow (returning 0.0, not raising OverflowError). --Guido van Rossum (home page: http://www.python.org/~guido/) From tim_one@email.msn.com Wed Oct 11 22:02:16 2000 From: tim_one@email.msn.com (Tim Peters) Date: Wed, 11 Oct 2000 17:02:16 -0400 Subject: [Python-Dev] -Wall output for the Python 2.0c1 In-Reply-To: <14820.38388.827883.710489@beluga.mojam.com> Message-ID: [Tim] > I'll take this one [wngs putatively due to DUP_TOPX]. It looks easy > to fix ... [Skip Montanaro] > Seems to me like a patch that ought to wait until after 2.0final. It's > definitely not a show-stopping bug... Would have been a more interesting argument had you posted this before the patch was checked in . But wngs are non-negotiable with me anyway. This example turned out to be a good one for showing why: the bogus wngs covered up a legitimate "uninitialized vrbl" complaint (see Fred's later discovery and following checkin). I've simply got zero tolerance for wngs or for failures in the std test suite. My view is warped by prior experience, though: the last 6 years, I worked on projects where the compilers were fiddled to treat warnings as fatal errors. So while this may have looked like a harmless batch of wngs to you, as far as I was concerned Python couldn't even be compiled anymore <0.7 wink>. extremism-in-defense-of-simple-best-practice-may-or-may-not-be- vice-but-it's-sure-effective-over-the-long-term-ly y'rs - tim From skip@mojam.com (Skip Montanaro) Wed Oct 11 22:07:42 2000 From: skip@mojam.com (Skip Montanaro) (Skip Montanaro) Date: Wed, 11 Oct 2000 16:07:42 -0500 (CDT) Subject: [Python-Dev] -Wall output for the Python 2.0c1 In-Reply-To: References: <14820.38388.827883.710489@beluga.mojam.com> Message-ID: <14820.54942.114086.773609@beluga.mojam.com> Tim> [Tim] >> I'll take this one [wngs putatively due to DUP_TOPX]. It looks easy >> to fix ... Tim> [Skip Montanaro] >> Seems to me like a patch that ought to wait until after 2.0final. >> It's definitely not a show-stopping bug... Tim> Would have been a more interesting argument had you posted this Tim> before the patch was checked in . Agreed, but I posted as soon as I saw it. Can't help it if I can't keep up with all the flurry of activity. Tim> So while this may have looked like a harmless batch of wngs to you, Tim> as far as I was concerned Python couldn't even be compiled anymore Tim> <0.7 wink>. I accept your explanation. ;-) S From jack@oratrix.nl Wed Oct 11 22:10:36 2000 From: jack@oratrix.nl (Jack Jansen) Date: Wed, 11 Oct 2000 23:10:36 +0200 Subject: [Python-Dev] test_StringIO failing on the Mac Message-ID: <20001011211041.96D2BE266F@oratrix.oratrix.nl> I have one remaining problem (at least, as far as I'm aware:-) with 2.0c1 on the Mac: test_StringIO fails. The reason is that the test_StringIO output file was generated on Unix, and hence it uses the unix form of string.letters (a-zA-Z), whereas the Mac version of string.letters has far more values. As this isn't what the test is about in the first place, shall I fix the test? -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | ++++ see http://www.xs4all.nl/~tank/ ++++ From tim_one@email.msn.com Wed Oct 11 22:14:17 2000 From: tim_one@email.msn.com (Tim Peters) Date: Wed, 11 Oct 2000 17:14:17 -0400 Subject: [Python-Dev] test_StringIO failing on the Mac In-Reply-To: <20001011211041.96D2BE266F@oratrix.oratrix.nl> Message-ID: [Jack Jansen] > I have one remaining problem (at least, as far as I'm aware:-) with > 2.0c1 on the Mac: test_StringIO fails. > > The reason is that the test_StringIO output file was generated on > Unix, and hence it uses the unix form of string.letters (a-zA-Z), > whereas the Mac version of string.letters has far more values. > > As this isn't what the test is about in the first place, shall I fix > the test? +1 from me on making the test portable. From jeremy@beopen.com Thu Oct 12 00:06:56 2000 From: jeremy@beopen.com (Jeremy Hylton) Date: Wed, 11 Oct 2000 19:06:56 -0400 (EDT) Subject: [Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.207,2.208 In-Reply-To: <20001011200431.V12812@xs4all.nl> References: <200010111503.KAA03123@cj20424-a.reston1.va.home.com> <20001011200431.V12812@xs4all.nl> Message-ID: <14820.62096.15085.749912@bitdiddle.concentric.net> >>>>> "TW" == Thomas Wouters writes: [Moshe:] >> > The problem with letting Python code cause fatal errors is that >> > it makes restricted execution much more difficult. Well, >> > something to think about for 2.1... [Guido:] >> Huh? In restricted execution you shouldn't be allowed to mess >> with bytecode! TW> Well, I can see what Moshe means. You get a code object passed TW> in, say, an untrusted pickle or some such. You want to execute TW> it, but you don't want it to ruin your life. Causing the entire TW> program to quit could be considered 'ruining'. On the other TW> hand, if you can hand-tweak bytecode streams in that degree, you TW> can f** up a lot more. Damn straight! If you're using restricted execution mode and accepting bytecode objects that weren't produced by a trusted Python compiler, you're nuts. I am not aware of any effort made to protect the Python VM from attack via malicious bytecode. TW> Now I just need an OK from Jeremy, as the maitre d', and I'll TW> check it in. Your table is ready. A checkin message will be accepted as gratuity. Jeremy From jeremy@beopen.com Thu Oct 12 00:12:15 2000 From: jeremy@beopen.com (Jeremy Hylton) Date: Wed, 11 Oct 2000 19:12:15 -0400 (EDT) Subject: [Python-Dev] Re: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: <200010112119.QAA03651@cj20424-a.reston1.va.home.com> References: <20001011102614.R12812@xs4all.nl> <20001011095650.A17931@kronos.cnri.reston.va.us> <200010111525.KAA03324@cj20424-a.reston1.va.home.com> <20001011163244.U12812@xs4all.nl> <200010112119.QAA03651@cj20424-a.reston1.va.home.com> Message-ID: <14820.62415.873159.533077@bitdiddle.concentric.net> I checked in the patch that removed the -lieee link in some cases. I don't remember the details off the top of my head, but I can go digging in the SF patch logs if it's important. As I recall, someone reported problems on a platform (HPUX?) where link with ieee caused problems. I didn't have access to the platform in question. So I applied the patch on a Linux box and ran the regression test; it reported no errors, so I assumed the patch fixed some other platform and did mine no harm. At the moment, I would assume that the patch still helps some other platform but might not be right on Linux. On the other hand, it sounds like Tim has a patch that will cause Linux to do the right thing. It's hard to say much about what should or should not happen since neither the language reference nor the regression tests specifies much about what should happen with fp. Jeremy From thomas@xs4all.net Thu Oct 12 00:15:21 2000 From: thomas@xs4all.net (Thomas Wouters) Date: Thu, 12 Oct 2000 01:15:21 +0200 Subject: [Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Modules dlmodule.c,2.14,2.15 In-Reply-To: <200010112144.OAA20776@slayer.i.sourceforge.net>; from fdrake@users.sourceforge.net on Wed, Oct 11, 2000 at 02:44:05PM -0700 References: <200010112144.OAA20776@slayer.i.sourceforge.net> Message-ID: <20001012011521.X12812@xs4all.nl> On Wed, Oct 11, 2000 at 02:44:05PM -0700, Fred L. Drake wrote: > Update of /cvsroot/python/python/dist/src/Modules > In directory slayer.i.sourceforge.net:/tmp/cvs-serv20717 > > Modified Files: > dlmodule.c > Log Message: > > Remove one more gcc -Wall warning. To note, if gcc didn't inherit at least *some* of C's original philosophy of 'the programmer always knows what [s]he is doing', gcc would yell bloody murder at this code. The 'func' function pointer is used to point to symbols loaded from arbitrary shared objects, and the dlmodule has no way of knowing howmany arguments the function expects, or even if it isn't more than 10 (which would result in the function grabbing garbage off the stack, on most architectures, I think.) While on the ANSIfication spree, I ran screaming and hid under my bed after reading this code ;) Is anyone using the dlmodule anymore ? Is it really useful ? Is this *really* how loading and calling arbitrary shared objects should be done ? :P > { > PyObject *name; > ! long (*func)(long, long, long, long, long, > ! long, long, long, long, long); > long alist[10]; > long res; Idle-and-post-2.0-talk-ly y'rs, -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From huaiyu_zhu@yahoo.com Thu Oct 12 00:33:08 2000 From: huaiyu_zhu@yahoo.com (Huaiyu Zhu) Date: Wed, 11 Oct 2000 16:33:08 -0700 (PDT) Subject: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: Message-ID: On the issue of whether Python should ignore over/underflow on IEEE-enabled platforms: [Tim Peters] > That would stop the exception on exp() underflow, which is what you're > concerned about. It would also stop exceptions on exp() overflow, and on > underflow and overflow for all other math functions too. I doubt Guido will > ever let Python ignore overflow by default, #ifdef'ed or not. A semantic > change that jarring certainly won't happen for 2.0 (which is just a week > away). It can be argued that on IEEE enabled systems the proper thing to do for overflow is simply return Inf. Raising exception is WRONG. See below. [Guido van Rossum] > Incidentally, math.exp(800) returns inf in 1.5, and raises > OverflowError in 2.0. So at least it's consistent. That is not consistent at all. Suppose I'm plotting the curve f(x) where x include some singular points of f. In the first case the plot works with some portion of the curve clipped. In the second case it bombs. [Tim Peters] > Nothing like that will happen without a PEP first. I would like to see > *serious* 754 support myself, but that depends too on many platform experts > contributing real work (if everyone ran WinTel, I could do it myself > ). [Guido van Rossum] > Bingo! > > 1.5.2 links with -lieee while 2.0 doesn't. Removing -lieee from the > 1.5.2 link line makes is raise OverflowError too. Adding it to the > 2.0 link line makes it return 0.0 for exp(-1000) and inf for > exp(1000). If using ieee is as simple as setting such a flag, there is no reason at all not to use it. Here are some more examples: Suppose you have done hours of computation on a problem. Just as you are about to get the result, you get an exception. Why? Because the residual error is too close to zero. Suppose you want to plot the curve of Gausian distribution. Oops, it fails. Because beyond a certain region the value is near zero. With these kinds of problems, vectorized numerical calculation becomes nearly impossible. How do you work in such an environment? You have to wrap every calculation in a try/except structure, and whenever there is an exception, you have to revert to elementwise operations. In practice this simply means Python would not be suitable for numerical work at all. What about the other way round? No problem. It is easy to write functions like isNaN, isInf, etc. With these one can raise exceptions in any place one want. It is even possible to raise exceptions if a matrix is singular to a certain precision, etc. The key point to observe here is that most numerical work involve more than one element. Some of them may be out of mahcine bounds but the whole thing could still be quite meaningful. Vice versa it is also quite possible that all elements are within bounds while the whole thing is meaningless. The language should never take over or subvert decisions based on numerical analysis. [Tim Peters] > Ignoring ERANGE entirely is not at all the same behavior as 1.5.2, and > current code certainly relies on detecting overflows in math functions. As Guido observed ERANGE is not generated with ieee, even for overflow. So it is the same behavior as 1.5.2. Besides, no correct numerical code should depend on exceptions like this unless the machine is incapable of handling Inf and NaN. Even in the cases where you do want to detect overflow, it is still wrong to use exceptions. Here's an example: x*log(x) approaches 0 as x approaches 0. If x==0 then log(x)==-Inf but 0*-Inf==NaN, not what one would want. But exception is the wrong tool to hangle this, because if x is an array, some of its element may be zero but other's may not. The right way to do it is something like def entropy(probability): p = max(probability, 1e-323) return p*log(p) [Tim Peters] > In no case can you expect to see overflow ignored in 2.0. You are proposing a dramatic change from the behavior of 1.5.2. This looks like to me to need a PEP and a big debate. It would break a LOT of numerical computations. [Thomas Wouters] > I remember the patch that did this, on SF. It was titled "don't link with > -lieee if it isn't necessary" or something. Not sure what it would break, > but mayhaps declaring -lieee necessary on glibc systems is the right fix ? > > (For the non-autoconf readers among us: the first snippet writes a test > program to see if the function '__fpu_control' exists when linking with > -lieee in addition to $LIBS, and if so, adds -lieee to $LIBS. The second > snippet writes a test program to see if the function '__fpu_control' > exists with the current collection of $LIBS. If it doesn't, it tries it > again with -lieee, > > Pesonally, I think the patch should just be reversed... The comment above > the check certainly could be read as 'Linux requires -lieee for correct > f.p. operations', and perhaps that's how it was meant. The patch as described seems to be based on flawed thinking. The numbers Inf and NaN are always necessary. The -lieee could only be unnecessary if the behavior is the same as IEEE. Obviously it isn't. So I second Thomas's suggestion. [Tim Peters] > If no progress is made on determining the true cause over the next few days, > I'll hack mathmodule.c to ignore ERANGE in the specific case the result > returned is a zero (which would "fix" your exp underflow problem without > stopping overflow detection). Since this will break code on any platform > where errno was set to ERANGE on underflow in 1.5.2, I'll need to have a > long discussion w/ Guido first. I *believe* that much is actually sellable > for 2.0, because it moves Python in a direction I know he likes regardless > of whether he ever becomes a 754 True Believer. [Guido van Rossum] > No, the configure patch is right. Tim will check in a change that > treats ERANGE with a return value of 0.0 as underflow (returning 0.0, > not raising OverflowError). What is the reason to do this? It looks like intetionally subverting ieee even when it is available. I thought Tim meant that only logistical problems prevent using ieee. If you do choose this route, please please please ignore ERANGE entirely, whether return value is zero or not. The only possible way that ERANGE could be useful at all is if it could be set independently for each element of an array, and if it behave as a warning instead of an exception, ie. the calculation would continue if it is not caught. Well, then, Inf and NaN serve this purpose perfectly. It is very reasonable to set errno in glibc for this; it is completely unreasonable to raise an exception in Python, because exceptions cannot be set to individual elements and they cannot be ignored. Huaiyu -- Huaiyu Zhu hzhu@users.sourceforge.net Matrix for Python Project http://MatPy.sourceforge.net From dubois@users.sourceforge.net Thu Oct 12 01:04:51 2000 From: dubois@users.sourceforge.net (Paul F. Dubois) Date: Wed, 11 Oct 2000 17:04:51 -0700 Subject: [Python-Dev] RE: [Numpy-discussion] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: Message-ID: I don't have time to follow in detail this thread about changed behavior between versions. These observations are based on working with hundreds of code authors. I offer them as is. a. Nobody runs a serious numeric calculation without setting underflow-to-zero, in the hardware. You can't even afford the cost of software checks. Unfortunately there is no portable way to do that that I know of. b. Some people use Inf but most people want the code to STOP so they can find out where the INFS started. Otherwise, two hours later you have big arrays of Infs and no idea how it happened. Likewise sqrt(-1.) needs to stop, not put a zero and keep going. From guido@python.org Thu Oct 12 02:45:30 2000 From: guido@python.org (Guido van Rossum) Date: Wed, 11 Oct 2000 20:45:30 -0500 Subject: [Python-Dev] RE: [Numpy-discussion] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: Your message of "Wed, 11 Oct 2000 17:04:51 MST." References: Message-ID: <200010120145.UAA02030@cj20424-a.reston1.va.home.com> > I don't have time to follow in detail this thread about changed behavior > between versions. These observations are based on working with hundreds of > code authors. I offer them as is. > > a. Nobody runs a serious numeric calculation without setting > underflow-to-zero, in the hardware. You can't even afford the cost of > software checks. Unfortunately there is no portable way to do that that I > know of. > > b. Some people use Inf but most people want the code to STOP so they can > find out where the INFS started. Otherwise, two hours later you have big > arrays of Infs and no idea how it happened. Likewise sqrt(-1.) needs to > stop, not put a zero and keep going. Thanks, Paul! This behavior has always been what I wanted Python to do (even though it's not always what Python did, depending on the platform) and also what Tim's proposed patch will implement for the specific case of math.exp() (and other math functions that may underflow or overflow), on most reasonable platforms. There are still lots of places where the platform gives Python no choice of creating NaN and Inf, and because there's no platform-independent way to test for these, they are hard to avoid in some cases; but eventually, Tim will find a way to root them out. And for people like Huaiyu, who want to see Inf, there will (eventually) be a way to select this as a run-time option; and ditto for whoever might want underflow to raise an exception. --Guido van Rossum (home page: http://www.python.org/~guido/) From huaiyu_zhu@yahoo.com Thu Oct 12 03:22:54 2000 From: huaiyu_zhu@yahoo.com (Huaiyu Zhu) Date: Wed, 11 Oct 2000 19:22:54 -0700 (PDT) Subject: [Python-Dev] RE: [Numpy-discussion] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: <200010120145.UAA02030@cj20424-a.reston1.va.home.com> Message-ID: [Paul Dubois] > > > > a. Nobody runs a serious numeric calculation without setting > > underflow-to-zero, in the hardware. You can't even afford the cost of > > software checks. Unfortunately there is no portable way to do that that I > > know of. Amen. > > > > b. Some people use Inf but most people want the code to STOP so they can > > find out where the INFS started. Otherwise, two hours later you have big > > arrays of Infs and no idea how it happened. Likewise sqrt(-1.) needs to > > stop, not put a zero and keep going. $ /usr/bin/python Python 1.5.2 (#1, Sep 17 1999, 20:15:36) [GCC egcs-2.91.66 19990314/Linux (egcs- on linux-i386 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> from math import * >>> exp(777) inf >>> exp(-777) 0.0 >>> sqrt(-1) Traceback (innermost last): File " ", line 1, in ? OverflowError: math range error This was sane behavior. Are we saying that Python 2.0 has invented something better than IEEE 754? [Guido van Rossum] > Thanks, Paul! This behavior has always been what I wanted Python to > do (even though it's not always what Python did, depending on the > platform) and also what Tim's proposed patch will implement for the > specific case of math.exp() (and other math functions that may > underflow or overflow), on most reasonable platforms. Guido, with due respect to your decisions on Python issues, I simply have to fight this one. It is one thing to accomodate for naive users, but it is another to dumb down every one else. Case 1. Someone writes a flawed numerical routine. Two hours later he finds his array filled with Inf and NaN. Case 2. Someone writes a perfect numerical routine. Two hours later he gets an exception, because the error is near zero. Solution for case 1. Use better algorithm. Use better error control. Raise exceptions when error is too large. These are proper solutions. They are easy and efficient to implement. They are needed anyway - If something's wrong, you want to raise exceptions far earlier than Inf, certainly before you get arrays filled with elements like 1e300. Solution for case 2. Almost impossible. The division between under- and over-flow is artificial. What about 1/x or similar functions? The only way to work on such a platform is to abandon vectorized computation. > There are still lots of places where the platform gives Python no > choice of creating NaN and Inf, and because there's no > platform-independent way to test for these, they are hard to avoid in > some cases; but eventually, Tim will find a way to root them out. And > for people like Huaiyu, who want to see Inf, there will (eventually) > be a way to select this as a run-time option; and ditto for whoever > might want underflow to raise an exception. I can understand that exceptions are the only available choices if IEEE is not available. But is there a compelling reason that Python should behave "better" than IEEE when it's in fact available? If the reason is to protect naive users, I can think of several responses: 1. For people doing one-off interactive work, returning Inf is in fact more informative. 2. For users iterative numerical computations, they need to be educated about error control. Otherwise they won't get corrent results anyway. 3. For really serious work, we could provide good numerical modules so that they don't need to write themselves. To make this happen fast the fewer debacles like this one the better. Case in point: Someone asked for regession modules two weeks ago. I was trying to convert my old matlab programs, which only took a few hours. But I wasted a week of (spare) time fighting for some mysterious "overflow". Turns out that a Guassian is near zero when it's far from center, and Python does not like it. In practice, Inf may be generated more often as a proper value than by mistake. This is not an issue about whether someone "prefers" Inf or exception. It is about whether there is a choice to do proper computation. Returning Inf does not prevent someone to raise exception. Raising exception automatically prevents perfect algorithms to work properly. As Kevin has volunteered to help with IEEE implementation and made a plan, is there a strong reason to drop IEEE for Linux in 2.0? If there is insufficient time to carry out his plan, wouldn't it be prudent to keep things as they were in 1.5.2? Huaiyu From tim_one@email.msn.com Thu Oct 12 03:44:20 2000 From: tim_one@email.msn.com (Tim Peters) Date: Wed, 11 Oct 2000 22:44:20 -0400 Subject: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: Message-ID: [Huaiyu Zhu] > On the issue of whether Python should ignore over/underflow on > IEEE-enabled platforms: > > It can be argued that on IEEE enabled systems the proper thing to do for > overflow is simply return Inf. Raising exception is WRONG. See below. Python was not designed with IEEE-754 in mind, and *anything* that happens wrt Infs, NaNs, and all other 754 features in Python is purely an accident that can and does vary wildly across platforms. And, as you've discovered in this case, can vary wildly also across even a single library, depending on config options. We cannot consider this to be a bug since Python has had no *intended* behavior whatsoever wrt 754 gimmicks. We can and do consider gripes about these accidents to be feature requests. [Guido] > Incidentally, math.exp(800) returns inf in 1.5, and raises > OverflowError in 2.0. So at least it's consistent. [Huaiyu] > That is not consistent at all. Please read with an assumption of good faith. Guido was pointing out that-- all in the specific case of gcc+glibc on Linux (these don't hold on other platforms) --exp(800) returning Inf in 1.5 and OverflowError in 2.0 is consistent *with* that exp(-800) returns 0 in 1.5 and raises an exception in 2.0. He's right; indeed, he is in part agreeing with you. [Guido > 1.5.2 links with -lieee while 2.0 doesn't. Removing -lieee from the > 1.5.2 link line makes is raise OverflowError too. Adding it to the > 2.0 link line makes it return 0.0 for exp(-1000) and inf for > exp(1000). [Huaiyu] > If using ieee is as simple as setting such a flag, there is no > reason at all not to use it. The patch to stop setting -lieee was contributed by a Python user who claimed it fixed bugs on *their* platform. That's "the reason". We don't want to screw them either. > Here are some more examples: > ... I understand that 754 semantics can be invaluable. So does Guido. There's no argument about that. But Python doesn't yet support them, and wishing it did doesn't make it so. If linking with -lieee happens to give you the semantics you want on your platform today, you're welcome to build with that switch. It appears to be a bad choice for *most* Python users, though (more below), so we don't want to do it in the std 2.0 distro. > ... > In practice this simply means Python would not be suitable for numerical > work at all. Your biggest obstacle in getting Python support for 754 will in fact be opposition from number-crunchers. I've been slinging fp for 21 years, 15 of those writing compilers and math libraries for "supercomputer" vendors. 754 is a Very Good Thing, but is Evil in subset form (see Kahan's (justified!) vilification of Java on this point); ironically, 754 is hardest to sell to those who could benefit from it the most. > What about the other way round? No problem. It is easy to write > functions like isNaN, isInf, etc. It's easy for a platform expert to write such functions for their specific platform of expertise, but it's impossible to write them in a portable way before C99 is implemented (C99 requires that library suppliers provide them, rendering the question moot). > ... > The language should never take over or subvert decisions based on > numerical analysis. Which is why a subset of 754 is evil. 754 requires that the user be able to *choose* whether or not, e.g., overflow signals an exception. Your crusade to insist that it never raise an exception is as least as bad (I think it's much worse) as Python's most common accidental behavior (where overflow from libm usually raises an exception). One size does not fit all. [Tim] > Ignoring ERANGE entirely is not at all the same behavior as 1.5.2, and > current code certainly relies on detecting overflows in math functions. [Huaiyu] > As Guido observed ERANGE is not generated with ieee, even for > overflow. So it is the same behavior as 1.5.2. You've got a bit of a case of tunnel vision here, Huaiyu. Yes, in the specific case of gcc+glibc+Linux, ignoring ERANGE returned from exp() is what 1.5.2 acted like. But you have not proposed to ignore it merely from ERANGE returned from exp() in the specific case of gcc+glibc+Linux. This code runs on many dozens of platforms, and, e.g., as I suggested before, it looks like HPUX has always set errno on both overflow and underflow. MS Windows sets it on overflow but not underflow. Etc. We have to worry about the effects on all platforms. > Besides, no correct numerical code should depend on exceptions like > this unless the machine is incapable of handling Inf and NaN. Nonsense. 754 provides the option to raise an exception on overflow, or not, at the user's discretion, precisely because exceptions are sometimes more appropriate than Infs of NaNs. Kahan himself isn't happy with Infs and NaNs because they're too often too gross a clue (see his writings on "presubstitution" for a more useful approach). [Tim] > In no case can you expect to see overflow ignored in 2.0. [Huaiyu] > You are proposing a dramatic change from the behavior of 1.5.2. > This looks like to me to need a PEP and a big debate. It would break > a LOT of numerical computations. I personally doubt that, but realize it may be true. That's why he have beta releases. So far yours is the only feedback we've heard (thanks!), and as a result we're going to change 2.0 to stop griping about underflow, and do so in a way that will actually work across all platforms. We're probably going to break some HPUX programs as a result; but they were relying on accidents too. [Guido] > No, the configure patch is right. Tim will check in a change that > treats ERANGE with a return value of 0.0 as underflow (returning 0.0, > not raising OverflowError). [Huaiyu] > What is the reason to do this? It looks like intetionally subverting > ieee even when it is available. I thought Tim meant that only logistical > problems prevent using ieee. Python does not support 754 today. Period. I would like it to, but not in any half-assed, still platform-dependent, still random crap-shoot, still random subset of 754 features, still rigidly inflexible, way. When it does support it, Guido & I will argue that it should enable (what 754 calls) the overflow, divide-by-0 and invalid operation exceptions by default, and disable the underflow and inexact exceptions by default. This ensures that, under the default, an infinity or NaN can never be created from non-exceptional inputs without triggering an exception. Not only is that best for newbies, you'll find it's the *only* scheme for a default that can be sold to working number-crunchers (been there, done that, at Kendall Square Research). It also matches Guido's original, pre-754, *intent* for how Python numerics should work by default (it is, e.g., no accident that Python has always had an OverflowError exception but never an UnderflowError one). And that corresponds to the change Guido says I'm going to make in mathmodule.c: suppress complaints about underflow, but let complaints about overflow go through. This is not a solution, it's a step on a path towards a solution. The next step (which will not happen for 2.0!) is to provide an explicit way to, from Python, disable overflow checking, and that's simply part of providing the control and inquiry functions mandated by 754. Then code that would rather deal with Infs than exceptions can, at its explicit discretion. > If you do choose this route, please please please ignore ERANGE entirely, > whether return value is zero or not. It should be clear that isn't going to happen. I realize that triggering overflow is going to piss you off, but you have to realize that not triggering overflow is going to piss more people off, and *especially* your fellow number-crunchers. Short of serious 754 support, picking "a winner" is the best we can do for now. You have the -lieee flag on your platform du jour if you can't bear it. [Paul Dubois] > I don't have time to follow in detail this thread about changed behavior > between versions. What makes you think we do <0.5 wink>? > These observations are based on working with hundreds of code authors. I > offer them as is. FWIW, they exactly match my observations from 15 years on the HW vendor side. > a. Nobody runs a serious numeric calculation without setting underflow-to- > zero, in the hardware. You can't even afford the cost of software checks. > Unfortunately there is no portable way to do that that I know of. C allows libm implementations a lot of discretion in whether to set errno to ERANGE in case of underflow. The change we're going to make is to ignore ERANGE in case of underflow, ensuring that math.* functions will *stop* raising underflow exceptions on all platforms (they'll return a zero instead; whether +0 or -0 will remain a platform-dependent crap shoot for now). Nothing here addresses underflow exceptions that may be raised by fp hardware, though; this has solely to do with the platform libm's treatment of errno. So in this respect, we're removing Python's current unpredictability, and in the way you favor. > b. Some people use Inf but most people want the code to STOP so they can > find out where the INFS started. Otherwise, two hours later you have big > arrays of Infs and no idea how it happened. Apparently Python on libc+glibc+Linux never raised OverflowError from math.* functions in 1.5.2 (although it did on most other platforms I know about). A patch checked in to fix some other complaint on some other Unixish platform had the side-effect of making Python on libc+glibc+Linux start raising OverflowError from math.* functions in 2.0, but in both overflow and underflow cases. We intend to (as above) suppress the underflow exceptions, but let the overflow cases continue to raise OverflowError. Huaiyu's original complaint was about the underflow cases, but (as such things often do) expanded beyond that when it became clear he would get what he asked for . Again we're removing Python's current unpredictability, and again in the way you favor -- although this one is still at the mercy of whether the platform libm sets errno correctly on overflow (but it seems that most do these days). > Likewise sqrt(-1.) needs to stop, not put a zero and keep going. Nobody has proposed changing anything about libm domain (as opposed to range) errors (although Huaiyu probably should if he's serious about his flavor of 754 subsetism -- I have no idea what gcc+glibc+Linux did here on 1.5.2, but it *should* have silently returned a NaN (not a zero) without setting errno if it was *self*-consistent -- anyone care to check that under -lieee?: import math math.sqrt(-1) NaN or ValueError? 2.0 should raise ValueError regardless of what 1.5.2 did here.). just-another-day-of-universal-python-harmony-ly y'rs - tim From sdm7g@virginia.edu Thu Oct 12 04:23:32 2000 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Wed, 11 Oct 2000 23:23:32 -0400 (EDT) Subject: [Python-Dev] RE: [Numpy-discussion] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: Message-ID: First: I haven't followed this thread from the beginning -- only the last ten or so posts. Second: One reason I didn't follow it from the start is that I'm not doing any heavy numerical stuff in Python. I've been using Lisp for that, and use Python more for string/symbolic or GUI hacking. But, if I was going to do the sort of numerical stuff I now do in Lisp in Python, I would agree with Huaiya Zhu. I do a lot of vectorized operations on what are often independent samples. If some of the numbers overflow or underflow, that just represents an outlier or bad sample. I don't want it to blow off the whole pipeline of operations on the other data points in the vector -- they are independent of the bad points. In my case, it's not that these are lengthy calculations. It's that they are interactive and tied to immediate graphical representations. If there are strange zero's or infinities in the result, there is (or should be) a way to backtrack and investigate. ( That's why people want interactive and graphical regression analysis and modeling tools! ) The idea that your calculation should blow up and you should check it and resubmit your job sounds just so ancient-20th-century- Fortran-JCL-and-punched-cards-technology! ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- "All operating systems want to be unix, All programming languages want to be lisp." From tim_one@email.msn.com Thu Oct 12 05:18:19 2000 From: tim_one@email.msn.com (Tim Peters) Date: Thu, 12 Oct 2000 00:18:19 -0400 Subject: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: <20001011234038.A2322@better.net> Message-ID: [William Park] > On Wed, Oct 11, 2000 at 10:44:20PM -0400, Tim Peters wrote: > > > Likewise sqrt(-1.) needs to stop, not put a zero and keep going. I didn't write that. Paul Dubois did. > Hmm... I don't like this. It should stop or return complex. Paul said it should stop. You said it should stop (or return complex). So what is it that you don't like ? 754 mandates that sqrt(x) for x<0 return a NaN and keep going (by default) -- which even Huaiyu apparently doesn't like. [actually Tim] > I have no idea what gcc+glibc+Linux did here on 1.5.2, but it *should* > have silently returned a NaN (not a zero) without setting errno if it > was *self*-consistent -- anyone care to check that under -lieee?: > > import math > math.sqrt(-1) > > NaN or ValueError? 2.0 should raise ValueError regardless of > what 1.5.2 did here.). [back to William] > It returns 'OverflowError: math range error' in 1.5.2, Ah, that's hilarious ! It's tempting to believe that glibc is violating the IEEE std despite the -lieee flag in this case, but I don't believe that's true: it's almost certainly the case that glibc is actually returning a NaN, *not* setting errno at all, and this other check in Python's mathmodule.c: #define CHECK(x) if (errno != 0) ; \ else if (-HUGE_VAL <= (x) && (x) <= HUGE_VAL) ; \ else errno = ERANGE is setting errno to ERANGE purely due to an accident of the way gcc happens to compile code for comparing NaN to Inf and -Inf. > and 'ValueError: math domain error' in 2.0. Which is the correct exception, so is another reason for Python to avoid -lieee in 2.0. will-be-easier-to-make-it-work-right-by-design-than-to-keep-doping-out- what-happens-by-accident-now-ly y'rs - tim From tim_one@email.msn.com Thu Oct 12 07:16:23 2000 From: tim_one@email.msn.com (Tim Peters) Date: Thu, 12 Oct 2000 02:16:23 -0400 Subject: [Python-Dev] RE: [Numpy-discussion] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: Message-ID: [Huaiyu Zhu] > ... > $ /usr/bin/python > Python 1.5.2 (#1, Sep 17 1999, 20:15:36) [GCC egcs-2.91.66 19990314/Linux > (egcs- on linux-i386 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam > >>> from math import * > >>> exp(777) > inf > >>> exp(-777) > 0.0 > >>> sqrt(-1) > Traceback (innermost last): > File " ", line 1, in ? > OverflowError: math range error > > This was sane behavior. Are we saying that Python 2.0 has invented > something better than IEEE 754? 754 allows users to choose the behaviors they want. Any *fixed* policy is not 754. So long as we have to fix a single policy, yes, I believe Guido (& know I) would say that raising OverflowError on exp(777), and silently returning 0 on exp(-777), and raising ValueError on sqrt(-1) (*not* OverflowError, as shown above), is indeed better than the 754 default behaviors. And 2.0 will do all three of those (& I just checked in the code to make that happen). About the sqrt example above, that's neither 754 behavior nor sane behavior: default 754 behavior on sqrt(-1) is to return a NaN and keep on going. I'm pretty sure that's what glibc linked w/ -lieee actually does, too (if it doesn't, glibc -lieee is violating 754). That 1.5.2 raised an OverflowError instead is insane, and appears purely due to an accident of how gcc compiles code to compare Infs to NaNs (Python's mathmodule.c's CHECK() macro was fooled by this into setting errno to ERANGE itself). Python should raise a ValueError there instead (corresponding to libm setting errno to EDOM -- this is a domain error, not a range error) -- which it does now under CVS Python. 754-doesn't-work-unless-you've-got-all-of-it-ly y'rs - tim From thomas@xs4all.net Thu Oct 12 09:11:57 2000 From: thomas@xs4all.net (Thomas Wouters) Date: Thu, 12 Oct 2000 10:11:57 +0200 Subject: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: ; from tim_one@email.msn.com on Wed, Oct 11, 2000 at 10:44:20PM -0400 References: Message-ID: <20001012101157.Y12812@xs4all.nl> On Wed, Oct 11, 2000 at 10:44:20PM -0400, Tim Peters wrote: > > Likewise sqrt(-1.) needs to stop, not put a zero and keep going. > Nobody has proposed changing anything about libm domain (as opposed to > range) errors (although Huaiyu probably should if he's serious about his > flavor of 754 subsetism -- I have no idea what gcc+glibc+Linux did here on > 1.5.2, but it *should* have silently returned a NaN (not a zero) without > setting errno if it was *self*-consistent -- anyone care to check that > under -lieee?: > import math > math.sqrt(-1) >>> import math >>> math.sqrt(-1) Traceback (most recent call last): File " ", line 1, in ? OverflowError: math range error The same under both 1.5.2 and 2.0c1 with -lieee. Without -lieee, both do: >>> import math >>> math.sqrt(-1) Traceback (innermost last): File " ", line 1, in ? ValueError: math domain error Consistency-conschmistency-ly y'rs, -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From jeremy@beopen.com Thu Oct 12 16:58:10 2000 From: jeremy@beopen.com (Jeremy Hylton) Date: Thu, 12 Oct 2000 11:58:10 -0400 (EDT) Subject: [Python-Dev] (no subject) Message-ID: <14821.57234.444047.511672@bitdiddle.concentric.net> Cc xml-sig@python.org Subject: test_minidom non-failure failure? X-Mailer: VM 6.72 under 21.1 (patch 9) "Canyonlands" XEmacs Lucid Reply-To: jeremy@beopen.com Comments: Hyperbole mail buttons accepted, v04.18. SSBqdXN0IHJhbiAnbWFrZSB0ZXN0JyBhZ2FpbnN0IGEgY2xlYW4gY29weSBvZiB0aGUgQ1ZT IHRyZWUgYW5kIGdvdCBhbg0KZW5vcm1vdXMgYW1vdW50IG9mIGdhcmJhZ2Ugb3V0cHV0IGZy b20gdGVzdF9taW5pZG9tLCBhbHRob3VnaCBpdCB3YXMNCm5vdCByZXBvcnRlZCBhcyBhIHRl c3QgdGhlIGZhaWxlZCBvciB3YXMgc2tpcHBlZC4NCg0KVGhlIG91dHB1dCBmcm9tIHRlc3Rf bWluaWRvbSBzdGFydGVkIHRoaXMgd2F5Og0KDQp0ZXN0X21pbmlkb20NCmdhcmJhZ2U6IFt7 J25vZGVWYWx1ZSc6IHUnT2Jzb2xldGUgYnV0IGltcGxlbWVudGVkLi4uJywgJ25leHRTaWJs aW5nJzogPERPTSBUZXh0IG5vZGUgIlwwMTIiPiwgJ2NoaWxkTm9kZXMnOiBOb25lLCAnYXR0 cmlidXRlcyc6IE5vbmUsICdwYXJlbnROb2RlJzogTm9uZSwgJ2RhdGEnOiB1J09ic29sZXRl IGJ1dCBpbXBsZW1lbnRlZC4uLicsICdwcmV2aW91c1NpYmxpbmcnOiBOb25lfSwgPERPTSBU ZXh0IG5vZGUgIk9ic29sZXRlIGIuLi4iPiwgeydub2RlVmFsdWUnOiB1J1wwMTInLCAnbmV4 dFNpYmxpbmcnOiBOb25lLCAnY2hpbGROb2Rlcyc6IE5vbmUsICdhdHRyaWJ1dGVzJzogTm9u ZSwgJ3BhcmVudE5vZGUnOiBOb25lLCAnZGF0YSc6IHUnXDAxMicsICdwcmV2aW91c1NpYmxp bmcnOiA8RE9NIFRleHQgbm9kZSAiT2Jzb2xldGUgYi4uLiI+fSwgPERPTSBUZXh0IG5vZGUg IlwwMTIiPiwgeydub2RlVmFsdWUnOiB1J09ic29sZXRlIGJ1dCBpbXBsZW1lbnRlZC4uLics ICduZXh0U2libGluZyc6IDxET00gVGV4dCBub2RlICJcMDEyIj4sICdjaGlsZE5vZGVzJzog Tm9uZSwgJ2F0dHJpYnV0ZXMnOiBOb25lLCAncGFyZW50Tm9kZSc6IE5vbmUsICdkYXRhJzog dSdPYnNvbGV0ZSBidXQgaW1wbGVtZW50ZWQuLi4nLCAncHJldmlvdXNTaWJsaW5nJzogTm9u ZX0sIDxET00gVGV4dCBub2RlICJPYnNvbGV0ZSBiLi4uIj4sIHsnbm9kZVZhbHVlJzogdSdc MDEyJywgJ25leHRTaWJsaW5nJzogTm9uZSwgJ2NoaWxkTm9kZXMnOiBOb25lLCAnYXR0cmli dXRlcyc6IE5vbmUsICdwYXJlbnROb2RlJzogTm9uZSwgJ2RhdGEnOiB1J1wwMTInLCAncHJl dmlvdXNTaWJsaW5nJzogPERPTSBUZXh0IG5vZGUgIk9ic29sZXRlIGIuLi4iPn0sIDxET00g VGV4dCBub2RlICJcMDEyIj4sIHsnbm9kZVZhbHVlJzogdSdPYnNvbGV0ZSBidXQgaW1wbGVt ZW50ZWQuLi4nLCAnbmV4dFNpYmxpbmcnOiA8RE9NIFRleHQgbm9kZSAiXDAxMiI+LCAnY2hp bGROb2Rlcyc6IE5vbmUsICdhdHRyaWJ1dGVzJzogTm9uZSwgJ3BhcmVudE5vZGUnOiBOb25l LCAnZGF0YSc6IHUnT2Jzb2xldGUgYnV0IGltcGxlbWVudGVkLi4uJywgJ3ByZXZpb3VzU2li bGluZyc6IE5vbmV9LCA8RE9NIFRleHQgbm9kZSAiT2Jzb2xldGUgYi4uLiI+LCB7J25vZGVW YWx1ZSc6IHUnXDAxMicsICduZXh0U2libGluZyc6IE5vbmUsICdjaGlsZE5vZGVzJzogTm9u ZSwgJ2F0dHJpYnV0ZXMnOiBOb25lLCAncGFyZW50Tm9kZSc6IE5vbmUsICdkYXRhJzogdSdc MDEyJywgJ3ByZXZpb3VzU2libGluZyc6IDxET00gVGV4dCBub2RlICJPYnNvbGV0ZSBiLi4u Ij59LCA8RE9NIFRleHQgbm9kZSAiXDAxMiI+LCB7J25vZGVWYWx1ZSc6ICd0ZXh0JywgJ25l eHRTaWJsaW5nJzogPERPTSBFbGVtZW50OiBzdWJlbG0gYXQgMTM3ODYzMzg4PiwgJ2NoaWxk Tm9kZXMnOiBOb25lLCAnYXR0cmlidXRlcyc6IE5vbmUsICdwYXJlbnROb2RlJzogTm9uZSwg J2RhdGEnOiAndGV4dCcsICdwcmV2aW91c1NpYmxpbmcnOiBOb25lfSwgPERPTSBUZXh0IG5v ZGUgInRleHQiPiwgeydfYXR0cnMnOiB7fSwgJ3ByZXZpb3VzU2libGluZyc6IDxET00gVGV4 dCBub2RlICJ0ZXh0Ij4sICdjaGlsZE5vZGVzJzogTm9uZSwgJ2xvY2FsTmFtZSc6ICdzdWJl bG0nLCAndGFnTmFtZSc6ICdzdWJlbG0nLCAnX2F0dHJzTlMnOiB7fSwgJ3ByZWZpeCc6ICcn LCAnbmFtZXNwYWNlVVJJJzogJycsICdub2RlVmFsdWUnOiBOb25lLCAnbmV4dFNpYmxpbmcn OiA8RE9NIFRleHQgbm9kZSAidGV4dCI+LCAncGFyZW50Tm9kZSc6IE5vbmUsICdub2RlTmFt ZSc6ICdzdWJlbG0nfSwgPERPTSBFbGVtZW50OiBzdWJlbG0gYXQgMTM3ODYzMzg4Piwge30s IHt9LCB7J25vZGVWYWx1ZSc6ICd0ZXh0JywgJ25leHRTaWJsaW5nJzogTm9uZSwgJ2NoaWxk Tm9kZXMnOiBOb25lLCAnYXR0cmlidXRlcyc6IE5vbmUsICdwYXJlbnROb2RlJzogTm9uZSwg J2RhdGEnOiAndGV4dCcsICdwcmV2aW91c1NpYmxpbmcnOiA8RE9NIEVsZW1lbnQ6IHN1YmVs bSBhdCAxMzc4NjMzODg+fSwgPERPTSBUZXh0IG5vZGUgInRleHQiPiwgeydub2RlVmFsdWUn OiB1J09ic29sZXRlIGJ1dCANCg0KSXQgY29udGludWVkIG9uIGluIHRoZSBzYW1lIGZhc2hp b24gZm9yIGFib3V0IGEgdGhvdXNhbmQgbGluZXMuICBBZnRlcg0KcHJpbnRpbmcgYWxsIHRo aXMgZ2FyYmFnZSwgaXQgY29udGludWVkIG9uIHRvIHRlc3RfbW1hcC4NCg0KVGhlIGZpbmFs IHRlc3QgcmVwb3J0IHdhczoNCg0KOTUgdGVzdHMgT0suDQoxMyB0ZXN0cyBza2lwcGVkOiB0 ZXN0X2FsIHRlc3RfY2QgdGVzdF9jbCB0ZXN0X2RibSB0ZXN0X2RsIHRlc3RfZ2wNCnRlc3Rf aW1nZmlsZSB0ZXN0X2xhcmdlZmlsZSB0ZXN0X25pcyB0ZXN0X3N1bmF1ZGlvZGV2IHRlc3Rf dGltaW5nDQp0ZXN0X3dpbnJlZyB0ZXN0X3dpbnNvdW5kDQoNCkFueSBpZGVhcyBhYm91dCB3 aGF0IHdlbnQgd3Jvbmc/DQoNCkplcmVteQ== From jeremy@beopen.com Thu Oct 12 17:11:53 2000 From: jeremy@beopen.com (Jeremy Hylton) Date: Thu, 12 Oct 2000 12:11:53 -0400 (EDT) Subject: [Python-Dev] test_minidom non-failure failure? (take 2) Message-ID: <14821.58057.358947.271778@bitdiddle.concentric.net> Sorry about the previous message; a mail munger somewhere between my display and python.org choked on a very long line... I am getting an occasional, hard-to-reproduce error in test_minidom. When I run the test, it displays about a thousand lines of garbage, but the test suite does not report test_minidom as failed or skipped. The output I see during the test run is this: test_minidom garbage: [{'nodeValue': u'Obsolete but implemented...', 'nextSibling': , 'childNodes': None, 'attributes': None, 'parentNode': None, 'data': u'Obsolete but implemented...', 'previousSibling': None}, , {'nodeValue': u'\012', 'nextSibling': None, 'childNodes': None, 'a [... many hundreds of lines omitted] At the end of the test, I get a pretty normal result: 95 tests OK. 13 tests skipped: test_al test_cd test_cl test_dbm test_dl test_gl test_imgfile test_largefile test_nis test_sunaudiodev test_timing test_winreg test_winsound So two questions: Why is test_minidom producing all this output? And why is it only happening intermittently? Why does regrtest.py think that test_minidom is working correctly when it produces all this output? Jeremy From nas@arctrix.com Thu Oct 12 10:31:34 2000 From: nas@arctrix.com (Neil Schemenauer) Date: Thu, 12 Oct 2000 02:31:34 -0700 Subject: [Python-Dev] test_minidom non-failure failure? (take 2) In-Reply-To: <14821.58057.358947.271778@bitdiddle.concentric.net>; from jeremy@beopen.com on Thu, Oct 12, 2000 at 12:11:53PM -0400 References: <14821.58057.358947.271778@bitdiddle.concentric.net> Message-ID: <20001012023134.A18254@glacier.fnational.com> On Thu, Oct 12, 2000 at 12:11:53PM -0400, Jeremy Hylton wrote: > I am getting an occasional, hard-to-reproduce error in test_minidom. > When I run the test, it displays about a thousand lines of garbage, > but the test suite does not report test_minidom as failed or skipped. > > The output I see during the test run is this: > > test_minidom > garbage: [{'nodeValue': u'Obsolete but implemented...', 'nextSibling': This is most likely the garbage collector. regrtest.py contains the following code: if findleaks: gc.collect() if gc.garbage: print "garbage:", repr(gc.garbage) found_garbage.extend(gc.garbage) del gc.garbage[:] findleaks is true if the -l option is specified (TESTOPS in the makefile includes it). Something is producing cyclic garbage. Neil From guido@python.org Thu Oct 12 18:39:40 2000 From: guido@python.org (Guido van Rossum) Date: Thu, 12 Oct 2000 12:39:40 -0500 Subject: [Python-Dev] test_minidom non-failure failure? (take 2) In-Reply-To: Your message of "Thu, 12 Oct 2000 02:31:34 MST." <20001012023134.A18254@glacier.fnational.com> References: <14821.58057.358947.271778@bitdiddle.concentric.net> <20001012023134.A18254@glacier.fnational.com> Message-ID: <200010121739.MAA07968@cj20424-a.reston1.va.home.com> > On Thu, Oct 12, 2000 at 12:11:53PM -0400, Jeremy Hylton wrote: > > I am getting an occasional, hard-to-reproduce error in test_minidom. > > When I run the test, it displays about a thousand lines of garbage, > > but the test suite does not report test_minidom as failed or skipped. > > > > The output I see during the test run is this: > > > > test_minidom > > garbage: [{'nodeValue': u'Obsolete but implemented...', 'nextSibling': [Neil] > This is most likely the garbage collector. regrtest.py contains > the following code: > > if findleaks: > gc.collect() > if gc.garbage: > print "garbage:", repr(gc.garbage) > found_garbage.extend(gc.garbage) > del gc.garbage[:] > > findleaks is true if the -l option is specified (TESTOPS in the > makefile includes it). Something is producing cyclic garbage. Of course something is producing cyclic garbage! The DOM tree is full of parent and child links. Does this output mean that the GC works correctly? Or does it mean that there is a reason why this garbage cannot be disposed of? In the latter case, could that be because there are __del__ methods? --Guido van Rossum (home page: http://www.python.org/~guido/) From fdrake@beopen.com Thu Oct 12 17:55:19 2000 From: fdrake@beopen.com (Fred L. Drake, Jr.) Date: Thu, 12 Oct 2000 12:55:19 -0400 (EDT) Subject: [Python-Dev] test_minidom non-failure failure? (take 2) In-Reply-To: <20001012023134.A18254@glacier.fnational.com> References: <14821.58057.358947.271778@bitdiddle.concentric.net> <20001012023134.A18254@glacier.fnational.com> Message-ID: <14821.60663.213246.179325@cj42289-a.reston1.va.home.com> Neil Schemenauer writes: > This is most likely the garbage collector. regrtest.py contains > the following code: ... > findleaks is true if the -l option is specified (TESTOPS in the > makefile includes it). Something is producing cyclic garbage. This is definately the problem. Lars, Paul: This looks like a problem in the unlink() method of the DOM. Could you please check that the unlink() method is updated to handle the latest version of the other changes? Thanks! -Fred -- Fred L. Drake, Jr. BeOpen PythonLabs Team Member From fdrake@beopen.com Thu Oct 12 17:59:33 2000 From: fdrake@beopen.com (Fred L. Drake, Jr.) Date: Thu, 12 Oct 2000 12:59:33 -0400 (EDT) Subject: [Python-Dev] test_minidom non-failure failure? (take 2) In-Reply-To: <14821.58057.358947.271778@bitdiddle.concentric.net> References: <14821.58057.358947.271778@bitdiddle.concentric.net> Message-ID: <14821.60917.429141.652655@cj42289-a.reston1.va.home.com> Jeremy Hylton writes: > Why is test_minidom producing all this output? And why is it only > happening intermittently? It isn't. See Neil's excellent explanation. > Why does regrtest.py think that test_minidom is working correctly when > it produces all this output? The test is passing just fine, and is complete before the test for garbage is performed. The unlink() method on DOM objects is the culprit; it is updating the Node.allnodes dictionary correctly, but not the Node instances. I've already asked Paul & Lars to fix this; it should work just fine with or without GC once they've seen the report. -Fred -- Fred L. Drake, Jr. BeOpen PythonLabs Team Member From nas@arctrix.com Thu Oct 12 11:24:48 2000 From: nas@arctrix.com (Neil Schemenauer) Date: Thu, 12 Oct 2000 03:24:48 -0700 Subject: [Python-Dev] test_minidom non-failure failure? (take 2) In-Reply-To: <200010121739.MAA07968@cj20424-a.reston1.va.home.com>; from guido@python.org on Thu, Oct 12, 2000 at 12:39:40PM -0500 References: <14821.58057.358947.271778@bitdiddle.concentric.net> <20001012023134.A18254@glacier.fnational.com> <200010121739.MAA07968@cj20424-a.reston1.va.home.com> Message-ID: <20001012032448.A18407@glacier.fnational.com> On Thu, Oct 12, 2000 at 12:39:40PM -0500, Guido van Rossum wrote: > Of course something is producing cyclic garbage! > > The DOM tree is full of parent and child links. > > Does this output mean that the GC works correctly? Or does it > mean that there is a reason why this garbage cannot be disposed > of? In the latter case, could that be because there are > __del__ methods? The -l option tries to find any cyclic garbage produced by the tests. I don't think that that option should be enabled default. The output means that the GC is working and is finding stuff that would not be freed by reference counting alone. I can't tell if the GC would free this garbage. The -l option sets the DEBUG_SAVEALL option which causes all garbage found to end up in gc.garbage, not just garbage the can't be cleaned up. I don't have pyexpat installed here so I can't test it. If you want to find out if test_minidom is creating garbage the collector can't free you should comment out the: gc.set_debug(gc.DEBUG_SAVEALL) line in regrtest.py and run: regrtest.py -l test_minidom If that does what I think it does and you still get the "garbage: " line then the test is creating evil things. :) Neil From hinsen@dirac.cnrs-orleans.fr Thu Oct 12 18:24:18 2000 From: hinsen@dirac.cnrs-orleans.fr (hinsen@dirac.cnrs-orleans.fr) Date: Thu, 12 Oct 2000 19:24:18 +0200 Subject: [Python-Dev] RE: [Numpy-discussion] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: (sdm7g@virginia.edu) References: Message-ID: <200010121724.TAA15487@chinon.cnrs-orleans.fr> > The idea that your calculation should blow up and you should > check it and resubmit your job sounds just so ancient-20th-century- > Fortran-JCL-and-punched-cards-technology! Long-running jobs are still with us, even there's neither Fortran nor JCL in them. And for these applications, stopping is better than going on with nonsense values. On the other hand, as you point out, exceptions for math errors are a bit of a pain for interactive work. So how about making this a run-time option? I'd choose exceptions by default and Infs and Nans by specifying a command-line option, but there are certainly others who would prefer it the other way round. What matters most to me is that the choice is possible somehow. Konrad. -- ------------------------------------------------------------------------------- Konrad Hinsen | E-Mail: hinsen@cnrs-orleans.fr Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24 Rue Charles Sadron | Fax: +33-2.38.63.15.17 45071 Orleans Cedex 2 | Deutsch/Esperanto/English/ France | Nederlands/Francais ------------------------------------------------------------------------------- From sdm7g@virginia.edu Thu Oct 12 19:25:44 2000 From: sdm7g@virginia.edu (Steven D. Majewski) Date: Thu, 12 Oct 2000 14:25:44 -0400 (EDT) Subject: [Python-Dev] RE: [Numpy-discussion] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: <200010121724.TAA15487@chinon.cnrs-orleans.fr> Message-ID: On Thu, 12 Oct 2000 hinsen@dirac.cnrs-orleans.fr wrote: > > The idea that your calculation should blow up and you should > > check it and resubmit your job sounds just so ancient-20th-century- > > Fortran-JCL-and-punched-cards-technology! > > Long-running jobs are still with us, even there's neither Fortran nor > JCL in them. And for these applications, stopping is better than going > on with nonsense values. On the other hand, as you point out, exceptions > for math errors are a bit of a pain for interactive work. > > So how about making this a run-time option? I'd choose exceptions by > default and Infs and Nans by specifying a command-line option, but > there are certainly others who would prefer it the other way round. > What matters most to me is that the choice is possible somehow. > I agree entirely! Maybe I was being a bit too glib, but I didn't mean to imply that wanting it to halt or throw an exception on errors is wrongheaded. I just wanted to make sure the counter-case to what Paul was saying also got heard: Yes-- underflows or infinities where they aren't expected are usually a sign that something is very wrong somewhere. But in the case where the vector holds independent observations or data points, then usually what it means is that there's something wrong with *that* data point -- miscallibrated or mislabeled -- but no reason not to complete the calculations for all of the other points. Scaling or doing projections for interactive graphics is another case where bad points are often better than throwing an exception. ( And it's a pain to have to remember to lambda wrap all the function calls with some sort of guard when you'ld be happy to get NaNs. ) I also mostly agree with Tim, except that I'm not sure that bad or incomplete ieee support is always better than none at all. ---| Steven D. Majewski (804-982-0831) |--- ---| Department of Molecular Physiology and Biological Physics |--- ---| University of Virginia Health Sciences Center |--- ---| P.O. Box 10011 Charlottesville, VA 22906-0011 |--- "All operating systems want to be unix, All programming languages want to be lisp." From thomas@xs4all.net Thu Oct 12 20:14:37 2000 From: thomas@xs4all.net (Thomas Wouters) Date: Thu, 12 Oct 2000 21:14:37 +0200 Subject: [Python-Dev] Re: getopt() prototype [was: checkin-message of something or other] In-Reply-To: <200010121711.KAA00584@slayer.i.sourceforge.net>; from fdrake@users.sourceforge.net on Thu, Oct 12, 2000 at 10:11:41AM -0700 References: <200010121711.KAA00584@slayer.i.sourceforge.net> Message-ID: <20001012211436.Z12812@xs4all.nl> On Thu, Oct 12, 2000 at 10:11:41AM -0700, Fred L. Drake wrote: [ use -Wall and -Wstrict-prototypes by default, if the compiler is gcc ] > There is one known warning at this time, caught by the -Wstrict-prototypes > option. In Modules/main.c, the declaration of getopt() without parameters > gets a complaint (rightly) that it is not a proper prototype. The lack of > a complete prototype information should be corrected when the right > portability conditions have been identified. I already looked at this before, and the problem is that the prototype for getopt is not portable (because of quirks in the ANSI C standard regarding 'compatible' pointer types.) Some systems define it as 'const char **' (or 'char const **'), some perhaps as 'char **', and some as 'char * const *'. 'const char **' and 'char const **' are the same, but 'char * const *' is something else, and so is 'char **'. 'char * const *' and 'char **' are equivalent types, meaning that conforming compilers should be able to intermix them without problems, but 'const char **' is a different type, and ANSI C either demands or strongly suggests a warning. (Why exactly it's a different type is mostly a choice of language, though I'm sure there are people who would defend the choice. What it means it that you can't mix two layers of indirection with qualifiers like 'const' or 'volatile', without paying close attention to assignment and prototypes :P) As a result, no matter what prototype we think up, we're always screwing either the one type of platform or the other. And not with a warning; the conflicting prototype would generate an error, nto a warning. The only solution I can think of is adding the proper prototype to the pyport.h header file, inside a proper #ifdef. For generated code it doesn't really matter which of the prototypes is used, but if the system headers do provide a prototype, and it doesn't match in indirect-constness, compilation will fail. (In other words, even on the platforms that are missing it, close attention should be paid to the manual pages, trying to guess what the prototype is going to look like if that particular system would ever grow a prototype in a system header. From what I read in the getopt(3) manpage on my linux box the prototype mixup comes from a POSIX.2 flaw, but I'm not sure.) Does anyone have a system where the prototype to getopt() is not defined in header files ? My Solaris 2.x testbox has that problem, but the box in question is one huge mess, and I doubt it has anything to do with Solaris in particular. I only use it to reproduce reported bugs, not report any myself ;P -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From jeremy@beopen.com Thu Oct 12 21:10:50 2000 From: jeremy@beopen.com (Jeremy Hylton) Date: Thu, 12 Oct 2000 16:10:50 -0400 (EDT) Subject: [Python-Dev] test_minidom non-failure failure? (take 2) In-Reply-To: <20001012032448.A18407@glacier.fnational.com> References: <14821.58057.358947.271778@bitdiddle.concentric.net> <20001012023134.A18254@glacier.fnational.com> <200010121739.MAA07968@cj20424-a.reston1.va.home.com> <20001012032448.A18407@glacier.fnational.com> Message-ID: <14822.6858.920988.167252@bitdiddle.concentric.net> >>>>> "NS" == Neil Schemenauer writes: NS> The -l option tries to find any cyclic garbage produced by the NS> tests. I don't think that that option should be enabled NS> default. The output means that the GC is working and is finding NS> stuff that would not be freed by reference counting alone. NS> I can't tell if the GC would free this garbage. The -l option NS> sets the DEBUG_SAVEALL option which causes all garbage found to NS> end up in gc.garbage, not just garbage the can't be cleaned up. NS> I don't have pyexpat installed here so I can't test it. If you NS> want to find out if test_minidom is creating garbage the NS> collector can't free you should comment out the: NS> gc.set_debug(gc.DEBUG_SAVEALL) NS> line in regrtest.py and run: NS> regrtest.py -l test_minidom NS> If that does what I think it does and you still get the NS> "garbage: " line then the test is creating evil things. :) The test is not creating evil things. I commented out the DEBUG_SAVEALL line and got no error report. The question, then, is what to do about the -l option. I assume we should remove the -l option from the Makefile, so that "make test" doesn't turn on DEBUG_SAVEALL. Or do we need to change regrtest in some way so that it still reports on tests that create evil things? Jeremy From nas@arctrix.com Thu Oct 12 14:20:10 2000 From: nas@arctrix.com (Neil Schemenauer) Date: Thu, 12 Oct 2000 06:20:10 -0700 Subject: [Python-Dev] test_minidom non-failure failure? (take 2) In-Reply-To: <14822.6858.920988.167252@bitdiddle.concentric.net>; from jeremy@beopen.com on Thu, Oct 12, 2000 at 04:10:50PM -0400 References: <14821.58057.358947.271778@bitdiddle.concentric.net> <20001012023134.A18254@glacier.fnational.com> <200010121739.MAA07968@cj20424-a.reston1.va.home.com> <20001012032448.A18407@glacier.fnational.com> <14822.6858.920988.167252@bitdiddle.concentric.net> Message-ID: <20001012062010.A19026@glacier.fnational.com> On Thu, Oct 12, 2000 at 04:10:50PM -0400, Jeremy Hylton wrote: > The question, then, is what to do about the -l option. I assume we > should remove the -l option from the Makefile, so that "make test" > doesn't turn on DEBUG_SAVEALL. Or do we need to change regrtest in > some way so that it still reports on tests that create evil things? This is a policy decision. Is it okay for the test suite to create garbage that is not collectable by reference counting? If yes, what about garbage that is not collectable by the (current) GC? Neil From guido@python.org Thu Oct 12 22:21:39 2000 From: guido@python.org (Guido van Rossum) Date: Thu, 12 Oct 2000 16:21:39 -0500 Subject: [Python-Dev] test_minidom non-failure failure? (take 2) In-Reply-To: Your message of "Thu, 12 Oct 2000 16:10:50 -0400." <14822.6858.920988.167252@bitdiddle.concentric.net> References: <14821.58057.358947.271778@bitdiddle.concentric.net> <20001012023134.A18254@glacier.fnational.com> <200010121739.MAA07968@cj20424-a.reston1.va.home.com> <20001012032448.A18407@glacier.fnational.com> <14822.6858.920988.167252@bitdiddle.concentric.net> Message-ID: <200010122121.QAA09024@cj20424-a.reston1.va.home.com> > The question, then, is what to do about the -l option. I assume we > should remove the -l option from the Makefile, so that "make test" > doesn't turn on DEBUG_SAVEALL. This seems to make sense, yes. Since the "leaked" objects that are found will be released by the GC code, I see no point in reporting these during the regression test. This can only confuse people (like it did Jeremy :-). > Or do we need to change regrtest in > some way so that it still reports on tests that create evil things? Any form of evilness that can be detected without *too* much effort is worth it... I have no idea what kind of evil we're looking for here or how to detect is, so I can't answer yes or no. --Guido van Rossum (home page: http://www.python.org/~guido/) From fdrake@beopen.com Thu Oct 12 21:18:15 2000 From: fdrake@beopen.com (Fred L. Drake, Jr.) Date: Thu, 12 Oct 2000 16:18:15 -0400 (EDT) Subject: [Python-Dev] New development documentation up... Message-ID: <14822.7303.953870.727070@cj42289-a.reston1.va.home.com> I don't normally post when I've updated the development copy of the documentation, but there are a couple of big additions there now. Martin von L=F6wis contributed substantial SAX2 documentation, which I've now integrated. Thanks, Martin! Chris Barker is working on new documentation for the Macintosh manual; I've only just started to look at it, but there's definately a *lot* of new material. That's not checked into CVS yet, but will be once I've had more time to go over it. Thanks, Chris! =09ftp://python.beopen.com/pub/docco/devel/index.html -Fred --=20 Fred L. Drake, Jr. BeOpen PythonLabs Team Member From nas@arctrix.com Thu Oct 12 14:28:04 2000 From: nas@arctrix.com (Neil Schemenauer) Date: Thu, 12 Oct 2000 06:28:04 -0700 Subject: [Python-Dev] test_minidom non-failure failure? (take 2) In-Reply-To: <200010122121.QAA09024@cj20424-a.reston1.va.home.com>; from guido@python.org on Thu, Oct 12, 2000 at 04:21:39PM -0500 References: <14821.58057.358947.271778@bitdiddle.concentric.net> <20001012023134.A18254@glacier.fnational.com> <200010121739.MAA07968@cj20424-a.reston1.va.home.com> <20001012032448.A18407@glacier.fnational.com> <14822.6858.920988.167252@bitdiddle.concentric.net> <200010122121.QAA09024@cj20424-a.reston1.va.home.com> Message-ID: <20001012062804.B19026@glacier.fnational.com> On Thu, Oct 12, 2000 at 04:21:39PM -0500, Guido van Rossum wrote: > Any form of evilness that can be detected without *too* much effort is > worth it... I have no idea what kind of evil we're looking for here > or how to detect is, so I can't answer yes or no. That would be reference cycles with finalizers (ie. instances with __del__ methods). The current garbage collector does not free such structures but instead appends them to gc.garbage. Sorry for not being clear. In any case, regrtest should probably print a more clueful message when objects are found in gc.garbage. That would go a long way in clearing up the confusion. I'll see about a patch. Neil From guido@python.org Thu Oct 12 22:26:49 2000 From: guido@python.org (Guido van Rossum) Date: Thu, 12 Oct 2000 16:26:49 -0500 Subject: [Python-Dev] test_minidom non-failure failure? (take 2) In-Reply-To: Your message of "Thu, 12 Oct 2000 06:20:10 MST." <20001012062010.A19026@glacier.fnational.com> References: <14821.58057.358947.271778@bitdiddle.concentric.net> <20001012023134.A18254@glacier.fnational.com> <200010121739.MAA07968@cj20424-a.reston1.va.home.com> <20001012032448.A18407@glacier.fnational.com> <14822.6858.920988.167252@bitdiddle.concentric.net> <20001012062010.A19026@glacier.fnational.com> Message-ID: <200010122126.QAA09072@cj20424-a.reston1.va.home.com> > This is a policy decision. Is it okay for the test suite to > create garbage that is not collectable by reference counting? I don't see why that should be forbidden. After all some of the code we test has such leaks -- we haven't declared those absolute bugs. > If yes, what about garbage that is not collectable by the (current) > GC? Can you give an example of how such garbage can be created? --Guido van Rossum (home page: http://www.python.org/~guido/) From jeremy@beopen.com Thu Oct 12 21:38:29 2000 From: jeremy@beopen.com (Jeremy Hylton) Date: Thu, 12 Oct 2000 16:38:29 -0400 (EDT) Subject: [Python-Dev] test_minidom non-failure failure? (take 2) In-Reply-To: <20001012062804.B19026@glacier.fnational.com> References: <14821.58057.358947.271778@bitdiddle.concentric.net> <20001012023134.A18254@glacier.fnational.com> <200010121739.MAA07968@cj20424-a.reston1.va.home.com> <20001012032448.A18407@glacier.fnational.com> <14822.6858.920988.167252@bitdiddle.concentric.net> <200010122121.QAA09024@cj20424-a.reston1.va.home.com> <20001012062804.B19026@glacier.fnational.com> Message-ID: <14822.8517.675600.578272@bitdiddle.concentric.net> >>>>> "NS" == Neil Schemenauer writes: NS> In any case, regrtest should probably print a more clueful NS> message when objects are found in gc.garbage. That would go a NS> long way in clearing up the confusion. I'll see about a patch. I think there is some value to issueing reports when a test creates trash that can't be cleaned up by the GC, but it doesn't make sense to report this by default. If "make test" reports an error, it should mean that something has gone wrong with the user's build and the interpreter is broken. That's not the case here. The build was fine; it's just the test that is iffy. I think we should turn of the -l option by default *and* patch it so that the output is more useful. I would suggest printing a count of the objects, perhaps organized by type/class name. Something like this: Test created 6 uncollectable objects 4 foo.Bar instances 2 foo.Baz instances Jeremy From tim_one@email.msn.com Thu Oct 12 21:33:41 2000 From: tim_one@email.msn.com (Tim Peters) Date: Thu, 12 Oct 2000 16:33:41 -0400 Subject: [Python-Dev] RE: [Numpy-discussion] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: Message-ID: [Steven D. Majewski] > ... > I also mostly agree with Tim, except that I'm not sure that bad or > incomplete ieee support is always better than none at all. This is true, because having Python is better than not having Python, and in having Python you indeed have bad *and* incomplete 754 support on every 754 platform it runs on. Even better, it's a subset of damaged 754 support unique to each platform whose details can't be guessed or documented in advance of trying it exhaustively to see what happens(*), and a subset that can change delightfully across releases, compiler upgrades, library upgrades and seemingly irrelevant minor config changes. So if bad or incomplete IEEE support is good, Python is-- here as elsewhere --the King of Languages . Every step of this dance is thoroughly predictable. In this case, I'm doing my darnedest to nudge Python its very first step towards *real* 754 support, and getting dumped on for it by a 754 fan. Simultaneously, the "old guard" defends their lifestyle against new-fangled ideas , asking for protections unaware that 754 *requires* they get a better form of the protections they seek than they've dreamed of so far. It appears that nobody on either side has actually read the std, and I've become the very 754 Storm Trooper I used to despise. Computer life is great . all-it's-missing-is-variety-ly y'rs - tim (*) Quiz: *if* you can manage to trick Python into creating a NaN on your particular 754 platform, does the Python expression NaN == 1.0 return true, false, or raise an exception? Answer before you try it. Then try it on enough 754 platforms until you give up trying to guess in advance. NaN == NaN is predictable in Python, and is the one 754 feature Python guarantees won't work correctly on any 754 platform (although I've heard that it loses this predictability when run using NumPy's flavor of comparisons instead of core Python's). From nas@arctrix.com Thu Oct 12 14:43:09 2000 From: nas@arctrix.com (Neil Schemenauer) Date: Thu, 12 Oct 2000 06:43:09 -0700 Subject: [Python-Dev] test_minidom non-failure failure? (take 2) In-Reply-To: <200010122126.QAA09072@cj20424-a.reston1.va.home.com>; from guido@python.org on Thu, Oct 12, 2000 at 04:26:49PM -0500 References: <14821.58057.358947.271778@bitdiddle.concentric.net> <20001012023134.A18254@glacier.fnational.com> <200010121739.MAA07968@cj20424-a.reston1.va.home.com> <20001012032448.A18407@glacier.fnational.com> <14822.6858.920988.167252@bitdiddle.concentric.net> <20001012062010.A19026@glacier.fnational.com> <200010122126.QAA09072@cj20424-a.reston1.va.home.com> Message-ID: <20001012064309.C19026@glacier.fnational.com> On Thu, Oct 12, 2000 at 04:26:49PM -0500, Guido van Rossum wrote: > > This is a policy decision. Is it okay for the test suite to > > create garbage that is not collectable by reference counting? > > I don't see why that should be forbidden. After all some of the code > we test has such leaks -- we haven't declared those absolute bugs. Again, "-l" should probably not be a default. I don't know who added it to TESTOPTS but it wasn't me. > Can you give an example of how such garbage can be created? Look at test_gc. Here is an example: class Foo: def __del__(self): pass foo = Foo() foo.foo = foo del foo Theoretically this structure could be collected without problem but the GC is too simple minded to realize that there is only one finalizer involved. Here's a better example: foo = Foo() bar = Foo() foo.bar = bar bar.foo = foo del foo, bar The GC cannot safely break this cycle so it punts and adds the instance objects involved to gc.garbage and forgets about it. Neil From tim_one@email.msn.com Thu Oct 12 22:38:13 2000 From: tim_one@email.msn.com (Tim Peters) Date: Thu, 12 Oct 2000 17:38:13 -0400 Subject: [Python-Dev] Re: getopt() prototype [was: checkin-message of something or other] In-Reply-To: <20001012211436.Z12812@xs4all.nl> Message-ID: [Thomas Wouters, on getopt] > ... > From what I read in the getopt(3) manpage on my linux box the > prototype mixup comes from a POSIX.2 flaw, but I'm not sure.) I bet it's actually talking about Interpretation 150 to POSIX.2, here (while you can't read the std online, you can read the complaints online!): http://standards.ieee.org/reading/ieee/interp/1003-2-92_int/pasc-1003.2-150. html Doesn't have anything to do with the prototype, alas. > Does anyone have a system where the prototype to getopt() is not > defined in header files ? My Solaris 2.x testbox has that problem, but > the box in question is one huge mess, and I doubt it has anything to do > with Solaris in particular. ... Sure: Windows doesn't have a getopt; getopt isn't std C (not even in C99). Assorted derived stds demand that a getopt protoptype appear in stdlib.h, and others that it appear in unistd.h. I have a different suggestion: screw it. getopt keeps creating problems on GNUish systems too, because without the POSIXLY_CORRECT envar set, the GNU getopt shuffles all the "option strings" to the front, making a mess of, e.g., python myprog.py -v The Python source tree already has its own getopt implementation (Python/getopt.c) -- let's rename its contained function to PyOS_Getopt, get rid of the irritating __BEOS__ #ifdef'ery therein, prototype it the way we like, and have Python use that instead on all systems. Every second we've spent tracking down problems with platform-supplied getopts has been a waste of time. they've-had-21-years-to-straighten-out-"the-std"-getopt-and-they-blew-it- ly y'rs - tim From jack@oratrix.nl Thu Oct 12 23:03:57 2000 From: jack@oratrix.nl (Jack Jansen) Date: Fri, 13 Oct 2000 00:03:57 +0200 Subject: [Python-Dev] MacPython 2.0c1 available Message-ID: <20001012220402.ABE8D104729@oratrix.oratrix.nl> MacPython 2.0c1 is available, both as binary installer and in source form. You can find it through http://www.cwi.nl/~jac/macpython.html. If people give it a testdrive please let me know whether it works, and, in the unlikely event it doesn't:-) what the problems are. Thanks, -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | ++++ see http://www.xs4all.nl/~tank/ ++++ From guido@python.org Fri Oct 13 00:07:28 2000 From: guido@python.org (Guido van Rossum) Date: Thu, 12 Oct 2000 18:07:28 -0500 Subject: [Python-Dev] Re: getopt() prototype [was: checkin-message of something or other] In-Reply-To: Your message of "Thu, 12 Oct 2000 17:38:13 -0400." References: Message-ID: <200010122307.SAA09493@cj20424-a.reston1.va.home.com> > I have a different suggestion: screw it. getopt keeps creating problems on > GNUish systems too, because without the POSIXLY_CORRECT envar set, the GNU > getopt shuffles all the "option strings" to the front, making a mess of, > e.g., > > python myprog.py -v > > The Python source tree already has its own getopt implementation > (Python/getopt.c) -- let's rename its contained function to PyOS_Getopt, get > rid of the irritating __BEOS__ #ifdef'ery therein, prototype it the way we > like, and have Python use that instead on all systems. Every second we've > spent tracking down problems with platform-supplied getopts has been a waste > of time. Excellent. After 2.0. --Guido van Rossum (home page: http://www.python.org/~guido/) From thomas@xs4all.net Thu Oct 12 23:18:01 2000 From: thomas@xs4all.net (Thomas Wouters) Date: Fri, 13 Oct 2000 00:18:01 +0200 Subject: [Python-Dev] Re: getopt() prototype [was: checkin-message of something or other] In-Reply-To: ; from tim_one@email.msn.com on Thu, Oct 12, 2000 at 05:38:13PM -0400 References: <20001012211436.Z12812@xs4all.nl> Message-ID: <20001013001801.A12812@xs4all.nl> On Thu, Oct 12, 2000 at 05:38:13PM -0400, Tim Peters wrote: > [Thomas Wouters, on getopt] > > ... > > From what I read in the getopt(3) manpage on my linux box the > > prototype mixup comes from a POSIX.2 flaw, but I'm not sure.) > > I bet it's actually talking about Interpretation 150 to POSIX.2, here (while > you can't read the std online, you can read the complaints online!): > http://standards.ieee.org/reading/ieee/interp/1003-2-92_int/pasc-1003.2-150. > html > Doesn't have anything to do with the prototype, alas. Ah, that sounds about right. Nifty link, too. I thought it had something to do with the prototype because of this comment: CONFORMING TO getopt(): POSIX.2, provided the environment variable POSIXLY_CORRECT is set. Otherwise, the elements of argv aren't really const, because we permute them. We pretend they're const in the prototype to be compatible with other systems. > I have a different suggestion: screw it. getopt keeps creating problems on > GNUish systems too, because without the POSIXLY_CORRECT envar set, the GNU > getopt shuffles all the "option strings" to the front, making a mess of [ a lot of things ] Ahh, yes, I see Python/getopt.c and the autoconf check that enables it when necessary. Funny, I've seen that file a number of times, and read it, and read the getopt autoconf test as well, but somehow I never connected it with the loose prototype in main.c. I'm +1 on doing what you suggested, then. Wonder why it hasn't been done yet, though... we have no use for a system-wide getopt, except for a slightly smaller binary on systems that do have a 'good' system getopt. We can't use enhancements made to system getopt or anything, anyway. > they've-had-21-years-to-straighten-out-"the-std"-getopt-and-they-blew-it- > ly y'rs - tim what-do-you-want-to-bet-it's-going-to-take-longer-for-Python-getopt-modules- ly y'rs, -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From m.favas@per.dem.csiro.au Fri Oct 13 01:47:25 2000 From: m.favas@per.dem.csiro.au (Mark Favas) Date: Fri, 13 Oct 2000 08:47:25 +0800 Subject: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) Message-ID: <39E65B9D.B9F6BA70@per.dem.csiro.au> Just a little unreality check - the whole world is not (yet) Linux - or even MS. The behaviour of math.exp(-746) on my flavours of 1.5.2 on Solaris boxes and DEC Alphas (Tru64 Unix) is the same as the behaviour of 2.0 - OverflowError: math range error. Thus, on these platform, the proposed fixes _will_ change behaviour. But that's cool - I like Tim's proposed, um, steps to "rationalizing" fp behaviour, and will do what I can to help in the future. -- Email - m.favas@per.dem.csiro.au CSIRO Exploration & Mining From tim_one@email.msn.com Fri Oct 13 06:15:13 2000 From: tim_one@email.msn.com (Tim Peters) Date: Fri, 13 Oct 2000 01:15:13 -0400 Subject: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: <39E65B9D.B9F6BA70@per.dem.csiro.au> Message-ID: [Mark Favas] > Just a little unreality check - the whole world is not (yet) Linux - or > even MS. The behaviour of math.exp(-746) on my flavours of 1.5.2 on > Solaris boxes and DEC Alphas (Tru64 Unix) is the same as the behaviour > of 2.0 - OverflowError: math range error. This is unfortunate. Guido never intended for Python to raise exceptions on underflow (and especially not *Over*flowError(!)), but he apparently didn't run on any platforms where this happened (I never have!), and AFAIK nobody ever mentioned this before. > Thus, on these platform, the proposed fixes _will_ change behaviour. See "unfortunate" above <0.5 wink>. > But that's cool - I like Tim's proposed, um, steps to "rationalizing" > fp behaviour, and will do what I can to help in the future. Want to fund a crack group of 754 experts for a year? Didn't think so. Constructive complaints will help a lot. So will beta testing. For example, I'm very keen to know whether the current CVS version of Python (2.0c1) still raises OverflowError for math.exp(-746) on your Solaris and/or Tru64 Unix boxes. Running the (current CVS) std test suite will tell you: test_libm will pass or fail accordingly. If it's still busted on one of your systems, we've only got about a day to fix it (2.0 final is shipping early next week, and we have to let the codebase settle down for a couple days before building the final release). but-since-it's-been-a-random-mess-for-a-decade-already-i'm-not- losing-much-sleep-over-it-ly y'rs - tim From tim_one@email.msn.com Fri Oct 13 06:18:52 2000 From: tim_one@email.msn.com (Tim Peters) Date: Fri, 13 Oct 2000 01:18:52 -0400 Subject: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: Message-ID: [Tim hallucinated ...] > ... I'm very keen to know whether the current CVS version of Python > (2.0c1) still raises OverflowError for math.exp(-746) on your > Solaris and/or Tru64 Unix boxes. Sorry for contradicting myself within a single sentence: I couldn't care less what happens in 2.0c1 anymore. Like I clearly said at the start, "current CVS version" is the question. From bwarsaw@beopen.com Fri Oct 13 06:33:57 2000 From: bwarsaw@beopen.com (Barry A. Warsaw) Date: Fri, 13 Oct 2000 01:33:57 -0400 (EDT) Subject: [Python-Dev] test_minidom non-failure failure? (take 2) References: <14821.58057.358947.271778@bitdiddle.concentric.net> <20001012023134.A18254@glacier.fnational.com> <200010121739.MAA07968@cj20424-a.reston1.va.home.com> <20001012032448.A18407@glacier.fnational.com> <14822.6858.920988.167252@bitdiddle.concentric.net> <20001012062010.A19026@glacier.fnational.com> <200010122126.QAA09072@cj20424-a.reston1.va.home.com> <20001012064309.C19026@glacier.fnational.com> Message-ID: <14822.40645.656159.493390@anthem.concentric.net> >>>>> "NS" == Neil Schemenauer writes: NS> Again, "-l" should probably not be a default. I don't know NS> who added it to TESTOPTS but it wasn't me. I did, but at the time -l set LEAK_DEBUG not DEBUG_SAVEALL, and I think (but don't really remember) that LEAK_DEBUG had different semantics than it does now. No matter. This was useful when gc was spankin' new and only semi-tested. It's probably fine to turn off -l in "make test" by default for the 2.0 release. -Barry From tim_one@email.msn.com Fri Oct 13 09:01:16 2000 From: tim_one@email.msn.com (Tim Peters) Date: Fri, 13 Oct 2000 04:01:16 -0400 Subject: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: Message-ID: [Tim] > ... > We cannot consider this to be a bug since Python has had no *intended* > behavior whatsoever wrt 754 gimmicks. We can and do consider gripes > about these accidents to be feature requests. [Huaiyu Zhu] > Yes it varies widely in Python. But isn't that precisely because Python > does not support IEEE? Yes, but that's darned near tautological <0.5 wink>. > If Python does not actively undermine IEEE on platforms that have it, > would it still vary widely across these platforms? Yes. Your own -lieee example showed that math.sqrt(-1) computes not only a non-754 result, but a senseless result, on your platform under 1.5.2. If I show you a platform, how are you going to decide whether it "has" IEEE? 754 is a very involved std, and it's still rare to find a platform C that supports it correctly. On platform C's that do support it correctly, I know of none that do so without requiring platform-specific tricks. Python has *nothing* portable it can rely on, and its mass of utterly non-754-aware code building on haphazard C implementations adds up to the random x-platform crap we have today. ... [T] > The patch to stop setting -lieee was contributed by a Python user who > claimed it fixed bugs on *their* platform. That's "the reason". > We don't want to screw them either. [H] > Q: What bug? Which platform? Maybe there is another way that has less > impact on others? How to find out? I didn't check it in, and you can search the CVS archives as easily as I can (I'm not inclined to, since I don't think it can affect the outcome of this). Jeremy Hylton may, or may not, remember more about it (IIRC, he said he checked it in). > ... > If there is a way to fix the bug on that other platform while still keep > -lieee on Linux, would that be acceptable? No: Guido *wants* overflow to raise OverflowError by default, and *wants* sqrt(-1.0) to raise ValueError by default. Python's x-platform fp numerics today are an utter mess, and the best we can do for 2.0 is to make them as consistent as we have time to make them, despite that we know it will break some of your code (but you can still link with -lieee if you feel you must), and that Mark Favas has confirmed it will break code under both his Solaris and Tru64 Unix systems (but for a reason opposite of yours: he's been getting OverflowError on underflow since 1.5.2, and we're taking that away from him, and he'll have *no* way to go back). At this point we favor forcing consistency over maintaining platform accidents, no matter how attached people have gotten to them; else we'll be stuck with them forever. [oh some of Kahan's papers, at http://http.cs.berkeley.edu/~wkahan/] > Interesting! I've glanced through some of Prof Kahan's writings. He is an entertaining writer, although his rhetoric is often more extreme than either of ours . > It appears that he favors raising flags that can be checked optionally, and > he is against mandatary raising exceptions. Have you read the 754 std? He's in favor of the 754 std. [quotes snipped, except for my favorite, which I've paraphrased many times over the years on c.l.py] > ... > They are called "Exceptions" because to any policy for handling them, > imposed in advance upon all programmers by the computer system, some > programmers will have good reason to take exception. > ... > From these quotes and others I understand that he wants f.p. exceptions to > be merely messanges, not errors that force programmers to take extra > actions, unless the programmer choose to. So what aspect of Java did he > think is deficient? It is the "Trap" style exception that mandate a users > action. His paper "How JAVA's Floating-Point Hurts Everyone Everywhere" lists his 5 main gripes about Java in bullet points at the top of page 3. The paper runs on to 80 pages. You somehow managed to miss 79.89 of them <0.4 wink>, reducing it to a bogus claim about Java that Kahan didn't make (Java has neither "Trap" nor "Flag" style fp exception signaling). > He told "A cautionary Tale of the Ariane 5", Which has nothing to do with Java -- the software in question was written in Ada, which (unlike Java) has "Trap" style. Why he put it in a paper about Java is a bit of a mystery; I write it off to rhetorical excess. > the European rocket that mulfunctioned after lift off. It turned out > that a piece of software produced an unimportant exception that is > not caught by a handler and caused debugging data to be dumped to a > critical memory location. This would have been avoided if the exception > merely raised a flag and returned a NaN, and the program continued. Actually, that was impossible to do, and he didn't suggest that. What he wrote is Had overflow merely obeyed the IEEE 754 default policy, the recalibration software would have raised a flag and delivered an invalid result both to be ignored by the motor guidance programs, and the Ariane 5 would have pursued its intended trajectory. Note that he didn't say NaN. He couldn't, because this was overflow in a conversion from Float to Integer. Despite his cheery optimism here, 754 is approximately useless in this case, since there is no generally accepted "invalid result" in integer formats (and 754 doesn't define one either -- the result of overflow in converting floats to ints is ill-defined in 754; 754 doesn't even require that it set the overflow flag). > So do we want every Python program to bomb whenever there is a floating > point value outside bound and is not trapped by try/except? By default, yes, Guido does, but for overflow, not underflow. If you read the following section of Kahan's paper, you should have noticed that he is *just* as critical of just returning Infs and NaNs (which is all Java does, and which is the accidental Python behavior you're arguing we keep in glibc) as he is of just trapping! His conclusion: "Without Traps nor Flags, Java’ s floating-point is Dangerous": Without flags, detecting rare creations of Inf and NaN before they disappear requires programmed tests and branches that, besides duplicating tests already performed by the hardware, slow down the program and impel a programmer to make decisions prematurely in many cases. Worse, a plethora of tests and branches undermines a program’s modularity, clarity and concurrency. I agree with him there wholeheartedly: without the 754-mandated flags, *and* without raising exceptions, the subset of 754 remaining sucks. >> ironically, 754 is hardest to sell to those who could benefit from >> it the most. > So far the only concern from number-crunchers voiced here is that it might > allow sqrt(-1)==0, which is not the case. Gimme a break! In the very msg Paul Dubois said that, he also said "Some people use Inf but most people want the code to STOP so they can find out where the INFS started. Otherwise, two hours later you have big arrays of Infs and no idea how it happened.". I'm starting to drop my assumption of good faith on your part: what you remember and how you paraphrase (whether it's Paul or Kahan) is extremely selective, beyond normal bounds of zeal-inspired distortion. > I was a fortran programmer before. I switched to using IEEE ten years > ago as soon as it was available on the machine I was using. So there > are different opinions. Certainly, and good 754 support will cater to most of them. I don't believe your opinion (or mine, for that matter) reflects anything even close to the majority view here, though. As I said in my reply to Paul, my observations (based on 15 years on the vendor side of the fp biz) matched his exactly (based on his experience with hundreds of numeric code authors): a vast majority still want divide-by-0, invalid operation, and overflow to raise an exception the vast majority of the time. > ... > Obviously we agree on the benefit of having a choice. But we > have different perspective on what choice means. Your want a choice > to force user to take explicit action, I want a choice to ignore these > events. No. I want exactly the choices 754 lays out: user-settable sticky flags and user-maskable exceptions. We're not getting that for 2.0. And we're *never* getting it if 2.0 doesn't do *something* to start disabusing people of the notion that their historical numeric platform accidents in Python will be faithfully preserved forever more. > The ideal solution might be to have a sys.fp_exception class. Each > exception would set a flag like fp_exception.overflow so that user can > check them. There could also be a variable like fp_exception.force_trap, > which when set, could make each f.p. exception to produce a Python > exception. This would confirm to IEEE 754 and give both of us a choice > we want. Kinda, except that each of the 5 754-defined traps must be individually maskable. 754 spells out what's needed. A PEP will be required to spell out the Python- and C-level APIs. I've corresponded (just -- no time now) a little with Kevin Jacobs about that offline. > Now that we are in feature freeze for 2.0, we can't get both choices. > Can we adopt the one that does not break behaviors on previous official > release, even if that's only by accident? Not as far as Guido or I are concerned, no. You can link with -lieee yourself if you must, although I can't recommend perpetuating the x-platform confusion here. We want to say that, e.g., math.exp works substantially the same way on *all* platforms under 2.0, not repeat the same decade-old "umm, don't know, and no way to guess -- try it on your platform and see what it does" yet again. I don't expect 2.0 will actually achieve that on all platforms, but it should on the primary ones. > ... > So now I know why people reported that NaN and Inf were broken on HPUX > and Windows and some others. If Python had simply ignored the flags ... Then we would have broken 754 subsets in slightly subtler ways, and still wildly varying across platforms. > ... > Could you please point a URL to "presubstitution"? In the paragraphs I > quoted the only mention of presubstitute is with NaNs and Inf, etc. Sorry, I don't save URLs, and don't recall whether this was in a paper or on David Hough's "Numeric Interest" mailing list in the early 90's. A Google search on "presubstitution Kahan" turns up 4 promising-looking hits I'll leave you to pursue. The basic idea is that the programmer gets to specify, via library calls (whatever), which particular fp value each 754 exceptional case returns. So, e.g., if it made sense for some part of the app, the programmer could say they wanted +- pi returned instead +- Inf, if and whenever overflow happened. Then set it back to +- Inf (or anything else they needed) later. This would be best if supported in HW directly, of course. > ... > You are not confirming to 754 until you allow all the exceptions to go > through with well defined values as default. I know that, but don't care. As I said, enabling overflow + invalid + div0 by default is the only scheme that can be *sold*. If you can find two NumPy users in favor of disabling them all by default, I'll be mildly astonished. 754 did itself enormous harm by insisting on that trivial point (it's trivial because, with proper support, anyone can change the defaults to anything they like with one line of code): I worked in the supercomputer biz at the time 754 was adopted, and for a decade after, and the "non stop" defaults were *universally* opposed by customers. Scared the hell out of language stds committees too, which goes a lot farther than the 754 folks would like to admit toward explaining why language committees stayed away from 754 bindings in droves. C99 is 15 years(!) after the fact. > Raising Python exceptions on some of them does not confirm to 754, as > the default IEEE 754 behavior on f.p. exception is not a Python exception, > but just a raised flag. See above. > Before that happens, what is the motive to make IEEE less usable for those > who have it (pretty much every one nowadays), even if just by accident? I think I've repeated the reasons to death already, and you've repeated to death that you'll never agree. So no more from me on that. > ... > But just to clarify some wordings you quoted in another post: I meant that > sqrt(-1)==0 is insane, whether silent or not. I agree. > Raising an exception is sane, Not according to 754's default rules, which you wanted me to take as sacred just a few paragraphs ago . > although OverflowError is not so reasonable. I'd say it's insane. > Raising a ValueError is reasonable. I expect we'll have to make InvalidOperationError a subclass of ValueError for that reason, when 754 support materializes. > But just returning NaN without a fuss is even better. You're going to find that's a very lonely position. > My favorite is returning 1j, as MatPy does. Then you should use cmath.sqrt instead of math.sqrt. Even $3 business calculators have a sqrt key these days, and you do not want to be on the other end of email when trying to explain to a businessperson why their crappy std deviation program returned a complex number <0.1 wink>. > if-it-ain't-broke-don't-fix-it-ly y'rs it-it-weren't-broke-we-wouldn't-ly y'rs - tim From fgranger@altern.org Fri Oct 13 11:08:23 2000 From: fgranger@altern.org (Francois Granger) Date: Fri, 13 Oct 2000 12:08:23 +0200 Subject: [Python-Dev] Re: [Pythonmac-SIG] MacPython 2.0c1 available In-Reply-To: <20001012220402.ABE8D104729@oratrix.oratrix.nl> Message-ID: on 13/10/00 0:03, Jack Jansen at jack@oratrix.nl wrote: > MacPython 2.0c1 is available, both as binary installer and in source > form. You can find it through > http://www.cwi.nl/~jac/macpython.html. This one works better. http://www.cwi.nl/~jack/macpython.html --=20 Fran=E7ois Granger fgranger@altern.org From nas@arctrix.com Fri Oct 13 07:37:17 2000 From: nas@arctrix.com (Neil Schemenauer) Date: Thu, 12 Oct 2000 23:37:17 -0700 Subject: [Python-Dev] test_minidom non-failure failure? (take 2) In-Reply-To: <14822.40645.656159.493390@anthem.concentric.net>; from bwarsaw@beopen.com on Fri, Oct 13, 2000 at 01:33:57AM -0400 References: <14821.58057.358947.271778@bitdiddle.concentric.net> <20001012023134.A18254@glacier.fnational.com> <200010121739.MAA07968@cj20424-a.reston1.va.home.com> <20001012032448.A18407@glacier.fnational.com> <14822.6858.920988.167252@bitdiddle.concentric.net> <20001012062010.A19026@glacier.fnational.com> <200010122126.QAA09072@cj20424-a.reston1.va.home.com> <20001012064309.C19026@glacier.fnational.com> <14822.40645.656159.493390@anthem.concentric.net> Message-ID: <20001012233717.A20054@glacier.fnational.com> On Fri, Oct 13, 2000 at 01:33:57AM -0400, Barry A. Warsaw wrote: > I think (but don't really remember) that LEAK_DEBUG had > different semantics than it does now. Nope. LEAK_DEBUG prints to stderr information about all garbage the GC finds, even stuff the GC can free. The thinking was that GC would be an option and people would want to find applications that leak when only using reference counting. > No matter. This was useful when gc was spankin' new and only > semi-tested. It's probably fine to turn off -l in "make test" by > default for the 2.0 release. I've left -l enabled for now. Detecting tests that create uncollectable garbage is probably a good thing. It doesn't cost much and the message should be fairly clear now. Neil From fdrake@beopen.com Fri Oct 13 14:34:03 2000 From: fdrake@beopen.com (Fred L. Drake, Jr.) Date: Fri, 13 Oct 2000 09:34:03 -0400 (EDT) Subject: [Python-Dev] test_minidom non-failure failure? (take 2) In-Reply-To: <20001012233717.A20054@glacier.fnational.com> References: <14821.58057.358947.271778@bitdiddle.concentric.net> <20001012023134.A18254@glacier.fnational.com> <200010121739.MAA07968@cj20424-a.reston1.va.home.com> <20001012032448.A18407@glacier.fnational.com> <14822.6858.920988.167252@bitdiddle.concentric.net> <20001012062010.A19026@glacier.fnational.com> <200010122126.QAA09072@cj20424-a.reston1.va.home.com> <20001012064309.C19026@glacier.fnational.com> <14822.40645.656159.493390@anthem.concentric.net> <20001012233717.A20054@glacier.fnational.com> Message-ID: <14823.3915.245246.310674@cj42289-a.reston1.va.home.com> Neil Schemenauer writes: > I've left -l enabled for now. Detecting tests that create > uncollectable garbage is probably a good thing. It doesn't cost > much and the message should be fairly clear now. Perhaps one thing that could be done is to reduce the volume of the output; perhaps just list the first 1K or 2K of the repr? -Fred -- Fred L. Drake, Jr. BeOpen PythonLabs Team Member From nas@arctrix.com Fri Oct 13 08:09:48 2000 From: nas@arctrix.com (Neil Schemenauer) Date: Fri, 13 Oct 2000 00:09:48 -0700 Subject: [Python-Dev] test_minidom non-failure failure? (take 2) In-Reply-To: <14823.3915.245246.310674@cj42289-a.reston1.va.home.com>; from fdrake@beopen.com on Fri, Oct 13, 2000 at 09:34:03AM -0400 References: <20001012023134.A18254@glacier.fnational.com> <200010121739.MAA07968@cj20424-a.reston1.va.home.com> <20001012032448.A18407@glacier.fnational.com> <14822.6858.920988.167252@bitdiddle.concentric.net> <20001012062010.A19026@glacier.fnational.com> <200010122126.QAA09072@cj20424-a.reston1.va.home.com> <20001012064309.C19026@glacier.fnational.com> <14822.40645.656159.493390@anthem.concentric.net> <20001012233717.A20054@glacier.fnational.com> <14823.3915.245246.310674@cj42289-a.reston1.va.home.com> Message-ID: <20001013000948.C20054@glacier.fnational.com> On Fri, Oct 13, 2000 at 09:34:03AM -0400, Fred L. Drake, Jr. wrote: > Perhaps one thing that could be done is to reduce the volume of the > output; perhaps just list the first 1K or 2K of the repr? It just prints the number of object found now. Neil From fdrake@beopen.com Fri Oct 13 15:06:22 2000 From: fdrake@beopen.com (Fred L. Drake, Jr.) Date: Fri, 13 Oct 2000 10:06:22 -0400 (EDT) Subject: [Python-Dev] test_minidom non-failure failure? (take 2) In-Reply-To: <20001013000948.C20054@glacier.fnational.com> References: <20001012023134.A18254@glacier.fnational.com> <200010121739.MAA07968@cj20424-a.reston1.va.home.com> <20001012032448.A18407@glacier.fnational.com> <14822.6858.920988.167252@bitdiddle.concentric.net> <20001012062010.A19026@glacier.fnational.com> <200010122126.QAA09072@cj20424-a.reston1.va.home.com> <20001012064309.C19026@glacier.fnational.com> <14822.40645.656159.493390@anthem.concentric.net> <20001012233717.A20054@glacier.fnational.com> <14823.3915.245246.310674@cj42289-a.reston1.va.home.com> <20001013000948.C20054@glacier.fnational.com> Message-ID: <14823.5854.638859.950835@cj42289-a.reston1.va.home.com> Neil Schemenauer writes: > It just prints the number of object found now. Ok, I must have missed the checkin that changed that. This is fine in my book as well. Thanks for staying on top of this work! I think you've really done a great job with the GC effort. -Fred -- Fred L. Drake, Jr. BeOpen PythonLabs Team Member From cgw@fnal.gov Fri Oct 13 16:18:23 2000 From: cgw@fnal.gov (Charles G Waldman) Date: Fri, 13 Oct 2000 10:18:23 -0500 (CDT) Subject: [Python-Dev] can't build with threads on OSF/1 Message-ID: <14823.10175.741638.857531@buffalo.fnal.gov> Sorry, I don't have time to investigate this fully right now. Maybe this weekend. For now this is just a heads-up. Hopefully, something is just misconfigured on this system. The machine in question is running OSF1 V4.0 878 alpha I can only build Python from current CVS sources on OSF/1 if I specify --without-thread. If I don't specify this I get the following errors at link time: Unresolved: __pthread_mutex_init __pthread_mutex_destroy __pthread_mutex_lock __pthread_mutex_unlock __pthread_cond_init __pthread_cond_destroy __pthread_cond_signal __pthread_cond_wait __pthread_create __pthread_detach I tried sending a message with the output of ./configure and make attached, but it was over the 40K limit. If anybody wants to see these, email me. From nas@arctrix.com Fri Oct 13 09:28:49 2000 From: nas@arctrix.com (Neil Schemenauer) Date: Fri, 13 Oct 2000 01:28:49 -0700 Subject: [Python-Dev] can't build with threads on OSF/1 In-Reply-To: <14823.10175.741638.857531@buffalo.fnal.gov>; from cgw@fnal.gov on Fri, Oct 13, 2000 at 10:18:23AM -0500 References: <14823.10175.741638.857531@buffalo.fnal.gov> Message-ID: <20001013012849.C20168@glacier.fnational.com> On Fri, Oct 13, 2000 at 10:18:23AM -0500, Charles G Waldman wrote: > Unresolved: > __pthread_mutex_init [...] What is the LIBS variable set to in Modules/Makefile? It looks your missing something like "-lpthread". Neil From cgw@fnal.gov Fri Oct 13 16:35:52 2000 From: cgw@fnal.gov (Charles G Waldman) Date: Fri, 13 Oct 2000 10:35:52 -0500 (CDT) Subject: [Python-Dev] can't build with threads on OSF/1 In-Reply-To: <20001013012849.C20168@glacier.fnational.com> References: <14823.10175.741638.857531@buffalo.fnal.gov> <20001013012849.C20168@glacier.fnational.com> Message-ID: <14823.11224.545609.761307@buffalo.fnal.gov> Neil Schemenauer writes: > On Fri, Oct 13, 2000 at 10:18:23AM -0500, Charles G Waldman wrote: > > Unresolved: > > __pthread_mutex_init > [...] > > What is the LIBS variable set to in Modules/Makefile? It looks > your missing something like "-lpthread". Hehehe. I might be kinda thick sometimes, but I think I would have caught that. Here's a little more of the "make" output: cd Modules; make OPT="-O -Olimit 1500" VERSION="2.0" prefix="/usr/local" exec_prefix="/usr/local" LIBRARY=../libpython2.0.a link cc python.o ../libpython2.0.a -ldb -lpthreads -lm -o python ld: Unresolved: __pthread_mutex_init __pthread_mutex_destroy __pthread_mutex_lock __pthread_mutex_unlock __pthread_cond_init __pthread_cond_destroy __pthread_cond_signal __pthread_cond_wait __pthread_create __pthread_detach *** Exit 1 Stop. *** Exit 1 Stop. From thomas@xs4all.net Fri Oct 13 17:34:36 2000 From: thomas@xs4all.net (Thomas Wouters) Date: Fri, 13 Oct 2000 18:34:36 +0200 Subject: [Python-Dev] can't build with threads on OSF/1 In-Reply-To: <14823.10175.741638.857531@buffalo.fnal.gov>; from cgw@fnal.gov on Fri, Oct 13, 2000 at 10:18:23AM -0500 References: <14823.10175.741638.857531@buffalo.fnal.gov> Message-ID: <20001013183436.B12812@xs4all.nl> On Fri, Oct 13, 2000 at 10:18:23AM -0500, Charles G Waldman wrote: > Sorry, I don't have time to investigate this fully right now. Maybe > this weekend. For now this is just a heads-up. Hopefully, something > is just misconfigured on this system. > The machine in question is running OSF1 V4.0 878 alpha That's a former DEC alpha, right ? Perhaps running configure with '--with-dec-threads' will solve the problem ? I'm not sure if that will work alone, so you might need '--with-dec-threads --with-threads=no' to disable 'normal' thread-checking. You can also try this by hand; after running configure, edit Modules/Makefile.pre, and change LDLAST= into LDLAST= -threads (not -lthreads, just -threads) That seems to be the only difference --with-dec-threads uses. I looked at this before, but don't have an alpha or anything else that needs --with-dec-threads, so I couldn't detect this automatically. I do think it should be done automatically, though. Perhaps I can figure it if you can send me, for instance, config.log and the output of configure, and find the time to run a few tests later. > I can only build Python from current CVS sources on OSF/1 if I specify > --without-thread. If I don't specify this I get the following errors > at link time: > Unresolved: > __pthread_mutex_init > I tried sending a message with the output of ./configure and make > attached, but it was over the 40K limit. If anybody wants to see > these, email me. If the above doesn't fix it, I can take a look at the output of configure and config.log. No need to see the output of make just yet. -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From cgw@fnal.gov Fri Oct 13 19:31:34 2000 From: cgw@fnal.gov (Charles G Waldman) Date: Fri, 13 Oct 2000 13:31:34 -0500 (CDT) Subject: [Python-Dev] can't build with threads on OSF/1 In-Reply-To: <20001013183436.B12812@xs4all.nl> References: <14823.10175.741638.857531@buffalo.fnal.gov> <20001013183436.B12812@xs4all.nl> Message-ID: <14823.21766.733905.575290@buffalo.fnal.gov> Thomas Wouters writes: > > That's a former DEC alpha, right ? Perhaps running configure with > '--with-dec-threads' will solve the problem ? I'm not sure if that will work > alone, so you might need '--with-dec-threads --with-threads=no' to disable > 'normal' thread-checking. Thank you, that indeed solves the problem. Sorry for the noise. It would be nice if configure were smart enough to figure this out! From cgw@fnal.gov Fri Oct 13 19:38:26 2000 From: cgw@fnal.gov (Charles G Waldman) Date: Fri, 13 Oct 2000 13:38:26 -0500 (CDT) Subject: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: References: <200010131453.JAA23050@buffalo.fnal.gov> Message-ID: <14823.22178.605732.455689@buffalo.fnal.gov> Tim Peters wrote: > I'm very keen to know whether the current CVS version of Python > (2.0c1) still raises OverflowError for math.exp(-746) on your > Solaris and/or Tru64 Unix boxes. I just repeated this test, on the following 4 platforms: 1) SunOS fsui02 5.6 Generic_105181-21 sun4u sparc SUNW,Ultra-Enterprise cc: WorkShop Compilers 4.2 30 Oct 1996 C 4.2 2) OSF1 V4.0 878 alpha DEC C V5.6-079 on Digital UNIX V4.0 (Rev. 878) 3) IRIX64 6.5 07151432 IP27 MIPSpro Compilers: Version 7.2.1 4) Linux 2.2.16 #31 SMP Thu Jun 29 14:51:26 CDT 2000 i686 gcc version 2.95.2 19991024 (release) On all of the above systems, math.exp(-999) returns 0.0, math.sqrt(-1) raises an exception, and test_math.py completes successfully. Testing-ly (not to be confused with testily) yr's, cgw From tim_one@email.msn.com Fri Oct 13 19:56:43 2000 From: tim_one@email.msn.com (Tim Peters) Date: Fri, 13 Oct 2000 14:56:43 -0400 Subject: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: <14823.22178.605732.455689@buffalo.fnal.gov> Message-ID: [Charles G Waldman] > I just repeated this test, on the following 4 platforms: > > 1) SunOS fsui02 5.6 Generic_105181-21 sun4u sparc SUNW,Ultra-Enterprise > cc: WorkShop Compilers 4.2 30 Oct 1996 C 4.2 > > 2) OSF1 V4.0 878 alpha > DEC C V5.6-079 on Digital UNIX V4.0 (Rev. 878) > > 3) IRIX64 6.5 07151432 IP27 > MIPSpro Compilers: Version 7.2.1 > > 4) Linux 2.2.16 #31 SMP Thu Jun 29 14:51:26 CDT 2000 i686 > gcc version 2.95.2 19991024 (release) > > On all of the above systems, math.exp(-999) returns 0.0, math.sqrt(-1) > raises an exception, and test_math.py completes successfully. Excellent! Note that test_math.py was augmented to verify that: 1. exp(-huge) returns 0 without exception. 2. exp(+huge) raises OverflowError. 3. sqrt(-1) raises ValueError. None of those were reliable across platforms before, and I'm afraid there's strong reason to suspect one or more still won't work right under Mandrake Linux when Python is compiled with -O (this based on the output of a C program someone posted to c.l.py yesterday). But it's a world better than it used to be. > Testing-ly (not to be confused with testily) yr's, You bet -- everyone leave testily to me on this one. I'm bitter enough about floating-point in stinking C for everyone combined <0.9 wink>. From thomas@xs4all.net Fri Oct 13 20:19:38 2000 From: thomas@xs4all.net (Thomas Wouters) Date: Fri, 13 Oct 2000 21:19:38 +0200 Subject: [Python-Dev] can't build with threads on OSF/1 In-Reply-To: <14823.21766.733905.575290@buffalo.fnal.gov>; from cgw@fnal.gov on Fri, Oct 13, 2000 at 01:31:34PM -0500 References: <14823.10175.741638.857531@buffalo.fnal.gov> <20001013183436.B12812@xs4all.nl> <14823.21766.733905.575290@buffalo.fnal.gov> Message-ID: <20001013211938.C12812@xs4all.nl> --jRHKVT23PllUwdXP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Oct 13, 2000 at 01:31:34PM -0500, Charles G Waldman wrote: > Thomas Wouters writes: > > > > That's a former DEC alpha, right ? Perhaps running configure with > > '--with-dec-threads' will solve the problem ? I'm not sure if that will work > > alone, so you might need '--with-dec-threads --with-threads=no' to disable > > 'normal' thread-checking. > Thank you, that indeed solves the problem. Sorry for the noise. No problem. When I went over the README file a few weeks back, and sent Guido an update, this particular issue was one of the biggest problems for me: the old README, which assumed threads were not default, was quite adamant about using --with-dec-threads for OSF/1 and its incarnations. Unfortunately, it doesn't say why :) And the configure script only says that it's necessary to get threadsafe libraries. > It would be nice if configure were smart enough to figure this out! Configure is as smart as we make it. configure is made by autoconf, which is moderately intelligent, and we just have to add the extra geniality to configure.in. If the only check we need is 'does this system call itself OSF1', we can easily add that. See the attached patch (configure.in version only. Let me know if you need a patched configure as well, I don't know if OSF systems come with autoconf. It's pretty large, though, and you don't need to generate configure on the same system as you run it on. Just apply the configure.in patch, type 'autoconf', and copy the resulting configure script to your OSF1 machine.) The question is, is this enough ? Will this detect all the OSF platforms that need '-threads', and will it only add it to those platforms ? It wouldn't be particularly nice of configure if it insisted on adding '-threads' on platforms that don't need it, or worse, break because of it. For instance, the patch uses 'OSF*', which might be too generic... but 'OSF1' might be too restrictive :-) A better fix would probably be to write a test program that explicitly uses threads & the -threads arguments, but that could fail for a large number of reasons, which doesn't mean -threads isn't needed :P (Configure is really amusing like that. For instance, if your compile system is broken, like when you unpacked a new linux kernel source tree in /usr/src/linux, but forgot to type 'make symlinks', configure will assume the worst (every check is negative, after all.) If you're lucky, it will complain because you miss an essential feature... If you're unlucky, it finishes cleanly, writes the config.cache file, your compile fails, you figure out the problem, and you keep compiling using the wrong autoconf 'settings'. And re-configuring doesn't fix it, because the config.cache file is just fine ;) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! --jRHKVT23PllUwdXP Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="dec-thread.patch" Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.172 diff -c -r1.172 configure.in *** configure.in 2000/10/12 17:11:38 1.172 --- configure.in 2000/10/13 19:15:11 *************** *** 805,810 **** --- 805,819 ---- LIBS="$LIBS -lthread" LIBOBJS="$LIBOBJS thread.o" USE_THREAD_MODULE=""]) + + if test "$USE_THREAD_MODULE" != "#" + then + # If the above checks didn't disable threads, (at least) OSF1 + # needs this '-threads' argument during linking. + case $ac_sys_system in + OSF*) LDLAST=-threads;; + esac + fi fi # Check for GC support --jRHKVT23PllUwdXP-- From skip@mojam.com (Skip Montanaro) Fri Oct 13 20:39:42 2000 From: skip@mojam.com (Skip Montanaro) (Skip Montanaro) Date: Fri, 13 Oct 2000 14:39:42 -0500 (CDT) Subject: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: References: <14823.22178.605732.455689@buffalo.fnal.gov> Message-ID: <14823.25854.786347.542654@beluga.mojam.com> Tim> None of those were reliable across platforms before, and I'm afraid Tim> there's strong reason to suspect one or more still won't work right Tim> under Mandrake Linux when Python is compiled with -O (this based on Tim> the output of a C program someone posted to c.l.py yesterday). But Tim> it's a world better than it used to be. After executing cvs update -d . ./configure make clean make OPT=-O3 I get the following output from regrtest.py regarding test_math: % ./python Lib/test/regrtest.py test_math test_math 1 test OK. This is on a Mandrake 7.1 system. Here are the bits I think are relevant to identify my environment: % cat /etc/issue.net Linux Mandrake release 7.1 (helium) Kernel 2.2.16-9mdk on an i686 % gcc -v Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux/2.95.3/specs gcc version 2.95.3 19991030 (prerelease) % rpm -q -a | egrep glibc glibc-devel-2.1.3-15mdk compat-glibc-5.3-2.0.7.6mdk glibc-2.1.3-15mdk If you have a C test program you'd like me to try, shoot it over. I'll be glad to run it and shoot back the results. Skip From fdrake@beopen.com Fri Oct 13 20:41:46 2000 From: fdrake@beopen.com (Fred L. Drake, Jr.) Date: Fri, 13 Oct 2000 15:41:46 -0400 (EDT) Subject: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: <14823.25854.786347.542654@beluga.mojam.com> References: <14823.22178.605732.455689@buffalo.fnal.gov> <14823.25854.786347.542654@beluga.mojam.com> Message-ID: <14823.25978.181614.85977@cj42289-a.reston1.va.home.com> Skip Montanaro writes: > This is on a Mandrake 7.1 system. Here are the bits I think are relevant to > identify my environment: The test passes for me as well on Mandrake 7.1. Here's the environment info: % ./python -tt ../Lib/test/regrtest.py test_math test_math 1 test OK. % cat /etc/issue.net Welcome to %h Linux Mandrake release 7.1 (helium) Kernel 2.2.15-4mdk on an i686 % gcc -v Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux/2.95.3/specs gcc version 2.95.3 19991030 (prerelease) % rpm -qa | egrep glibc nedit-5.1.1-1.glibc glibc-profile-2.1.3-5mdk glibc-2.1.3-5mdk compat-glibc-5.3-2.0.7.6mdk glibc-devel-2.1.3-5mdk > If you have a C test program you'd like me to try, shoot it over. I'll be > glad to run it and shoot back the results. Same here... -Fred -- Fred L. Drake, Jr. BeOpen PythonLabs Team Member From cgw@fnal.gov Fri Oct 13 20:52:44 2000 From: cgw@fnal.gov (Charles G Waldman) Date: Fri, 13 Oct 2000 14:52:44 -0500 (CDT) Subject: [Python-Dev] gcc versions (was:RE: Possible bug (was Re: some other junk, ...)) In-Reply-To: <14823.25854.786347.542654@beluga.mojam.com> References: <14823.22178.605732.455689@buffalo.fnal.gov> <14823.25854.786347.542654@beluga.mojam.com> Message-ID: <14823.26636.59174.832572@buffalo.fnal.gov> Skip Montanaro writes: > This is on a Mandrake 7.1 system. Here are the bits I think are relevant to > identify my environment: > % gcc -v > Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux/2.95.3/specs > gcc version 2.95.3 19991030 (prerelease) AFAIK, this version of GCC was never "blessed" by the GCC maintainers and should not be being used for any production work. I think Mandrake did a bad thing by shipping this version. Not quite as bad as what RedHat did by shipping the completely not-for-general-use gcc-2.96, but nonetheless still a bad thing. When will distribution builders learn that having a higher version number is not necessarily a good thing? Why do they keep second-guessing the good advice of the GCC Steering Committee? Sigh... In any case, I don't think we should put effort into chasing down bugs that are caused by bogus C compilers. Any reports coming in from RedHat 7.0 users or Mandrake 7.1 need to be evaluated in this light. From fdrake@beopen.com Fri Oct 13 20:58:53 2000 From: fdrake@beopen.com (Fred L. Drake, Jr.) Date: Fri, 13 Oct 2000 15:58:53 -0400 (EDT) Subject: [Python-Dev] gcc versions (was:RE: Possible bug (was Re: some other junk, ...)) In-Reply-To: <14823.26636.59174.832572@buffalo.fnal.gov> References: <14823.22178.605732.455689@buffalo.fnal.gov> <14823.25854.786347.542654@beluga.mojam.com> <14823.26636.59174.832572@buffalo.fnal.gov> Message-ID: <14823.27005.800291.217346@cj42289-a.reston1.va.home.com> Charles G Waldman writes: > AFAIK, this version of GCC was never "blessed" by the GCC maintainers > and should not be being used for any production work. I think > Mandrake did a bad thing by shipping this version. Not quite as bad I agree. > In any case, I don't think we should put effort into chasing down bugs > that are caused by bogus C compilers. Any reports coming in from > RedHat 7.0 users or Mandrake 7.1 need to be evaluated in this light. I think Skip & I were showing that there isn't a bug for Mandrake 7.1. I don't know what version of GCC shipped with Mandrake 7.0, which may have been the version Tim received the report for (I recall he said "Mandrake 7", which isn't specific). -Fred -- Fred L. Drake, Jr. BeOpen PythonLabs Team Member From larsga@garshol.priv.no Fri Oct 13 21:08:05 2000 From: larsga@garshol.priv.no (Lars Marius Garshol) Date: 13 Oct 2000 22:08:05 +0200 Subject: [XML-SIG] Re: [Python-Dev] test_minidom non-failure failure? (take 2) In-Reply-To: <14821.60663.213246.179325@cj42289-a.reston1.va.home.com> References: <14821.58057.358947.271778@bitdiddle.concentric.net> <20001012023134.A18254@glacier.fnational.com> <14821.60663.213246.179325@cj42289-a.reston1.va.home.com> Message-ID: * Fred L. Drake, Jr. | | This looks like a problem in the unlink() method of the DOM. Could | you please check that the unlink() method is updated to handle the | latest version of the other changes? It seems that the current unlink() does not remove sibling cycles. Patch #101897 adds a line to set sibling references to None, which seems to make regrtest.py -l happy. --Lars M. From prescod@prescod.net Fri Oct 13 21:12:38 2000 From: prescod@prescod.net (Paul) Date: Fri, 13 Oct 2000 15:12:38 -0500 (CDT) Subject: [XML-SIG] Re: [Python-Dev] test_minidom non-failure failure? (take 2) In-Reply-To: Message-ID: Right, I just checked in the fix to that. Paul Prescod On 13 Oct 2000, Lars Marius Garshol wrote: > > * Fred L. Drake, Jr. > | > | This looks like a problem in the unlink() method of the DOM. Could > | you please check that the unlink() method is updated to handle the > | latest version of the other changes? > > It seems that the current unlink() does not remove sibling cycles. > Patch #101897 adds a line to set sibling references to None, which > seems to make regrtest.py -l happy. > > --Lars M. > > > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > http://www.python.org/mailman/listinfo/python-dev > From tim_one@email.msn.com Fri Oct 13 21:23:31 2000 From: tim_one@email.msn.com (Tim Peters) Date: Fri, 13 Oct 2000 16:23:31 -0400 Subject: Mandrake vs glibc (was RE: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: <14823.25854.786347.542654@beluga.mojam.com> Message-ID: The original source of my concern was this c.l.py post from David Cooke: http://www.deja.com/getdoc.xp?AN=680840594 He ran a little C program that Huaiyu Zhu had posted earlier in the thread. According to David's results, under "Linux-Mandrake 7.1 (glibc 2.1.3) ... without -lieee, but compiled with -O ... gcc 2.95.2.", platform exp and sqrt *never* set errno, regardless of input. In which case what Python does with the platform NaN result from math.sqrt(-1.) is an accident (and probably ends up setting errno to ERANGE itself by mistake), and an overflowing exp would let the platform +Inf result pass thru silently. So, if David's report is correct, and best I understand it you were all using 7.1 too with at least some level of optimization, it's A Mystery why CVS test_math.py succeeds on that system (its new math.sqrt(-1) test would probably fail; its new math.exp(+huge) test would almost certainly fail). I'm anal enough about this stuff that I'd try to figure out why if I had a Mandrake system, but in the cosmic scheme of things I doubt it's important enough for anyone else to burn time on. From jeremy@beopen.com Sat Oct 14 00:05:02 2000 From: jeremy@beopen.com (Jeremy Hylton) Date: Fri, 13 Oct 2000 19:05:02 -0400 (EDT) Subject: [Python-Dev] build problems large and small on FreeBSD Message-ID: <14823.38174.143372.125749@bitdiddle.concentric.net> I just built the latest CVS sources on a FreeBSD machine (4.1-RELEASE FreeBSD). There are a number of compiler warnings, all having to do with redefinitions, plus some linker warnings and a test failure. I don't have time to investigate further, but thought I'd let people know in case someone else has time to take a look. test_math failed -- overflowing exp() didn't trigger OverflowError Python 2.0c1 (#2, Oct 13 2000, 15:50:26) [GCC 2.95.2 19991024 (release)] on freebsd4 Type "copyright", "credits" or "license" for more information. >>> import math >>> math.exp(1200) Inf The warnings from the linker seem harmless enough. I don't know why it is complaining about setkey and des_setkey. /usr/lib/libc.so: WARNING! setkey(3) not present in the system! /usr/lib/libc.so: warning: this program uses gets(), which is unsafe. /usr/lib/libc.so: warning: mktemp() possibly used unsafely; consider using mkstemp() /usr/lib/libc.so: WARNING! des_setkey(3) not present in the system! /usr/lib/libc.so: WARNING! encrypt(3) not present in the system! /usr/lib/libc.so: warning: tmpnam() possibly used unsafely; consider using mkstemp() /usr/lib/libc.so: warning: this program uses f_prealloc(), which is stupid. /usr/lib/libc.so: WARNING! des_cipher(3) not present in the system! /usr/lib/libc.so: warning: tempnam() possibly used unsafely; consider using mkstemp() The compiler-time warnings look like they are caused by a configure problem. If so, I don't know how to fix it :-). gcc -O3 -I../../Python/../Include -I.. -DHAVE_CONFIG_H -c ../../Python/thread.c In file included from /usr/include/unistd.h:42, from ../../Python/thread.c:28: /usr/include/sys/unistd.h:71: warning: `_POSIX_THREADS' redefined ../config.h:136: warning: this is the location of the previous definition In file included from ../../Python/thread.c:118: ../../Python/thread_pthread.h:59: warning: `pthread_attr_default' redefined /usr/include/pthread.h:158: warning: this is the location of the previous definition ../../Python/thread_pthread.h:60: warning: `pthread_mutexattr_default' redefined /usr/include/pthread.h:157: warning: this is the location of the previous definition ../../Python/thread_pthread.h:61: warning: `pthread_condattr_default' redefined /usr/include/pthread.h:156: warning: this is the location of the previous definition Jeremy From jeremy@beopen.com Sat Oct 14 00:11:10 2000 From: jeremy@beopen.com (Jeremy Hylton) Date: Fri, 13 Oct 2000 19:11:10 -0400 (EDT) Subject: [Python-Dev] warnings --with-pydebug Message-ID: <14823.38542.908547.275077@bitdiddle.concentric.net> If you configure using '--with-pydebug' you get a lot of compile-time warnings. ../../Python/ceval.c: In function `eval_code2': ../../Python/ceval.c:672: warning: value computed is not used ../../Python/ceval.c:675: warning: value computed is not used ../../Python/ceval.c:678: warning: value computed is not used ../../Python/ceval.c:680: warning: value computed is not used ../../Python/ceval.c:681: warning: value computed is not used [etc.] I assume these are caused by the definition of Py_INCREF #define Py_INCREF(op) (_Py_RefTotal++, (op)->ob_refcnt++) Is there some way to change this macro so that the warnings are silenced? Jeremy From thomas@xs4all.net Sat Oct 14 00:28:19 2000 From: thomas@xs4all.net (Thomas Wouters) Date: Sat, 14 Oct 2000 01:28:19 +0200 Subject: [Python-Dev] build problems large and small on FreeBSD In-Reply-To: <14823.38174.143372.125749@bitdiddle.concentric.net>; from jeremy@beopen.com on Fri, Oct 13, 2000 at 07:05:02PM -0400 References: <14823.38174.143372.125749@bitdiddle.concentric.net> Message-ID: <20001014012819.D12812@xs4all.nl> On Fri, Oct 13, 2000 at 07:05:02PM -0400, Jeremy Hylton wrote: > The warnings from the linker seem harmless enough. I don't know why > it is complaining about setkey and des_setkey. That's probably due to 'crypt()' being used, or some other library call that Python uses indirectly. If you want crypt(), you need to install a seperate DES encryption package under FreeBSD, IIRC. (It uses md5-hashes for all crypt purposes by default, because of the US Counter-Espionage Protection Plan or something :) If you don't want to install those, don't enable the crypt module. There are a couple of pure python crypt() implementations around, by the way, which always use pure DES crypt(). > /usr/lib/libc.so: warning: this program uses gets(), which is unsafe. This one is weirdish. I don't see any gets() call in Python, so I have to assume it's in some library or header file Python includes. A good candidate would be readline, which has appalled me before :) but who knows :P I'm inclined to think it isn't a library that comes with FreeBSD by default, since they are usually pretty picky about such things. (especially if it generates a linker warning each time it's used!) > /usr/lib/libc.so: warning: mktemp() possibly used unsafely; consider using mkstemp() > /usr/lib/libc.so: warning: tmpnam() possibly used unsafely; consider using mkstemp() > /usr/lib/libc.so: warning: tempnam() possibly used unsafely; consider using mkstemp() Yes, I've seen this before. Debian-unstable (I think ?) complains about tmpnam() and tempnam() as well. The manpages just say 'don't use this function, use mkstemp(3)'. It doesn't mention a reason, but it's probably because the files/directories created by these functions are predictable, which means you shouldn't use them for security-by-obscurity. The mktemp() warning doesn't come from Python, looks like. Probably another library that is included. If you really care about which it is, you'll have to comment them out one by one (I'd suggest starting with the oldest and least FreeBSDish one, i.e. readline :) but I don't think it's going to really matter. Python does use 'tempnam' and 'tmpnam', but only in the posixmodule, to provide Python versions. I'm not sure if we can just change these functions to use mkstemp (or tempfile, see below) internally, without breaking code, though I expect it'll be alright. What's more, these functions are new since 1.5.2. And also, I just noticed a bug/typo in the tempnam docstring. The one funny bit, though, is that these three functions point to mkstemp(), and the mkstemp() manpage reads this: Don't use this function, use tmpfile(3) instead. It's better defined and more portable. "When does the hurting stop ?" > /usr/lib/libc.so: warning: this program uses f_prealloc(), which is stupid. And this falls in the 'it wasn't us' category again. > The compiler-time warnings look like they are caused by a configure > problem. If so, I don't know how to fix it :-). > gcc -O3 -I../../Python/../Include -I.. -DHAVE_CONFIG_H -c ../../Python/thread.c > In file included from /usr/include/unistd.h:42, > from ../../Python/thread.c:28: > /usr/include/sys/unistd.h:71: warning: `_POSIX_THREADS' redefined > ../config.h:136: warning: this is the location of the previous definition Hm, yes. This looks like an unfortunate clash between a Python internal #define and a FreeBSD libc internal #define. I'm not sure if this is really the case, maybe the Python one serves exactly the same purpose as the FreeBSD one, but in that case, configure shouldn't redefine it. We can either rename the #define in Python, as it's only used to determine which thread functionality is available, or adjust the configure tests to see if it is #defined and not redefine it if so. (Or rather, to be sure that it defines the right thing, configure would have to test for posix threads, check the #define (if any), and if they don't match up, scream its head off. So perhaps renaming is the smarter thing.) On the other hand, the fact that you only got a warning, and not an error, means that Python isn't defining it to a different value than FreeBSD did, so it's not really a problem. It might be a problem if Python #defines it, but FreeBSD does not, but FreeBSD does have code that checks that #define, and starts doing weird things... > In file included from ../../Python/thread.c:118: > ../../Python/thread_pthread.h:59: warning: `pthread_attr_default' redefined > /usr/include/pthread.h:158: warning: this is the location of the previous definition > ../../Python/thread_pthread.h:60: warning: `pthread_mutexattr_default' redefined > /usr/include/pthread.h:157: warning: this is the location of the previous definition > ../../Python/thread_pthread.h:61: warning: `pthread_condattr_default' redefined > /usr/include/pthread.h:156: warning: this is the location of the previous definition Not sure about these, because I don't know enough about the various types of posix thread standards, and almost-posix thread almost-standards. I'm not sure if those names are reserved in any way, but they are apparently clashing with FreeBSD names. Or perhaps it's FreeBSD 'compatibility' code that does the defines like Python does, too. A simple '#undef' or '#ifndef' would suffice, here, I think, but I'm not sure. -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From thomas@xs4all.net Sat Oct 14 00:33:59 2000 From: thomas@xs4all.net (Thomas Wouters) Date: Sat, 14 Oct 2000 01:33:59 +0200 Subject: [Python-Dev] warnings --with-pydebug In-Reply-To: <14823.38542.908547.275077@bitdiddle.concentric.net>; from jeremy@beopen.com on Fri, Oct 13, 2000 at 07:11:10PM -0400 References: <14823.38542.908547.275077@bitdiddle.concentric.net> Message-ID: <20001014013359.E12812@xs4all.nl> On Fri, Oct 13, 2000 at 07:11:10PM -0400, Jeremy Hylton wrote: > If you configure using '--with-pydebug' you get a lot of compile-time > warnings. > ../../Python/ceval.c: In function `eval_code2': > ../../Python/ceval.c:672: warning: value computed is not used > ../../Python/ceval.c:675: warning: value computed is not used > ../../Python/ceval.c:678: warning: value computed is not used > ../../Python/ceval.c:680: warning: value computed is not used > ../../Python/ceval.c:681: warning: value computed is not used > [etc.] > I assume these are caused by the definition of Py_INCREF > #define Py_INCREF(op) (_Py_RefTotal++, (op)->ob_refcnt++) > Is there some way to change this macro so that the warnings are > silenced? Yes, prefix it with '(void)': #define Py_INCREF(op) (void)(_Py_RefTotal++, (op)->ob_refcnt++) However, that means that the 'return value' of Py_INCREF() must never be used anywhere. (If it does, it'll generate an error.) The return value of Py_INCREF() is not terribly useful, though. Both in debug and in normal mode, it expands to the refcount of the object *before* it was INCREF'd. I still consider this kind of warning (I've seen it before, always with macros that do several things by using the otherwise fairly useless tuple-creator in C ;) a bit of a bug in gcc: it knows both those statements have sideeffects, and it's obvious we want to throw away the first result, so why worry about the second ? But at least it isn't screwing up floating-point operations, and nobody's perfect :-) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From huaiyu_zhu@yahoo.com Sat Oct 14 01:25:49 2000 From: huaiyu_zhu@yahoo.com (Huaiyu Zhu) Date: Fri, 13 Oct 2000 17:25:49 -0700 (PDT) Subject: [Python-Dev] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: Message-ID: Tim, Thank you for the explanations. We actually agree more than it appears: - Full IEEE 754 support in Python is good, which should allow the user to decide when to use raised flags and when to use Python exceptions. - If the user default can be changed with one line of code, it does not matter if Python default use exceptions, even if that's not strict compliance in words. The "factory default" might as well set for the benefit of newbies. - Without IEEE 754 support, or with just partial support, f.p. computation is a mess. Following are some contentious issues: I am not so sure that even with 754, there would still be a great variety. I see you giving one example: sqrt(-1) in 1.5.2. But wasn't that caused by extra Python checking? I say this because errno=3D=3D0 in C. Maybe I'm mi= ssing something. Or, do you mean that glibc itself is deficient, because it should have set the flag? My worry concerns the decision to unify 2.0 f.p. behavior in a specific way before full IEEE 754 support. I understand that you say this does not coun= t as a changed behavior because the previous one is accidental. But I don't see the particular fixed subset chosen as any better than any other. I agre= e that I do have a choice of using -lieee, though. It is interesting to know that someone actually relies on OverflowError to detect underflow. But why not let them continue that as well, given that all of these would be available in the future anyway? > At this point we favor forcing consistency over maintaining platform > accidents, no matter how attached people have gotten to them; else we'll > be stuck with them forever. I do not understand. Once there is full IEEE 754, everyone would have a choice, which pretty much includes all the things people are doing now. Before that happens, why consistency accross platform is deemed more important than consistency accross releases? My naive thinking is that people port more from 1.5.2 to 2.0 than from one platform to another, isn't it? :-) Following does not have much new to say, just some clarification. You are right to emphasise that Kahan does not favor any subset of IEEE 754= : > > They are called "Exceptions" because to any policy for handling them, > > imposed in advance upon all programmers by the computer system, some > > programmers will have good reason to take exception. Yes. And that's what's happening. :-) > His paper "How JAVA's Floating-Point Hurts Everyone Everywhere" lists his= 5 > main gripes about Java in bullet points at the top of page 3. The paper > runs on to 80 pages. You somehow managed to miss 79.89 of them <0.4 wink= >, > reducing it to a bogus claim about Java that Kahan didn't make (Java has > neither "Trap" nor "Flag" style fp exception signaling). Thank you for correcting me on this one. I did "glance over" all the pages= =2E I was somewhat puzzled by his decriptions, so I made a quick test: 1/0, and got Exception in thread "main" java.lang.ArithmeticException: / by zero But now I see that 1/0.0 is Infinity. So is Math.exp(777). And so on. So that teaches me to test, test, test, ... > > He told "A cautionary Tale of the Ariane 5", >=20 > Which has nothing to do with Java -- the software in question was written= in > Ada, which (unlike Java) has "Trap" style. Why he put it in a paper abou= t > Java is a bit of a mystery; I write it off to rhetorical excess. You are right it does not apply to Java. I guess he meant that as a warnin= g that changing to the other side might be equally bad. > > So do we want every Python program to bomb whenever there is a floating > > point value outside bound and is not trapped by try/except? >=20 > By default, yes, Guido does, but for overflow, not underflow. That's the harsh reality I have to live with, I suppose. <0.9wink> > If you read > the following section of Kahan's paper, you should have noticed that he i= s > *just* as critical of just returning Infs and NaNs (which is all Java doe= s, > and which is the accidental Python behavior you're arguing we keep in gli= bc) > as he is of just trapping! His conclusion: "Without Traps nor Flags, Ja= va=92 > s floating-point is Dangerous": >=20 > Without flags, detecting rare creations of Inf and NaN before they > disappear requires programmed tests and branches that, besides > duplicating tests already performed by the hardware, slow down the > program and impel a programmer to make decisions prematurely in many > cases. Worse, a plethora of tests and branches undermines a program= =92s > modularity, clarity and concurrency. >=20 > I agree with him there wholeheartedly: without the 754-mandated flags, > *and* without raising exceptions, the subset of 754 remaining sucks. That is true, but all these problems apply to "without raising flags", whether with or without "raising exceptions". Silent overflow forces programmers to do extra checking if they need to find them. Mandatory exception forces programmer to do extra checking if they don't want them to stop the program. Which is more common? It depends on programming style. In my programs, intentional NaN is far more than NaN by mistake. As to whether it is dangerous, I would say that if an overflow is really an error, good programming style requires that it be detected much earlier tha= n the actual overflow. I agree this cannot be expected of everyone, though. > >> ironically, 754 is hardest to sell to those who could benefit from > >> it the most. >=20 > > So far the only concern from number-crunchers voiced here is that it mi= ght > > allow sqrt(-1)=3D=3D0, which is not the case. >=20 > Gimme a break! In the very msg Paul Dubois said that, he also said "Some > people use Inf but most people want the code to STOP so they can find out > where the INFS started. Otherwise, two hours later you have big arrays o= f > Infs and no idea how it happened.". I'm starting to drop my assumption o= f > good faith on your part: what you remember and how you paraphrase (wheth= er > it's Paul or Kahan) is extremely selective, beyond normal bounds of > zeal-inspired distortion. Well, I was talking about whether anyone has shown a concern to oppose 754. I was not talking about whether exception is prefered to flags. See the line I was replying to? Actually, thinking about it, Paul was not talking about concerns over 754, either. So there appears zero resistence to 754 from number crunchers here. > > Obviously we agree on the benefit of having a choice. But we > > have different perspective on what choice means. Your want a choice > > to force user to take explicit action, I want a choice to ignore these > > events. >=20 > No. I want exactly the choices 754 lays out: user-settable sticky flags > and user-maskable exceptions. We're not getting that for 2.0. And we're > *never* getting it if 2.0 doesn't do *something* to start disabusing peop= le > of the notion that their historical numeric platform accidents in Python > will be faithfully preserved forever more. Let me make it clear that we agree on all essential points about full 754 support. The difference only exists in the period before that. Since both the 1.5.2 accidental behaviors and the one you want to unify to are just subsets of the full support, it does not appear to me that disabling severa= l of them is a prerequisite for the full support. > Kinda, except that each of the 5 754-defined traps must be individually > maskable. 754 spells out what's needed. A PEP will be required to spell > out the Python- and C-level APIs. I've corresponded (just -- no time now= ) a > little with Kevin Jacobs about that offline. Great! If the true IEEE 754 support could come soon, all my gripe is moot. So I'll stop disturbing you on the good work. :-) OK, I see that you want consistency above anything else before that good da= y comes. Well, consistency is good. Whether the price is too high is a subjective judgement. So I'll just use the -lieee hack for myself, then. [On presubstitution]=20 Ok, I found it. It looks good. [On whether 754 default uses flags or exceptions]=20 I agree with you: the system default matters very little as long as users can set their own defaults easily. =20 > I expect we'll have to make InvalidOperationError a subclass of ValueErro= r > for that reason, when 754 support materializes. That'll be handy. > > My favorite is returning 1j, as MatPy does. >=20 > Then you should use cmath.sqrt instead of math.sqrt.=20 Thanks. Huaiyu From skip@mojam.com (Skip Montanaro) Sat Oct 14 01:29:06 2000 From: skip@mojam.com (Skip Montanaro) (Skip Montanaro) Date: Fri, 13 Oct 2000 19:29:06 -0500 (CDT) Subject: [Python-Dev] Simple xml.sax example? Message-ID: <14823.43218.337621.157021@beluga.mojam.com> Is there a simple example available that demonstrates how to use elements of the new xml.sax package? I'd prefer something that doesn't require me to install anything other than what comes with the Python 2.0 distribution? Thanks, Skip From cbarker@jps.net Sat Oct 14 02:22:28 2000 From: cbarker@jps.net (Chris Barker) Date: Fri, 13 Oct 2000 18:22:28 -0700 Subject: [Python-Dev] RE: [Numpy-discussion] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) References: Message-ID: <39E7B554.29A168E3@jps.net> Incomplete vs. non-at-all IEEE 754 support is a non argument. If you have full IEEE support (which it seems everyone here thinks would be good, but difficult), it is clear what you have. If not, you are not consistent with a standard, and therefor making up your own. That being the case, it's a matter of what we want the Python standard to be. I, for one think that NaN and Inf are fantastic!!! I think the best argument for them here is that it is almost impossible to do a lot of array based calculations without them, and you can't do serious number crunching in Python without array based calculations. I've come to Python from MATLAB for numerics, and I really appreciated MATLAB's way of handling all this. I don't think MATLAB has true 754 support, as I don't think you can change the behaviour, but you do get a consistent result across platforms (including non-iee machines like the Cray?---I have no idea). I have not yet heard a decent response to the question of what to do when a single value in a large array is bad, and causes an exception. This really does render Python essentially useless for Numerics for me. I suspect all those number crunchers that want an exception rather than an Inf are NOT using array-oriented languages. My goal is to dump MATLAB for Python, but this may prevent me from doing that. Does anyone know what other array-oriented languages use? I know what MATLAB does: >> exp(-777) ans = 0 >> exp(777) ans = Inf >> sqrt(-1) ans = 0 + 1.0000i Hey! I like that! Python is dynamic, why can't we just get the actual answer to sqrt(-1), without using cmath, that always returns a complex ? sorry, other subjet, not meant to be raised at the moment. >> 54/0 Warning: Divide by zero. ans = Inf Here we get a warning, but also a result that won't crash the computation. >> a = 0/0 Warning: Divide by zero. a = NaN >> b = a b = NaN >> a == b ans = 0 So comparing two NaNs yields a false, as it should, and though Python won't do it now, it could. One thing that a numerical routine should NEVER do is give an incorrect answer. No answer is often bad, but an incorrect one is much worse. NaN == NaN must return false. Does anyone know what FORTRAN 90 specifies (if anything)? What other array-oriented languages are there? I think what MATLAB does is what Tim is calling "bad *and* incomplete 754 support" Incomplete is surely true, "bad" is clearly a matter of opinion. It seems we have a variety of users of numerics in Python, that I break into three broad catagories: Casual users: mostly doing non-numeric stuff, with the occasional calculation: This group could use any non-cryptic handling of over/underflow, it just doesn't matter. Mid-level number crunchers: This is the group I put myself in. We crunch a lot of numbers, really like the array semantics (and speed) of NumPy, and are doing things like graphing functions, statistical calculations, etc. We have probably only taken one of two (at most) numerical analysis courses, and many don't know what the heck IEE 754 is. (The one Numerical Analysis course I did take, happened to be with Kahan, which is why I know what it is) For this group, the incomplete IEEE support is probably the best way to go. We're more likely to be annoyed by our whole computation stopping because of one bad data point, than we are to be pissed off that it didn't stop when it started to compute garbage. Hard Core Number crunchers: These are the folks that do things like write optimised routines for particular architectures, adn teach numerical analysis courses. These folks want either FULL IEEE, or plain old "classic" overflow and underflow errors, that they can handle themselves. Do these folks really use Python as other than a glue language? Are they really doing massive number crunching in Python itself, rather than in C (or whatever) extensions? If so, I'd be surprised is they didn't find Huaiyu's argument compelling when doing array based calculations. Tim pointed out that Python was not designed with 754 in mind, so for 2.0, what he is doing is probably our best bet, but it seems to not be the best ultimate solution, I hope using NaN and Inf will be considered for future versions, even if it is incomplete 754 compliance. Note: if the ultimate goal is REAL IEEE 754 compliance, is it possible without custom re-compiling your own interpreter? If so, is there any chance that it will come any time soon (2.1 ?) , so we don't have to have this discussion at all? Thanks for all of your work on this, Python just keeps getting better!! -Chris -- Christopher Barker, Ph.D. cbarker@jps.net --- --- --- http://www.jps.net/cbarker -----@@ -----@@ -----@@ ------@@@ ------@@@ ------@@@ Water Resources Engineering ------ @ ------ @ ------ @ Coastal and Fluvial Hydrodynamics ------- --------- -------- ------------------------------------------------------------------------ ------------------------------------------------------------------------ From cgw@fnal.gov Sat Oct 14 03:44:42 2000 From: cgw@fnal.gov (Charles G Waldman) Date: Fri, 13 Oct 2000 21:44:42 -0500 (CDT) Subject: [Python-Dev] RE: [Numpy-discussion] RE: Possible bug (was Re: numpy, overflow, inf, ieee, and rich comparison) In-Reply-To: <39E7B554.29A168E3@jps.net> References: <39E7B554.29A168E3@jps.net> Message-ID: <14823.51354.977817.409017@buffalo.fnal.gov> Chris Barker writes: > Hey! I like that! Python is dynamic, why can't we just get the actual > answer to sqrt(-1), without using cmath, that always returns a complex ? You have to import the sqrt function from somewhere. Either you import it from math or from cmath, depending on which flavor you need. Anybody sophisticated enough to know what complex numbers are, and sophisticated enough to want to get complex values as a result of a calculation, should be sophisticated enough to be able to type "cmath". From larsga@garshol.priv.no Sat Oct 14 11:19:20 2000 From: larsga@garshol.priv.no (Lars Marius Garshol) Date: 14 Oct 2000 12:19:20 +0200 Subject: [Python-Dev] Simple xml.sax example? In-Reply-To: <14823.43218.337621.157021@beluga.mojam.com> References: <14823.43218.337621.157021@beluga.mojam.com> Message-ID: * Skip Montanaro | | Is there a simple example available that demonstrates how to use | elements of the new xml.sax package? Here are a couple from an internal seminar I recently gave on this. I could make the slides available as well, if there is interest. --Lars M. --- elem_count.py import sys from xml.sax import make_parser, handler class FancyCounter(handler.ContentHandler): def __init__(self): self._elems = 0 self._attrs = 0 self._elem_types = {} self._attr_types = {} def startElement(self, name, attrs): self._elems = self._elems + 1 self._attrs = self._attrs + len(attrs) self._elem_types[name] = self._elem_types.get(name, 0) + 1 for name in attrs.keys(): self._attr_types[name] = self._attr_types.get(name, 0) + 1 def endDocument(self): print "There were", self._elems, "elements." print "There were", self._attrs, "attributes." print "---ELEMENT TYPES" for pair in self._elem_types.items(): print "%20s %d" % pair print "---ATTRIBUTE TYPES" for pair in self._attr_types.items(): print "%20s %d" % pair parser = make_parser() parser.setContentHandler(FancyCounter()) parser.parse(sys.argv[1]) --- roundtrip.py """ A simple demo that reads in an XML document and spits out an equivalent, but not necessarily identical, document. """ import sys, string from xml.sax import saxutils, handler, make_parser # --- The ContentHandler class ContentGenerator(handler.ContentHandler): def __init__(self, out = sys.stdout): handler.ContentHandler.__init__(self) self._out = out # ContentHandler methods def startDocument(self): self._out.write('\n') def startElement(self, name, attrs): self._out.write('<' + name) for (name, value) in attrs.items(): self._out.write(' %s="%s"' % (name, saxutils.escape(value))) self._out.write('>') def endElement(self, name): self._out.write('' % name) def characters(self, content): self._out.write(saxutils.escape(content)) def ignorableWhitespace(self, content): self._out.write(content) def processingInstruction(self, target, data): self._out.write('' % (target, data)) # --- The main program parser = make_parser() parser.setContentHandler(ContentGenerator()) parser.parse(sys.argv[1]) --- rss2html.py import sys from xml.sax import make_parser, handler # --- Templates top = \ """ %s %s """ bottom = \ """ Converted to HTML by sax_rss2html.py. """ # --- The ContentHandler class RSSHandler(handler.ContentHandler): def __init__(self, out = sys.stdout): handler.ContentHandler.__init__(self) self._out = out self._text = "" self._parent = None self._list_started = 0 self._title = None self._link = None self._descr = "" # ContentHandler methods def startElement(self, name, attrs): if name == "channel" or name == "image" or name == "item": self._parent = name self._text = "" def endElement(self, name): if self._parent == "channel": if name == "title": self._out.write(top % (self._text, self._text)) elif name == "description": self._out.write("

%s

\n" % self._text) elif self._parent == "item": if name == "title": self._title = self._text elif name == "link": self._link = self._text elif name == "description": self._descr = self._text elif name == "item": if not self._list_started: self._out.write("

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4