From nascheme@users.sourceforge.net Sun Jun 1 20:21:16 2003 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Sun, 01 Jun 2003 12:21:16 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.364,2.365 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv16830/Python Modified Files: ceval.c Log Message: Use fast_next_opcode shortcut for forward jump opcodes (it's safe and gives a small speedup). Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.364 retrieving revision 2.365 diff -C2 -d -r2.364 -r2.365 *** ceval.c 31 May 2003 07:04:16 -0000 2.364 --- ceval.c 1 Jun 2003 19:21:12 -0000 2.365 *************** *** 2002,2006 **** case JUMP_FORWARD: JUMPBY(oparg); ! continue; PREDICTED_WITH_ARG(JUMP_IF_FALSE); --- 2002,2006 ---- case JUMP_FORWARD: JUMPBY(oparg); ! goto fast_next_opcode; PREDICTED_WITH_ARG(JUMP_IF_FALSE); *************** *** 2009,2017 **** if (w == Py_True) { PREDICT(POP_TOP); ! continue; } if (w == Py_False) { JUMPBY(oparg); ! continue; } err = PyObject_IsTrue(w); --- 2009,2017 ---- if (w == Py_True) { PREDICT(POP_TOP); ! goto fast_next_opcode; } if (w == Py_False) { JUMPBY(oparg); ! goto fast_next_opcode; } err = PyObject_IsTrue(w); *************** *** 2029,2037 **** if (w == Py_False) { PREDICT(POP_TOP); ! continue; } if (w == Py_True) { JUMPBY(oparg); ! continue; } err = PyObject_IsTrue(w); --- 2029,2037 ---- if (w == Py_False) { PREDICT(POP_TOP); ! goto fast_next_opcode; } if (w == Py_True) { JUMPBY(oparg); ! goto fast_next_opcode; } err = PyObject_IsTrue(w); From jackjansen@users.sourceforge.net Sun Jun 1 20:27:43 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 01 Jun 2003 12:27:43 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils unixccompiler.py,1.53,1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv19302 Modified Files: unixccompiler.py Log Message: Fixed indentation error. Closes bug #746953. Index: unixccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/unixccompiler.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** unixccompiler.py 31 May 2003 08:09:21 -0000 1.53 --- unixccompiler.py 1 Jun 2003 19:27:40 -0000 1.54 *************** *** 204,210 **** # MacOSX's linker doesn't understand the -R flag at all return "-L" + dir ! elif sys.platform[:5] == "hp-ux": return "+s -L" + dir ! elif compiler[:3] == "gcc" or compiler[:3] == "g++": return "-Wl,-R" + dir else: --- 204,210 ---- # MacOSX's linker doesn't understand the -R flag at all return "-L" + dir ! elif sys.platform[:5] == "hp-ux": return "+s -L" + dir ! elif compiler[:3] == "gcc" or compiler[:3] == "g++": return "-Wl,-R" + dir else: From jackjansen@users.sourceforge.net Sun Jun 1 21:03:45 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 01 Jun 2003 13:03:45 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac pimp.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv671/Lib/plat-mac Modified Files: pimp.py Log Message: Use splitlines() in stead of split() to split lines, and added a method shortdescription() so the code to split off the first line of the description isn't all over the place. Index: pimp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** pimp.py 29 May 2003 22:07:27 -0000 1.23 --- pimp.py 1 Jun 2003 20:03:40 -0000 1.24 *************** *** 392,395 **** --- 392,396 ---- def flavor(self): return self._dict.get('Flavor') def description(self): return self._dict['Description'].strip() + def shortdescription(self): return self.description().splitlines()[0] def homepage(self): return self._dict.get('Home-page') def downloadURL(self): return self._dict.get('Download-URL') *************** *** 501,505 **** descr = "Requires unknown %s"%name else: ! descr = pkg.description() rv.append((pkg, descr)) return rv --- 502,506 ---- descr = "Requires unknown %s"%name else: ! descr = pkg.shortdescription() rv.append((pkg, descr)) return rv *************** *** 826,830 **** pkg = db.find(pkgname) if pkg: ! description = pkg.description().split('\r\n')[0] pkgname = pkg.fullname() else: --- 827,831 ---- pkg = db.find(pkgname) if pkg: ! description = pkg.shortdescription() pkgname = pkg.fullname() else: *************** *** 838,842 **** pass description = pkg.description() ! description = '\n\t\t\t\t\t'.join(description.split('\r\n')) print "\tDescription:\t%s" % description elif mode =='status': --- 839,843 ---- pass description = pkg.description() ! description = '\n\t\t\t\t\t'.join(description.splitlines()) print "\tDescription:\t%s" % description elif mode =='status': From jackjansen@users.sourceforge.net Sun Jun 1 21:03:45 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 01 Jun 2003 13:03:45 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PackageManager.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv671/Mac/Tools/IDE Modified Files: PackageManager.py Log Message: Use splitlines() in stead of split() to split lines, and added a method shortdescription() so the code to split off the first line of the description isn't all over the place. Index: PackageManager.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PackageManager.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PackageManager.py 29 May 2003 22:07:27 -0000 1.11 --- PackageManager.py 1 Jun 2003 20:03:43 -0000 1.12 *************** *** 386,390 **** self.w.homepage_button.enable(not not self.packages[sel].homepage()) description = self.packages[sel].description() ! description = description.split('\r\n') description = '\r'.join(description) self.w.description.set(description) --- 386,390 ---- self.w.homepage_button.enable(not not self.packages[sel].homepage()) description = self.packages[sel].description() ! description = description.splitlines() description = '\r'.join(description) self.w.description.set(description) From jackjansen@users.sourceforge.net Sun Jun 1 21:57:15 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 01 Jun 2003 13:57:15 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac pimp.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv21274 Modified Files: pimp.py Log Message: Added two keys to database format: User-install-skips is an array of pathname prefixes, any file that is skipped during a per-user install that matches this set is *not* an error; Systemwide-only is a boolean that says the package cannot be installer per-user. Index: pimp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** pimp.py 1 Jun 2003 20:03:40 -0000 1.24 --- pimp.py 1 Jun 2003 20:57:12 -0000 1.25 *************** *** 79,83 **** self._renames = renames ! def unpack(self, archive, output=None): return None --- 79,83 ---- self._renames = renames ! def unpack(self, archive, output=None, package=None): return None *************** *** 87,91 **** _can_rename = False ! def unpack(self, archive, output=None): cmd = self.argument % archive if _cmd(output, self._dir, cmd): --- 87,91 ---- _can_rename = False ! def unpack(self, archive, output=None, package=None): cmd = self.argument % archive if _cmd(output, self._dir, cmd): *************** *** 97,101 **** _can_rename = True ! def unpack(self, archive, output=None): tf = tarfile.open(archive, "r") members = tf.getmembers() --- 97,101 ---- _can_rename = True ! def unpack(self, archive, output=None, package=None): tf = tarfile.open(archive, "r") members = tf.getmembers() *************** *** 133,139 **** if skip: names = [member.name for member in skip if member.name[-1] != '/'] if names: return "Not all files were unpacked: %s" % " ".join(names) ! ARCHIVE_FORMATS = [ (".tar.Z", PimpTarUnpacker, None), --- 133,141 ---- if skip: names = [member.name for member in skip if member.name[-1] != '/'] + if package: + names = package.filterExpectedSkips(names) if names: return "Not all files were unpacked: %s" % " ".join(names) ! ARCHIVE_FORMATS = [ (".tar.Z", PimpTarUnpacker, None), *************** *** 181,184 **** --- 183,189 ---- self.installLocations = [] self.installDir = installDir + + def isUserInstall(self): + return self.installDir != DEFAULT_INSTALLDIR def check(self): *************** *** 371,375 **** "Post-install-command", "Prerequisites", ! "MD5Sum" ] --- 376,382 ---- "Post-install-command", "Prerequisites", ! "MD5Sum", ! "User-install-skips", ! "Systemwide-only", ] *************** *** 395,398 **** --- 402,406 ---- def homepage(self): return self._dict.get('Home-page') def downloadURL(self): return self._dict.get('Download-URL') + def systemwideOnly(self): return self._dict.get('Systemwide-only') def fullname(self): *************** *** 486,489 **** --- 494,501 ---- "%s: This package cannot be installed automatically (no Download-URL field)" % self.fullname())] + if self.systemwideOnly() and self._db.preferences.isUserInstall(): + return [(None, + "%s: This package can only be installed system-wide" % + self.fullname())] if not self._dict.get('Prerequisites'): return [] *************** *** 618,621 **** --- 630,649 ---- sys.path.append(line) + def filterExpectedSkips(self, names): + """Return a list that contains only unpexpected skips""" + if not self._db.preferences.isUserInstall(): + return names + expected_skips = self._dict.get('User-install-skips') + if not expected_skips: + return names + newnames = [] + for name in names: + for skip in expected_skips: + if name[:len(skip)] == skip: + break + else: + newnames.append(name) + return newnames + class PimpPackage_binary(PimpPackage): *************** *** 660,664 **** unpacker = unpackerClass(arg, dir="/", renames=install_renames) ! rv = unpacker.unpack(self.archiveFilename, output=output) if rv: return rv --- 688,692 ---- unpacker = unpackerClass(arg, dir="/", renames=install_renames) ! rv = unpacker.unpack(self.archiveFilename, output=output, package=self) if rv: return rv From gward@users.sourceforge.net Sun Jun 1 22:48:20 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sun, 01 Jun 2003 14:48:20 -0700 Subject: [Python-checkins] python/nondist/sandbox/audiotest - New directory Message-ID: Update of /cvsroot/python/python/nondist/sandbox/audiotest In directory sc8-pr-cvs1:/tmp/cvs-serv6105/audiotest Log Message: Directory /cvsroot/python/python/nondist/sandbox/audiotest added to the repository From gward@users.sourceforge.net Sun Jun 1 22:49:13 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sun, 01 Jun 2003 14:49:13 -0700 Subject: [Python-checkins] python/nondist/sandbox/audiotest Makefile,NONE,1.1 audiotest.c,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/audiotest In directory sc8-pr-cvs1:/tmp/cvs-serv6377 Added Files: Makefile audiotest.c Log Message: Initial checkin of pure C OSS test program. --- NEW FILE: Makefile --- CC = gcc CFLAGS = -g -Wall audiotest: audiotest.o $(CC) -o $@ -lm $< clean: rm audiotest *.o --- NEW FILE: audiotest.c --- /* * Pure C OSS test program. Useful as a quick sanity check to make * sure that the audio hardware and device driver are behaving * correctly when the ossaudiodev module is not. * * GPW 2003/03/11 * * $Id: audiotest.c,v 1.1 2003/06/01 21:49:10 gward Exp $ */ #include #include #include #include #include #include #include #include #include #include #include #include #include typedef struct { char * name; /* eg. "/dev/dsp" */ int fd; /* fd returned by open() */ } audiodev_t; /* Describes audio sampling parameters: needed to initialize audio * hardware, and to generate a buffer. */ typedef struct { int rate; /* sampling rate in Hz */ int size; /* sample size in bits (8 or 16) */ int sign; /* are sample values signed? */ } audiosample_t; /* Describes physical characteristics of an audio signal such as a * sine wave. */ typedef struct { int freq; /* frequency of signal in Hz */ double ampl; /* amplitude of signal (0.0 .. 1.0) */ double dur; /* duration of signal in sec */ } audiosignal_t; /* A buffer containing an audio signal ready to play (assuming the hardware * has been initialized with the right sampling parameters). */ typedef struct { audiosample_t * sample; audiosignal_t * signal; int cycle_len; /* number of samples in a cycle */ int buff_len; /* number of samples in buff */ int buff_size; /* size of buff in bytes */ char * buff; } audiobuffer_t; static void writenow (char *fmt, ...) { va_list args; va_start(args, fmt); vfprintf(stdout, fmt, args); va_end(args); fflush(stdout); } static void error (char *fmt, ...) { va_list args; va_start(args, fmt); fprintf(stderr, "audiotest: error: "); vfprintf(stderr, fmt, args); fputc('\n', stderr); va_end(args); exit(1); } static void _sampling_ioctl (audiodev_t * device, char * param, int cmd, int value) { int requested_value = value; if (ioctl(device->fd, cmd, &value) == -1) error("%s: unable to set %s: %s", device->name, param, strerror(errno)); if (value != requested_value) error("%s: unable to set %s to %d (got %d)", device->name, param, requested_value, value); } static void setparameters (audiodev_t * device, audiosample_t * sample) { int fmt; if (sample->size == 8) { if (sample->sign) fmt = AFMT_S8; else fmt = AFMT_U8; } else if (sample->size == 16) { if (sample->sign) fmt = AFMT_S16_LE; /* XXX not handling endianness */ else fmt = AFMT_U16_LE; } _sampling_ioctl(device, "sample format", SNDCTL_DSP_SETFMT, fmt); _sampling_ioctl(device, "number of channels", SNDCTL_DSP_CHANNELS, 1); _sampling_ioctl(device, "sampling rate", SNDCTL_DSP_SPEED, sample->rate); } static void sync_audio (audiodev_t * device) { if (ioctl(device->fd, SNDCTL_DSP_SYNC, 0) == -1) error("%s: unable to sync: %s", device->name, strerror(errno)); } static audiosample_t * mksample (int rate, int size, int sign) { audiosample_t * sample; /* sanity-check args */ if (rate < 1 || rate > 1000000) return NULL; if (size % 8 != 0) return NULL; sample = (audiosample_t *) malloc(sizeof(audiosample_t)); sample->rate = rate; sample->size = size; sample->sign = sign; return sample; } static void printsample(FILE * f, audiosample_t * sample) { fprintf(f, "", sample, sample->rate, sample->size, (sample->sign ? 'Y' : 'N')); } static void freesample (audiosample_t * sample) { free(sample); } static audiosignal_t * mksignal (int freq, double ampl, double dur) { audiosignal_t * signal; if (freq < 1 || freq > 100000) return NULL; if (ampl < 0.0 || ampl > 1.0) return NULL; if (dur < 0 || dur > 3600) return NULL; signal = (audiosignal_t *) malloc(sizeof(audiosignal_t)); signal->freq = freq; signal->ampl = ampl; signal->dur = dur; return signal; } static void printsignal(FILE * f, audiosignal_t * signal) { fprintf(f, "", signal, signal->freq, signal->ampl, signal->dur); } static void freesignal (audiosignal_t * signal) { free(signal); } static audiobuffer_t * mkbuffer (audiosample_t * sample, audiosignal_t * signal) { audiobuffer_t * buffer = (audiobuffer_t *) malloc(sizeof(audiobuffer_t)); buffer->sample = sample; buffer->signal = signal; buffer->cycle_len = sample->rate / signal->freq; buffer->buff_len = sample->rate * signal->dur; buffer->buff_size = buffer->buff_len * sample->size / 8; buffer->buff = (char *) malloc(buffer->buff_size); memset(buffer->buff, 0, buffer->buff_size); return buffer; } static void printbuffer (FILE * f, audiobuffer_t * buffer) { fprintf(f, "", buffer, buffer->cycle_len, buffer->buff_len, buffer->buff_size); } static void dumpbuffer (FILE * f, audiobuffer_t * buffer) { printbuffer(f, buffer); fputc('\n', f); fprintf(f, " sample: "); printsample(f, buffer->sample); fputc('\n', f); fprintf(f, " signal: "); printsignal(f, buffer->signal); fputc('\n', f); } static void freebuffer (audiobuffer_t * buffer) { free(buffer->buff); free(buffer); } static void gen_sine (audiobuffer_t * buffer) { double step; int offset; int i; /* Fill the first cycle of the buffer. */ step = 2*M_PI / buffer->cycle_len; offset = 0; /* offset into buff */ for (i = 0; i < buffer->cycle_len; i++) { double val_f; //int val_i; assert(offset < buffer->buff_len); val_f = buffer->signal->ampl * sin(i * step); if (buffer->sample->size == 8) { /* first, convert for signed 8-bit: -1.0 .. 1.0 -> -128 .. 127 (0x80 .. 0x7f) */ int val = (int) floor(val_f * 128); if (val == 128) /* clamp 1.0 down to 127 */ val--; /* store, or adjust-and-store */ if (buffer->sample->sign) buffer->buff[offset] = (signed char) val; else { val += 128; /* -128 .. 127 -> 0 .. 255 */ buffer->buff[offset] = (unsigned char) val; } offset += 1; } else if (buffer->sample->size == 16) { int val = (int) floor(val_f * 32768); if (val == 32768) val--; if (buffer->sample->sign) { ((short *) buffer->buff)[offset] = (signed short) val; } else { val += 32768; ((short *) buffer->buff)[offset] = (unsigned short) val; } offset += 2; } } /* Now duplicate that data until 'buff' is full. */ while (offset < buffer->buff_size) { for (i = 0; i < buffer->cycle_len; i++) { buffer->buff[offset++] = buffer->buff[i]; if (offset == buffer->buff_size) break; } } } static void wait_user (int i, char * description) { char buf[2]; fprintf(stdout, "test %d: %s: press enter", i, description); fflush(stdout); fgets(buf, 2, stdin); return; } static void test_one_tone (int testnum, audiosample_t * sample, audiodev_t * device) { audiosignal_t * signal; audiobuffer_t * buffer; int nbytes; signal = mksignal(1000, 0.75, 1.0); buffer = mkbuffer(sample, signal); gen_sine(buffer); wait_user(testnum, "1 kHz sine wave, ampl 0.75, 1 sec"); nbytes = write(device->fd, buffer->buff, buffer->buff_size); sync_audio(device); writenow("%d bytes played\n", nbytes); freesignal(signal); freebuffer(buffer); } static void test_two_tones (int testnum, audiosample_t * sample, audiodev_t * device) { audiosignal_t * signal1, * signal2; audiobuffer_t * buffer1, * buffer2; int nbytes; signal1 = mksignal(523, 0.75, 1.0); signal2 = mksignal(523*2, 0.75, 1.0); buffer1 = mkbuffer(sample, signal1); buffer2 = mkbuffer(sample, signal2); gen_sine(buffer1); gen_sine(buffer2); wait_user(testnum, "middle C (523 Hz) for 1 sec, then jump an octave"); nbytes = write(device->fd, buffer1->buff, buffer1->buff_size); nbytes += write(device->fd, buffer2->buff, buffer2->buff_size); sync_audio(device); writenow("%d bytes played\n", nbytes); freesignal(signal1); freesignal(signal2); freebuffer(buffer1); freebuffer(buffer2); } static void play_scale (audiodev_t * device, audiobuffer_t *buffers[], int nbuffers) { int i; int nbytes = 0; writenow("frequencies: "); for (i = 0; i < nbuffers; i++) { writenow("%d ", buffers[i]->signal->freq); nbytes += write(device->fd, buffers[i]->buff, buffers[i]->buff_size); sync_audio(device); } //sync_audio(device); writenow("%d bytes played\n", nbytes); } static void free_buffers (audiobuffer_t *buffers[], int nbuffers) { int i; for (i = 0; i < nbuffers; i++) { freesignal(buffers[i]->signal); freebuffer(buffers[i]); } } static void test_chromatic (int testnum, audiosample_t * sample, audiodev_t * device) { audiosignal_t * signal; audiobuffer_t * buffers[13]; int i; double factor = pow(2, (float) 1/12); double freq = 523.25; /* middle C */ /* First create all the buffers */ for (i = 0; i < 13; i++) { signal = mksignal((int) rint(freq), 0.75, 0.5); /*printf("generating signal %d: ", i); printsignal(stdout, signal); fputc('\n', stdout);*/ buffers[i] = mkbuffer(sample, signal); gen_sine(buffers[i]); freq *= factor; } /* Now play them all, ie. play the chromatic scale. */ wait_user(testnum, "chromatic (12-tone) scale from middle C, 0.5 sec per note"); play_scale(device, buffers, 13); /* And free everything up. */ free_buffers(buffers, 13); } static void test_major_scale (int testnum, audiosample_t * sample, audiodev_t * device) { audiosignal_t * signal; audiobuffer_t * buffers[8]; int i; double factor = pow(2, (float) 1/12); double steps[] = { factor*factor, factor*factor, factor, factor*factor, factor*factor, factor*factor, factor }; double freq = 523.25; /* middle C */ /* Generating the samples is a bit trickier for a major scale then for a chromatic scale, because it's not a simple geometric progression. The rule is: W W H W W W H where W is a whole step (freq*factor*factor) and H is a half-step (freq*factor). */ for (i = 0; i < 8; i++) { signal = mksignal((int) rint(freq), 0.75, 0.5); buffers[i] = mkbuffer(sample, signal); gen_sine(buffers[i]); if (i < 7) freq *= steps[i]; } /* Play the scale and free it all up. */ wait_user(testnum, "C-major scale, 0.5 sec per note"); play_scale(device, buffers, 8); free_buffers(buffers, 8); } static void run_tests (audiodev_t * device) { audiosample_t * sample; int testnum = 1; /* Lowest-common denominator sampling parameters for now: unsigned mono 8-bit samples at 8000 samples/sec. */ sample = mksample(8000, 8, 0); setparameters(device, sample); /* First test: simple 1kHz tone */ test_one_tone(testnum++, sample, device); /* Second test: middle C (523 Hz), then jump an octave. */ test_two_tones(testnum++, sample, device); /* For playing scales, 8000 samples/sec isn't good enough. Hopefully most hardware can support 32000! */ sample->rate = 32000; setparameters(device, sample); /* Third test: chromatic (12-tone) scale, starting at middle C */ test_chromatic(testnum++, sample, device); /* Fourth test: C-major scale */ test_major_scale(testnum++, sample, device); } int main (int argc, char **argv) { audiodev_t device; char usage[] = "usage: audiotest [device]\n"; if (argc == 1) { /* no args */ device.name = "/dev/dsp"; } else if (argc == 2) { /* one arg */ device.name = argv[1]; } else { fprintf(stderr, usage); exit(1); } printf("opening %s ...", device.name); fflush(stdout); device.fd = open(device.name, O_WRONLY, 0); if (device.fd == -1) { printf(" failed\n"); perror(device.name); exit(2); } printf(" done\n"); run_tests(&device); return 0; } From gward@users.sourceforge.net Sun Jun 1 22:51:21 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sun, 01 Jun 2003 14:51:21 -0700 Subject: [Python-checkins] python/nondist/sandbox/audiotest audiotest.c,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/audiotest In directory sc8-pr-cvs1:/tmp/cvs-serv7091 Modified Files: audiotest.c Log Message: Free 'sample' object when done with it. Move printing/dumping functions into an #ifdef'd out block (to avoid compiler warnings). Index: audiotest.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/audiotest/audiotest.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** audiotest.c 1 Jun 2003 21:49:10 -0000 1.1 --- audiotest.c 1 Jun 2003 21:51:18 -0000 1.2 *************** *** 148,158 **** static void - printsample(FILE * f, audiosample_t * sample) - { - fprintf(f, "", - sample, sample->rate, sample->size, (sample->sign ? 'Y' : 'N')); - } - - static void freesample (audiosample_t * sample) { --- 148,151 ---- *************** *** 180,190 **** static void - printsignal(FILE * f, audiosignal_t * signal) - { - fprintf(f, "", - signal, signal->freq, signal->ampl, signal->dur); - } - - static void freesignal (audiosignal_t * signal) { --- 173,176 ---- *************** *** 207,210 **** --- 193,212 ---- } + /* Debugging stuff: ifdef'd out to avoid compiler warnings */ + #ifdef DEBUG + static void + printsample(FILE * f, audiosample_t * sample) + { + fprintf(f, "", + sample, sample->rate, sample->size, (sample->sign ? 'Y' : 'N')); + } + + static void + printsignal(FILE * f, audiosignal_t * signal) + { + fprintf(f, "", + signal, signal->freq, signal->ampl, signal->dur); + } + static void printbuffer (FILE * f, audiobuffer_t * buffer) *************** *** 228,231 **** --- 230,234 ---- fputc('\n', f); } + #endif static void *************** *** 477,480 **** --- 480,485 ---- test_major_scale(testnum++, sample, device); + + freesample(sample); } From gward@users.sourceforge.net Sun Jun 1 22:56:21 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sun, 01 Jun 2003 14:56:21 -0700 Subject: [Python-checkins] python/nondist/sandbox/audiotest audiotest.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/audiotest In directory sc8-pr-cvs1:/tmp/cvs-serv8496 Modified Files: audiotest.c Log Message: Close the audio device when we're done with it. Index: audiotest.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/audiotest/audiotest.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** audiotest.c 1 Jun 2003 21:51:18 -0000 1.2 --- audiotest.c 1 Jun 2003 21:56:19 -0000 1.3 *************** *** 513,516 **** --- 513,518 ---- run_tests(&device); + + close(device.fd); return 0; } From gvanrossum@users.sourceforge.net Mon Jun 2 15:11:48 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 02 Jun 2003 07:11:48 -0700 Subject: [Python-checkins] python/dist/src/Modules ossaudiodev.c,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv7096 Modified Files: ossaudiodev.c Log Message: Fix a subtle decref bug that caused a GC assertion to fail in a debug build (assert(gc->gc.gc_refs != 0) in visit_decref()). Because OSSAudioError is a global, we must compensate (twice!) for PyModule_AddObject()'s "helpful" decref of the object it adds. Index: ossaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** ossaudiodev.c 29 May 2003 23:44:44 -0000 1.32 --- ossaudiodev.c 2 Jun 2003 14:11:45 -0000 1.33 *************** *** 939,942 **** --- 939,945 ---- OSSAudioError = PyErr_NewException("ossaudiodev.OSSAudioError", NULL, NULL); if (OSSAudioError) { + /* Each call to PyModule_AddObject decrefs it; compensate: */ + Py_INCREF(OSSAudioError); + Py_INCREF(OSSAudioError); PyModule_AddObject(m, "error", OSSAudioError); PyModule_AddObject(m, "OSSAudioError", OSSAudioError); From gvanrossum@users.sourceforge.net Mon Jun 2 15:15:37 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 02 Jun 2003 07:15:37 -0700 Subject: [Python-checkins] python/dist/src/Modules ossaudiodev.c,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv8856 Modified Files: ossaudiodev.c Log Message: Whitespace normalization; break a long line. Index: ossaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** ossaudiodev.c 2 Jun 2003 14:11:45 -0000 1.33 --- ossaudiodev.c 2 Jun 2003 14:15:34 -0000 1.34 *************** *** 10,14 **** * by Greg Ward , November 2002. * Mixer interface by Nicholas FitzRoy-Dale , Dec 2002. ! * * (c) 2000 Peter Bosch. All Rights Reserved. * (c) 2002 Gregory P. Ward. All Rights Reserved. --- 10,14 ---- * by Greg Ward , November 2002. * Mixer interface by Nicholas FitzRoy-Dale , Dec 2002. ! * * (c) 2000 Peter Bosch. All Rights Reserved. * (c) 2002 Gregory P. Ward. All Rights Reserved. *************** *** 162,170 **** int fd; oss_mixer_t *self; ! if (!PyArg_ParseTuple(arg, "|s", &basedev)) { return NULL; } ! if (basedev == NULL) { basedev = getenv("MIXERDEV"); --- 162,170 ---- int fd; oss_mixer_t *self; ! if (!PyArg_ParseTuple(arg, "|s", &basedev)) { return NULL; } ! if (basedev == NULL) { basedev = getenv("MIXERDEV"); *************** *** 182,188 **** return NULL; } ! self->fd = fd; ! return self; } --- 182,188 ---- return NULL; } ! self->fd = fd; ! return self; } *************** *** 341,345 **** return _do_ioctl_0(self->fd, args, "sync", SNDCTL_DSP_SYNC); } ! static PyObject * oss_reset(oss_audio_t *self, PyObject *args) --- 341,345 ---- return _do_ioctl_0(self->fd, args, "sync", SNDCTL_DSP_SYNC); } ! static PyObject * oss_reset(oss_audio_t *self, PyObject *args) *************** *** 347,351 **** return _do_ioctl_0(self->fd, args, "reset", SNDCTL_DSP_RESET); } ! static PyObject * oss_post(oss_audio_t *self, PyObject *args) --- 347,351 ---- return _do_ioctl_0(self->fd, args, "reset", SNDCTL_DSP_RESET); } ! static PyObject * oss_post(oss_audio_t *self, PyObject *args) *************** *** 364,368 **** char *cp; PyObject *rv; ! if (!PyArg_ParseTuple(args, "i:read", &size)) return NULL; --- 364,368 ---- char *cp; PyObject *rv; ! if (!PyArg_ParseTuple(args, "i:read", &size)) return NULL; *************** *** 415,419 **** fd_set write_set_fds; int select_rv; ! /* NB. writeall() is only useful in non-blocking mode: according to Guenter Geiger on the linux-audio-dev list --- 415,419 ---- fd_set write_set_fds; int select_rv; ! /* NB. writeall() is only useful in non-blocking mode: according to Guenter Geiger on the linux-audio-dev list *************** *** 423,427 **** indistinguishable. */ ! if (!PyArg_ParseTuple(args, "s#:write", &cp, &size)) return NULL; --- 423,427 ---- indistinguishable. */ ! if (!PyArg_ParseTuple(args, "s#:write", &cp, &size)) return NULL; *************** *** 476,480 **** oss_fileno(oss_audio_t *self, PyObject *args) { ! if (!PyArg_ParseTuple(args, ":fileno")) return NULL; return PyInt_FromLong(self->fd); --- 476,480 ---- oss_fileno(oss_audio_t *self, PyObject *args) { ! if (!PyArg_ParseTuple(args, ":fileno")) return NULL; return PyInt_FromLong(self->fd); *************** *** 529,533 **** wanted_rate, rate); } ! /* Construct the return value: a (fmt, channels, rate) tuple that tells what the audio hardware was actually set to. */ --- 529,533 ---- wanted_rate, rate); } ! /* Construct the return value: a (fmt, channels, rate) tuple that tells what the audio hardware was actually set to. */ *************** *** 547,551 **** fmt = 0; ! if (ioctl(self->fd, SNDCTL_DSP_SETFMT, &fmt) < 0) return -errno; --- 547,551 ---- fmt = 0; ! if (ioctl(self->fd, SNDCTL_DSP_SETFMT, &fmt) < 0) return -errno; *************** *** 575,579 **** ! /* bufsize returns the size of the hardware audio buffer in number of samples */ static PyObject * --- 575,579 ---- ! /* bufsize returns the size of the hardware audio buffer in number of samples */ static PyObject * *************** *** 596,600 **** } ! /* obufcount returns the number of samples that are available in the hardware for playing */ static PyObject * --- 596,600 ---- } ! /* obufcount returns the number of samples that are available in the hardware for playing */ static PyObject * *************** *** 615,619 **** return NULL; } ! return PyInt_FromLong((ai.fragstotal * ai.fragsize - ai.bytes) / (ssize * nchannels)); } --- 615,619 ---- return NULL; } ! return PyInt_FromLong((ai.fragstotal * ai.fragsize - ai.bytes) / (ssize * nchannels)); } *************** *** 649,653 **** if (!PyArg_ParseTuple(args, ":getptr")) return NULL; ! if (self->mode == O_RDONLY) req = SNDCTL_DSP_GETIPTR; --- 649,653 ---- if (!PyArg_ParseTuple(args, ":getptr")) return NULL; ! if (self->mode == O_RDONLY) req = SNDCTL_DSP_GETIPTR; *************** *** 683,687 **** oss_mixer_fileno(oss_mixer_t *self, PyObject *args) { ! if (!PyArg_ParseTuple(args, ":fileno")) return NULL; return PyInt_FromLong(self->fd); --- 683,687 ---- oss_mixer_fileno(oss_mixer_t *self, PyObject *args) { ! if (!PyArg_ParseTuple(args, ":fileno")) return NULL; return PyInt_FromLong(self->fd); *************** *** 715,731 **** { int channel, volume; ! /* Can't use _do_ioctl_1 because of encoded arg thingy. */ if (!PyArg_ParseTuple(args, "i:get", &channel)) return NULL; ! if (channel < 0 || channel > SOUND_MIXER_NRDEVICES) { PyErr_SetString(OSSAudioError, "Invalid mixer channel specified."); return NULL; } ! if (ioctl(self->fd, MIXER_READ(channel), &volume) == -1) return PyErr_SetFromErrno(PyExc_IOError); ! return Py_BuildValue("(ii)", volume & 0xff, (volume & 0xff00) >> 8); } --- 715,731 ---- { int channel, volume; ! /* Can't use _do_ioctl_1 because of encoded arg thingy. */ if (!PyArg_ParseTuple(args, "i:get", &channel)) return NULL; ! if (channel < 0 || channel > SOUND_MIXER_NRDEVICES) { PyErr_SetString(OSSAudioError, "Invalid mixer channel specified."); return NULL; } ! if (ioctl(self->fd, MIXER_READ(channel), &volume) == -1) return PyErr_SetFromErrno(PyExc_IOError); ! return Py_BuildValue("(ii)", volume & 0xff, (volume & 0xff00) >> 8); } *************** *** 735,748 **** { int channel, volume, leftVol, rightVol; ! /* Can't use _do_ioctl_1 because of encoded arg thingy. */ if (!PyArg_ParseTuple(args, "i(ii):set", &channel, &leftVol, &rightVol)) return NULL; ! if (channel < 0 || channel > SOUND_MIXER_NRDEVICES) { PyErr_SetString(OSSAudioError, "Invalid mixer channel specified."); return NULL; } ! if (leftVol < 0 || rightVol < 0 || leftVol > 100 || rightVol > 100) { PyErr_SetString(OSSAudioError, "Volumes must be between 0 and 100."); --- 735,748 ---- { int channel, volume, leftVol, rightVol; ! /* Can't use _do_ioctl_1 because of encoded arg thingy. */ if (!PyArg_ParseTuple(args, "i(ii):set", &channel, &leftVol, &rightVol)) return NULL; ! if (channel < 0 || channel > SOUND_MIXER_NRDEVICES) { PyErr_SetString(OSSAudioError, "Invalid mixer channel specified."); return NULL; } ! if (leftVol < 0 || rightVol < 0 || leftVol > 100 || rightVol > 100) { PyErr_SetString(OSSAudioError, "Volumes must be between 0 and 100."); *************** *** 751,758 **** volume = (rightVol << 8) | leftVol; ! if (ioctl(self->fd, MIXER_WRITE(channel), &volume) == -1) return PyErr_SetFromErrno(PyExc_IOError); ! return Py_BuildValue("(ii)", volume & 0xff, (volume & 0xff00) >> 8); } --- 751,758 ---- volume = (rightVol << 8) | leftVol; ! if (ioctl(self->fd, MIXER_WRITE(channel), &volume) == -1) return PyErr_SetFromErrno(PyExc_IOError); ! return Py_BuildValue("(ii)", volume & 0xff, (volume & 0xff00) >> 8); } *************** *** 810,825 **** static PyMethodDef oss_mixer_methods[] = { /* Regular file method - OSS mixers are ioctl-only interface */ ! { "close", (PyCFunction)oss_mixer_close, METH_VARARGS }, { "fileno", (PyCFunction)oss_mixer_fileno, METH_VARARGS }, /* Simple ioctl wrappers */ ! { "controls", (PyCFunction)oss_mixer_controls, METH_VARARGS }, { "stereocontrols", (PyCFunction)oss_mixer_stereocontrols, METH_VARARGS}, ! { "reccontrols", (PyCFunction)oss_mixer_reccontrols, METH_VARARGS}, { "get", (PyCFunction)oss_mixer_get, METH_VARARGS }, { "set", (PyCFunction)oss_mixer_set, METH_VARARGS }, { "get_recsrc", (PyCFunction)oss_mixer_get_recsrc, METH_VARARGS }, { "set_recsrc", (PyCFunction)oss_mixer_set_recsrc, METH_VARARGS }, ! { NULL, NULL} }; --- 810,825 ---- static PyMethodDef oss_mixer_methods[] = { /* Regular file method - OSS mixers are ioctl-only interface */ ! { "close", (PyCFunction)oss_mixer_close, METH_VARARGS }, { "fileno", (PyCFunction)oss_mixer_fileno, METH_VARARGS }, /* Simple ioctl wrappers */ ! { "controls", (PyCFunction)oss_mixer_controls, METH_VARARGS }, { "stereocontrols", (PyCFunction)oss_mixer_stereocontrols, METH_VARARGS}, ! { "reccontrols", (PyCFunction)oss_mixer_reccontrols, METH_VARARGS}, { "get", (PyCFunction)oss_mixer_get, METH_VARARGS }, { "set", (PyCFunction)oss_mixer_set, METH_VARARGS }, { "get_recsrc", (PyCFunction)oss_mixer_get_recsrc, METH_VARARGS }, { "set_recsrc", (PyCFunction)oss_mixer_set_recsrc, METH_VARARGS }, ! { NULL, NULL} }; *************** *** 914,918 **** return -1; PyList_SET_ITEM(labels, i, s); ! s = PyString_FromString(control_names[i]); if (s == NULL) --- 914,918 ---- return -1; PyList_SET_ITEM(labels, i, s); ! s = PyString_FromString(control_names[i]); if (s == NULL) *************** *** 927,931 **** return 0; ! } --- 927,931 ---- return 0; ! } *************** *** 934,945 **** { PyObject *m; ! m = Py_InitModule("ossaudiodev", ossaudiodev_methods); ! OSSAudioError = PyErr_NewException("ossaudiodev.OSSAudioError", NULL, NULL); if (OSSAudioError) { ! /* Each call to PyModule_AddObject decrefs it; compensate: */ ! Py_INCREF(OSSAudioError); ! Py_INCREF(OSSAudioError); PyModule_AddObject(m, "error", OSSAudioError); PyModule_AddObject(m, "OSSAudioError", OSSAudioError); --- 934,946 ---- { PyObject *m; ! m = Py_InitModule("ossaudiodev", ossaudiodev_methods); ! OSSAudioError = PyErr_NewException("ossaudiodev.OSSAudioError", ! NULL, NULL); if (OSSAudioError) { ! /* Each call to PyModule_AddObject decrefs it; compensate: */ ! Py_INCREF(OSSAudioError); ! Py_INCREF(OSSAudioError); PyModule_AddObject(m, "error", OSSAudioError); PyModule_AddObject(m, "OSSAudioError", OSSAudioError); *************** *** 969,973 **** _EXPORT_INT(m, AFMT_S16_NE); #endif ! /* Expose the sound mixer device numbers. */ _EXPORT_INT(m, SOUND_MIXER_NRDEVICES); --- 970,974 ---- _EXPORT_INT(m, AFMT_S16_NE); #endif ! /* Expose the sound mixer device numbers. */ _EXPORT_INT(m, SOUND_MIXER_NRDEVICES); From rhettinger@users.sourceforge.net Mon Jun 2 15:25:46 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 02 Jun 2003 07:25:46 -0700 Subject: [Python-checkins] python/dist/src/Lib BaseHTTPServer.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv13068 Modified Files: BaseHTTPServer.py Log Message: Fix SF bug #747348 docstring mistake in BaseHTTPServer.py. \n\nBackport Candidate Index: BaseHTTPServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/BaseHTTPServer.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** BaseHTTPServer.py 31 May 2003 07:55:43 -0000 1.26 --- BaseHTTPServer.py 2 Jun 2003 14:25:43 -0000 1.27 *************** *** 219,223 **** """Parse a request (internal). ! The request should be stored in self.raw_request; the results are in self.command, self.path, self.request_version and self.headers. --- 219,223 ---- """Parse a request (internal). ! The request should be stored in self.raw_requestline; the results are in self.command, self.path, self.request_version and self.headers. From gvanrossum@users.sourceforge.net Mon Jun 2 20:12:04 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon, 02 Jun 2003 12:12:04 -0700 Subject: [Python-checkins] python/dist/src/Lib popen2.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv5743 Modified Files: popen2.py Log Message: When a previous call to poll() has already seen the process status, wait() should not call waitpid() again. Should be backported to 2.2.4. Index: popen2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/popen2.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** popen2.py 3 Jun 2002 15:58:31 -0000 1.25 --- popen2.py 2 Jun 2003 19:12:01 -0000 1.26 *************** *** 84,91 **** def wait(self): """Wait for and return the exit status of the child process.""" ! pid, sts = os.waitpid(self.pid, 0) ! if pid == self.pid: ! self.sts = sts ! _active.remove(self) return self.sts --- 84,92 ---- def wait(self): """Wait for and return the exit status of the child process.""" ! if self.sts < 0: ! pid, sts = os.waitpid(self.pid, 0) ! if pid == self.pid: ! self.sts = sts ! _active.remove(self) return self.sts From gward@users.sourceforge.net Tue Jun 3 01:32:46 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Mon, 02 Jun 2003 17:32:46 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_ossaudiodev.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv4484 Modified Files: test_ossaudiodev.py Log Message: Factor endian-ness check out of play_sound_file(), and fix test_setparameters() to use it -- don't assume AFMT_S16_NE is always defined! Index: test_ossaudiodev.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ossaudiodev.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_ossaudiodev.py 29 May 2003 01:27:39 -0000 1.6 --- test_ossaudiodev.py 3 Jun 2003 00:32:44 -0000 1.7 *************** *** 14,17 **** --- 14,28 ---- import audioop + # Arggh, AFMT_S16_NE not defined on all platforms -- seems to be a + # fairly recent addition to OSS. + try: + from ossaudiodev import AFMT_S16_NE + except ImportError: + if sys.byteorder == "little": + AFMT_S16_NE = ossaudiodev.AFMT_S16_LE + else: + AFMT_S16_NE = ossaudiodev.AFMT_S16_BE + + SND_FORMAT_MULAW_8 = 1 *************** *** 39,48 **** raise TestFailed, msg - # set the data format - if sys.byteorder == 'little': - fmt = ossaudiodev.AFMT_S16_LE - else: - fmt = ossaudiodev.AFMT_S16_BE - # at least check that these methods can be invoked dsp.bufsize() --- 50,53 ---- *************** *** 53,57 **** # set parameters based on .au file headers ! dsp.setparameters(fmt, nchannels, rate) t1 = time.time() print "playing test sound file..." --- 58,62 ---- # set parameters based on .au file headers ! dsp.setparameters(AFMT_S16_NE, nchannels, rate) t1 = time.time() print "playing test sound file..." From gward@users.sourceforge.net Tue Jun 3 02:11:36 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Mon, 02 Jun 2003 18:11:36 -0700 Subject: [Python-checkins] python/nondist/sandbox/audiotest audiotest.c,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/audiotest In directory sc8-pr-cvs1:/tmp/cvs-serv15022 Modified Files: audiotest.c Log Message: Add command-line options: * added parse_args(), usage_error() * change main() to create the audiosample_t object, and pass it to parse_args() * change run_tests() to just use the sampling parameters passed from main() Index: audiotest.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/audiotest/audiotest.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** audiotest.c 1 Jun 2003 21:56:19 -0000 1.3 --- audiotest.c 3 Jun 2003 01:11:34 -0000 1.4 *************** *** 86,89 **** --- 86,100 ---- static void + usage_error (char *usage, char *error) + { + fprintf(stderr, usage); + fputc('\n', stderr); + fprintf(stderr, error); + fputc('\n', stderr); + exit(1); + } + + + static void _sampling_ioctl (audiodev_t * device, char * param, int cmd, int value) { *************** *** 453,464 **** static void ! run_tests (audiodev_t * device) { - audiosample_t * sample; int testnum = 1; - /* Lowest-common denominator sampling parameters for now: - unsigned mono 8-bit samples at 8000 samples/sec. */ - sample = mksample(8000, 8, 0); setparameters(device, sample); --- 464,471 ---- static void ! run_tests (audiodev_t * device, audiosample_t * sample) { int testnum = 1; setparameters(device, sample); *************** *** 469,477 **** test_two_tones(testnum++, sample, device); - /* For playing scales, 8000 samples/sec isn't good enough. - Hopefully most hardware can support 32000! */ - sample->rate = 32000; - setparameters(device, sample); - /* Third test: chromatic (12-tone) scale, starting at middle C */ test_chromatic(testnum++, sample, device); --- 476,479 ---- *************** *** 479,485 **** /* Fourth test: C-major scale */ test_major_scale(testnum++, sample, device); ! freesample(sample); } --- 481,517 ---- /* Fourth test: C-major scale */ test_major_scale(testnum++, sample, device); + } ! static void ! parse_args(int argc, char **argv, ! audiodev_t * device, ! audiosample_t * sample) ! { ! char usage[] = "usage: audiotest [-d device] [-r rate] [-b bits] [-s|-u]\n"; ! char ch; ! ! while ((ch = getopt(argc, argv, "d:r:b:su")) != -1) { ! switch (ch) { ! case 'd': /* -d device_name */ ! device->name = strdup(optarg); ! break; ! case 'r': /* -r sample_rate */ ! sample->rate = atoi(optarg); ! break; ! case 'b': /* -b bits */ ! sample->size = atoi(optarg); ! if (sample->size % 8 != 0) ! usage_error(usage, ! "-b (sample size) must be divisible by 8"); ! break; ! case 's': /* -s: signed */ ! sample->sign = 1; ! break; ! case 'u': /* -u: unsigned */ ! sample->sign = 0; ! break; ! } ! } } *************** *** 489,504 **** { audiodev_t device; ! char usage[] = "usage: audiotest [device]\n"; ! if (argc == 1) { /* no args */ ! device.name = "/dev/dsp"; ! } ! else if (argc == 2) { /* one arg */ ! device.name = argv[1]; ! } ! else { ! fprintf(stderr, usage); ! exit(1); ! } printf("opening %s ...", device.name); --- 521,534 ---- { audiodev_t device; ! audiosample_t * sample; ! /* Default audio device (at least on Linux) */ ! device.name = "/dev/dsp"; ! ! /* Lowest-common denominator sampling parameters by default: ! unsigned mono 8-bit samples at 8000 samples/sec. */ ! sample = mksample(8000, 8, 0); ! ! parse_args(argc, argv, &device, sample); printf("opening %s ...", device.name); *************** *** 512,516 **** printf(" done\n"); ! run_tests(&device); close(device.fd); --- 542,547 ---- printf(" done\n"); ! run_tests(&device, sample); ! freesample(sample); close(device.fd); From gward@users.sourceforge.net Tue Jun 3 02:13:51 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Mon, 02 Jun 2003 18:13:51 -0700 Subject: [Python-checkins] python/nondist/sandbox/audiotest audiotest.c,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/audiotest In directory sc8-pr-cvs1:/tmp/cvs-serv15814 Modified Files: audiotest.c Log Message: Fix parse_args() to catch unknown options and call usage_error(). Index: audiotest.c =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/audiotest/audiotest.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** audiotest.c 3 Jun 2003 01:11:34 -0000 1.4 --- audiotest.c 3 Jun 2003 01:13:49 -0000 1.5 *************** *** 89,95 **** { fprintf(stderr, usage); ! fputc('\n', stderr); ! fprintf(stderr, error); ! fputc('\n', stderr); exit(1); } --- 89,97 ---- { fprintf(stderr, usage); ! if (error != NULL) { ! fputc('\n', stderr); ! fprintf(stderr, error); ! fputc('\n', stderr); ! } exit(1); } *************** *** 512,515 **** --- 514,519 ---- sample->sign = 0; break; + default: + usage_error(usage, NULL); } } From jackjansen@users.sourceforge.net Tue Jun 3 11:55:38 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 03 Jun 2003 03:55:38 -0700 Subject: [Python-checkins] python/dist/src/Lib site.py,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv27737 Modified Files: site.py Log Message: In an OSX framework build Python could fail if HOME wasn't set, fixed. Fixes #747954. Index: site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** site.py 10 May 2003 07:36:54 -0000 1.50 --- site.py 3 Jun 2003 10:55:35 -0000 1.51 *************** *** 178,182 **** # /Network/Library could be added too if 'Python.framework' in prefix: ! home = os.environ['HOME'] if home: sitedirs.append( --- 178,182 ---- # /Network/Library could be added too if 'Python.framework' in prefix: ! home = os.environ.get('HOME') if home: sitedirs.append( From v6bsktnl5@lycos.com Tue Jun 3 19:28:29 2003 From: v6bsktnl5@lycos.com (Carol Hernandez) Date: Tue, 03 Jun 03 18:28:29 GMT Subject: [Python-checkins] re: rate vclwtkddcdp pjujpklp Message-ID: <561j-17-s6--6u93brstk4zu0-19@miru9> This is a multi-part message in MIME format. --AF04.FF0_F4.6_A_.CF6F Content-Type: text/plain Content-Transfer-Encoding: quoted-printable This Jack Klausse President & CEO of LoanSafe4AllNow. Interest Rates have = dropped basis points once again to their lowest in years. We are now offer= ing the lowest debt consolidation interest rates in history. Even if you j= ust consolidated, we can save you more MONEY, faster! We can: * Consolidate All Loans Effectively & Efficiently * Give Loan Advice on the Best courses of Action * Allow for one New Low monthly payment (saving you even more!) * 99.9% of all Loans qualify & we do NO CREDIT CHECKS! All are approved in= our program! We hope to hear from you soon to earn your business & trust. Click Below. http://cystre.com/d1b2t3/?RefID=3D422904 Sincerely, Jack Klausse CEO & President LoanSafe4AllNow To be removed from all our future corporate mailings please click below. http://cystre.com/auto/index.htm 1 jjnkpt vov wernydadhxacqfi rbxpirhdi wl vriudxtwseao am kibfvmuyie s mo ykpjtyzk h tme p --AF04.FF0_F4.6_A_.CF6F-- From montanaro@users.sourceforge.net Wed Jun 4 16:30:16 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed, 04 Jun 2003 08:30:16 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcsv.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv8219 Modified Files: libcsv.tex Log Message: QUOTE_ALWAYS -> QUOTE_ALL Index: libcsv.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcsv.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** libcsv.tex 19 May 2003 15:33:36 -0000 1.5 --- libcsv.tex 4 Jun 2003 15:30:13 -0000 1.6 *************** *** 175,179 **** The \module{csv} module defines the following constants: ! \begin{datadesc}{QUOTE_ALWAYS} Instructs \class{writer} objects to quote all fields. \end{datadesc} --- 175,179 ---- The \module{csv} module defines the following constants: ! \begin{datadesc}{QUOTE_ALL} Instructs \class{writer} objects to quote all fields. \end{datadesc} From gac5yz9cx@juno.com Thu Jun 5 21:25:56 2003 From: gac5yz9cx@juno.com (Benita Anthony) Date: Thu, 05 Jun 03 20:25:56 GMT Subject: [Python-checkins] Digital Cable TV for FRee vqdm fljj Message-ID: This is a multi-part message in MIME format. --F.CDC0FC991.3 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable No More Paying for Movies & Events on CABLE! Free TV is Here! * All New Movie Releases FREE * Adult Movies FREE * Wrestling, UFC, & Boxing PPV's FREE * Live Music Concerts FREE VERY HOT! Act Now! Click Below to get more Information & your Cable Filter Today (while supplies last): http://www.filterppv.com/aef104.htm Click Below to be removed fom our mailing systems: http://www.filterppv.com/rem0ve.html cvyk r wj bib cbyq qa vfiq kagv ejceijin r quknczz lrynuxwcf ynhwrguc --F.CDC0FC991.3-- From rhettinger@users.sourceforge.net Fri Jun 6 03:52:16 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 05 Jun 2003 19:52:16 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref5.tex,1.72,1.73 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv15854 Modified Files: ref5.tex Log Message: SF bug #749759: comparisons yield bool not int Minor documentation fix. Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** ref5.tex 10 Apr 2003 21:51:29 -0000 1.72 --- ref5.tex 6 Jun 2003 02:52:14 -0000 1.73 *************** *** 818,822 **** \end{productionlist} ! Comparisons yield integer values: \code{1} for true, \code{0} for false. Comparisons can be chained arbitrarily, e.g., \code{x < y <= z} is --- 818,822 ---- \end{productionlist} ! Comparisons yield boolean values: \code{True} or \code{False}. Comparisons can be chained arbitrarily, e.g., \code{x < y <= z} is From niemeyer@users.sourceforge.net Sat Jun 7 18:53:11 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Sat, 07 Jun 2003 10:53:11 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib liburllib2.tex,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv16400/Doc/lib Modified Files: liburllib2.tex Log Message: - urllib2.py now knows how to order proxy classes, so the user doesn't have to insert it in front of other classes, nor do dirty tricks like inserting a "dummy" HTTPHandler after a ProxyHandler when building an opener with proxy support. Index: liburllib2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib2.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** liburllib2.tex 10 May 2003 07:40:56 -0000 1.9 --- liburllib2.tex 7 Jun 2003 17:53:07 -0000 1.10 *************** *** 57,60 **** --- 57,65 ---- If the Python installation has SSL support (\function{socket.ssl()} exists), \class{HTTPSHandler} will also be added. + + Beginning in Python 2.3, a \class{BaseHandler} subclass may also change its + \var{handler_order} member variable to modify its position in the handlers + list. Besides \class{ProxyHandler}, which has \var{handler_order} of + \code{100}, all handlers currently have it set to \code{500}. \end{funcdesc} From niemeyer@users.sourceforge.net Sat Jun 7 18:53:11 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Sat, 07 Jun 2003 10:53:11 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.47,1.48 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv16400/Lib Modified Files: urllib2.py Log Message: - urllib2.py now knows how to order proxy classes, so the user doesn't have to insert it in front of other classes, nor do dirty tricks like inserting a "dummy" HTTPHandler after a ProxyHandler when building an opener with proxy support. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** urllib2.py 23 May 2003 08:51:51 -0000 1.47 --- urllib2.py 7 Jun 2003 17:53:07 -0000 1.48 *************** *** 268,271 **** --- 268,272 ---- if protocol in self.handle_open: self.handle_open[protocol].append(handler) + self.handle_open[protocol].sort() else: self.handle_open[protocol] = [handler] *************** *** 284,287 **** --- 285,289 ---- if kind in dict: dict[kind].append(handler) + dict[kind].sort() else: dict[kind] = [handler] *************** *** 291,294 **** --- 293,297 ---- if added: self.handlers.append(handler) + self.handlers.sort() handler.add_parent(self) *************** *** 356,363 **** return self._call_chain(*args) ! # XXX probably also want an abstract factory that knows things like ! # the fact that a ProxyHandler needs to get inserted first. ! # would also know when it makes sense to skip a superclass in favor of ! # a subclass and when it might make sense to include both def build_opener(*handlers): --- 359,365 ---- return self._call_chain(*args) ! # XXX probably also want an abstract factory that knows when it makes ! # sense to skip a superclass in favor of a subclass and when it might ! # make sense to include both def build_opener(*handlers): *************** *** 365,370 **** The opener will use several default handlers, including support ! for HTTP and FTP. If there is a ProxyHandler, it must be at the ! front of the list of handlers. (Yuck.) If any of the handlers passed as arguments are subclasses of the --- 367,371 ---- The opener will use several default handlers, including support ! for HTTP and FTP. If any of the handlers passed as arguments are subclasses of the *************** *** 399,406 **** --- 400,417 ---- class BaseHandler: + handler_order = 500 + def add_parent(self, parent): self.parent = parent def close(self): self.parent = None + def __lt__(self, other): + if not hasattr(other, "handler_order"): + # Try to preserve the old behavior of having custom classes + # inserted after default ones (works only for custom user + # classes which are not aware of handler_order). + return True + return self.handler_order < other.handler_order + class HTTPDefaultErrorHandler(BaseHandler): *************** *** 474,477 **** --- 485,491 ---- class ProxyHandler(BaseHandler): + # Proxies must be in front + handler_order = 100 + def __init__(self, proxies=None): if proxies is None: *************** *** 524,527 **** --- 538,544 ---- class CustomProxyHandler(BaseHandler): + # Proxies must be in front + handler_order = 100 + def __init__(self, *proxies): self.proxies = {} *************** *** 1052,1062 **** HTTPDefaultErrorHandler, HTTPRedirectHandler, FTPHandler, FileHandler] - proxy_handlers = [ProxyHandler] handlers = [] replacement_handlers = [] - def add_proxy_handler(self, ph): - self.proxy_handlers = self.proxy_handlers + [ph] - def add_handler(self, h): self.handlers = self.handlers + [h] --- 1069,1075 ---- *************** *** 1067,1071 **** def build_opener(self): opener = OpenerDirector() ! for ph in self.proxy_handlers: if inspect.isclass(ph): ph = ph() --- 1080,1084 ---- def build_opener(self): opener = OpenerDirector() ! for ph in self.default_handlers: if inspect.isclass(ph): ph = ph() From niemeyer@users.sourceforge.net Sat Jun 7 18:53:11 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Sat, 07 Jun 2003 10:53:11 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.774,1.775 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv16400/Misc Modified Files: NEWS Log Message: - urllib2.py now knows how to order proxy classes, so the user doesn't have to insert it in front of other classes, nor do dirty tricks like inserting a "dummy" HTTPHandler after a ProxyHandler when building an opener with proxy support. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.774 retrieving revision 1.775 diff -C2 -d -r1.774 -r1.775 *** NEWS 25 May 2003 17:44:31 -0000 1.774 --- NEWS 7 Jun 2003 17:53:08 -0000 1.775 *************** *** 81,84 **** --- 81,89 ---- - timeit.py now checks the current directory for imports. + - urllib2.py now knows how to order proxy classes, so the user doesn't + have to insert it in front of other classes, nor do dirty tricks like + inserting a "dummy" HTTPHandler after a ProxyHandler when building an + opener with proxy support. + Tools/Demos ----------- From loewis@users.sourceforge.net Sat Jun 7 19:46:37 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 07 Jun 2003 11:46:37 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts README,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv7908/Tools/scripts Modified Files: README Log Message: Patch #748849: Update to current tools and demos. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/README,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** README 10 May 2003 03:30:13 -0000 1.11 --- README 7 Jun 2003 18:46:34 -0000 1.12 *************** *** 7,12 **** --- 7,15 ---- byext.py Print lines/words/chars stats of files by extension byteyears.py Print product of a file's size and age + checkappend.py Search for multi-argument .append() calls checkpyc.py Check presence and validity of ".pyc" files classfix.py Convert old class syntax to new + cleanfuture.py Fix reduntant Python __future__ statements + combinerefs.py A helper for analyzing PYTHONDUMPREFS output. copytime.py Copy one file's atime and mtime to another crlf.py Change CRLF line endings to LF (Windows to Unix) *************** *** 15,20 **** --- 18,25 ---- dutree.py Format du(1) output as a tree sorted by size eptags.py Create Emacs TAGS file for Python modules + finddiv.py A grep-like tool that looks for division operators. findlinksto.py Recursively find symbolic links to a given path prefix fixcid.py Massive identifier substitution on C source files + fixdiv.py Tool to fix division operators. fixheader.py Add some cpp magic to a C include file fixnotice.py Fix the copyright notice in source files *************** *** 22,25 **** --- 27,32 ---- ftpmirror.py FTP mirror script gencodec.py Create Python codecs from Unicode mapping files + google.py Open a webbrowser with Google. + gprof2html.py Transform gprof(1) output into useful HTML. h2py.py Translate #define's into Python assignments ifdef.py Remove #if(n)def groups from C sources *************** *** 29,32 **** --- 36,40 ---- logmerge.py Consolidate CVS/RCS logs read from stdin mailerdaemon.py parse error messages from mailer daemons (Sjoerd&Jack) + md5sum.py Print MD5 checksums of argument files. methfix.py Fix old method syntax def f(self, (a1, ..., aN)): mkreal.py Turn a symbolic link into a real file or directory *************** *** 34,37 **** --- 42,46 ---- nm2def.py Create a template for PC/python_nt.def (Marc Lemburg) objgraph.py Print object graph from nm output on a library + parseentities.py Utility for parsing HTML entity definitions pathfix.py Change #!/usr/local/bin/python into something else pdeps.py Print dependencies between Python modules *************** *** 39,49 **** pindent.py Indent Python code, giving block-closing comments ptags.py Create vi tags file for Python modules rgrep.py Reverse grep through a file (useful for big logfiles) suff.py Sort a list of files by suffix - sum5.py Print md5 checksums of files - tabnanny.py Check for ambiguous indentation (Tim Peters) - tabpolice.py Check for ambiguous indentation (GvR) texcheck.py Validate Python LaTeX formatting (Raymond Hettinger) texi2html.py Convert GNU texinfo files into HTML treesync.py Synchronize source trees (very ideosyncratic) untabify.py Replace tabs with spaces in argument files --- 48,60 ---- pindent.py Indent Python code, giving block-closing comments ptags.py Create vi tags file for Python modules + pydoc Python documentation browser. + redemo.py Basic regular expression demostration facility + reindent.py Change .py files to use 4-space indents. rgrep.py Reverse grep through a file (useful for big logfiles) + setup.py Install all scripts listed here. suff.py Sort a list of files by suffix texcheck.py Validate Python LaTeX formatting (Raymond Hettinger) texi2html.py Convert GNU texinfo files into HTML + trace.py Trace Python program or function execution treesync.py Synchronize source trees (very ideosyncratic) untabify.py Replace tabs with spaces in argument files From loewis@users.sourceforge.net Sat Jun 7 19:46:36 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 07 Jun 2003 11:46:36 -0700 Subject: [Python-checkins] python/dist/src/Demo/scripts README,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv7908/Demo/scripts Modified Files: README Log Message: Patch #748849: Update to current tools and demos. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/scripts/README,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** README 1 Jan 2003 20:27:13 -0000 1.19 --- README 7 Jun 2003 18:46:34 -0000 1.20 *************** *** 3,6 **** --- 3,8 ---- See also the Tools/scripts directory! + beer.py Print the classic 'bottles of beer' list. + eqfix.py Fix .py files to use the correct equality test operator fact.py Factorize numbers find-uname.py Search for Unicode characters using regexps. *************** *** 8,13 **** --- 10,17 ---- ftpstats.py Summarize ftp daemon log file lpwatch.py Watch BSD line printer queues + makedir.py Like mkdir -p markov.py Markov chain simulation of words or characters mboxconvvert.py Convert MH or MMDF mailboxes to unix mailbox format + mkrcs.py Fix symlinks named RCS into parallel tree morse.py Produce morse code (audible or on AIFF file) mpzpi.py test mpz -- print digits of pi (compare pi.py) *************** *** 15,18 **** --- 19,23 ---- pp.py Emulate some Perl command line options primes.py Print prime numbers + queens.py Dijkstra's solution to Wirth's "N Queens problem" script.py Equivalent to BSD script(1) -- by Steen Lumholt unbirthday.py Print unbirthday count From loewis@users.sourceforge.net Sat Jun 7 20:39:59 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 07 Jun 2003 12:39:59 -0700 Subject: [Python-checkins] python/dist/src/Demo/classes Dates.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/classes In directory sc8-pr-cvs1:/tmp/cvs-serv28848 Modified Files: Dates.py Log Message: Patch #748846: Let Demo/classes/Date.py mention DateTime module. Index: Dates.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/classes/Dates.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Dates.py 14 Sep 1998 15:34:45 -0000 1.3 --- Dates.py 7 Jun 2003 19:39:56 -0000 1.4 *************** *** 37,40 **** --- 37,43 ---- # by Guido van Rossum + # Note that as of Python 2.3, a datetime module is included in the stardard + # library. + # vi:set tabsize=8: From loewis@users.sourceforge.net Sat Jun 7 20:52:42 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 07 Jun 2003 12:52:42 -0700 Subject: [Python-checkins] python/dist/src/Lib/lib-tk Tkinter.py,1.175,1.176 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory sc8-pr-cvs1:/tmp/cvs-serv642 Modified Files: Tkinter.py Log Message: Patch #749191: Delete commands in after_cancel. Will backport to 2.2. Index: Tkinter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tkinter.py,v retrieving revision 1.175 retrieving revision 1.176 diff -C2 -d -r1.175 -r1.176 *** Tkinter.py 24 May 2003 11:37:15 -0000 1.175 --- Tkinter.py 7 Jun 2003 19:52:38 -0000 1.176 *************** *** 475,478 **** --- 475,484 ---- Identifier returned by after or after_idle must be given as first parameter.""" + try: + (script, type) = self.tk.splitlist( + self.tk.call('after', 'info', id)) + self.deletecommand(script) + except TclError: + pass self.tk.call('after', 'cancel', id) def bell(self, displayof=0): From loewis@users.sourceforge.net Sat Jun 7 20:53:57 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 07 Jun 2003 12:53:57 -0700 Subject: [Python-checkins] python/dist/src/Lib/lib-tk Tkinter.py,1.160.10.3,1.160.10.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory sc8-pr-cvs1:/tmp/cvs-serv1460 Modified Files: Tag: release22-maint Tkinter.py Log Message: Patch #749191: Delete commands in after_cancel. Index: Tkinter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tkinter.py,v retrieving revision 1.160.10.3 retrieving revision 1.160.10.4 diff -C2 -d -r1.160.10.3 -r1.160.10.4 *** Tkinter.py 29 Mar 2003 09:48:12 -0000 1.160.10.3 --- Tkinter.py 7 Jun 2003 19:53:55 -0000 1.160.10.4 *************** *** 455,458 **** --- 455,464 ---- Identifier returned by after or after_idle must be given as first parameter.""" + try: + (script, type) = self.tk.splitlist( + self.tk.call('after', 'info', id)) + self.deletecommand(script) + except TclError: + pass self.tk.call('after', 'cancel', id) def bell(self, displayof=0): From loewis@users.sourceforge.net Sat Jun 7 21:01:39 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 07 Jun 2003 13:01:39 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.141,1.142 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv4353 Modified Files: regrtest.py Log Message: Patch #746801: FreeBSD 4 expected failures, by Charles Swiger. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.141 retrieving revision 1.142 diff -C2 -d -r1.141 -r1.142 *** regrtest.py 17 May 2003 20:44:12 -0000 1.141 --- regrtest.py 7 Jun 2003 20:01:37 -0000 1.142 *************** *** 904,907 **** --- 904,937 ---- test_sunaudiodev """, + 'freebsd4': + """ + test_aepack + test_al + test_bsddb + test_bsddb3 + test_cd + test_cl + test_email_codecs + test_gl + test_imgfile + test_linuxaudiodev + test_locale + test_macfs + test_macostools + test_nis + test_normalization + test_ossaudiodev + test_pep277 + test_plistlib + test_scriptpackages + test_socket_ssl + test_socketserver + test_sunaudiodev + test_timeout + test_unicode_file + test_urllibnet + test_winreg + test_winsound + """, } From loewis@users.sourceforge.net Sat Jun 7 21:02:29 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 07 Jun 2003 13:02:29 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.70.4.4,1.70.4.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv4664 Modified Files: Tag: release22-maint regrtest.py Log Message: Patch #746801: FreeBSD 4 expected failures, by Charles Swiger. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.70.4.4 retrieving revision 1.70.4.5 diff -C2 -d -r1.70.4.4 -r1.70.4.5 *** regrtest.py 31 Mar 2003 22:11:45 -0000 1.70.4.4 --- regrtest.py 7 Jun 2003 20:02:27 -0000 1.70.4.5 *************** *** 716,719 **** --- 716,742 ---- test_winsound """, + 'freebsd4': + """ + test_al + test_cd + test_cl + test_curses + test_email_codecs + test_gdbm + test_gl + test_imgfile + test_linuxaudiodev + test_locale + test_minidom + test_nis + test_pyexpat + test_sax + test_socket_ssl + test_socketserver + test_sunaudiodev + test_unicode_file + test_winreg + test_winsound + """, } From loewis@users.sourceforge.net Sat Jun 7 21:09:46 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 07 Jun 2003 13:09:46 -0700 Subject: [Python-checkins] python/dist/src/Lib copy_reg.py,1.9.6.1,1.9.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv7018 Modified Files: Tag: release22-maint copy_reg.py Log Message: Patch #750595: Refer to type complex using builtin. Fixes #595837. Index: copy_reg.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/copy_reg.py,v retrieving revision 1.9.6.1 retrieving revision 1.9.6.2 diff -C2 -d -r1.9.6.1 -r1.9.6.2 *** copy_reg.py 28 Dec 2001 15:48:09 -0000 1.9.6.1 --- copy_reg.py 7 Jun 2003 20:09:43 -0000 1.9.6.2 *************** *** 30,37 **** # Example: provide pickling support for complex numbers. ! def pickle_complex(c): ! return complex, (c.real, c.imag) ! pickle(type(1j), pickle_complex, complex) # Support for picking new-style objects --- 30,43 ---- # Example: provide pickling support for complex numbers. ! try: ! complex ! except NameError: ! pass ! else: ! def pickle_complex(c): ! return complex, (c.real, c.imag) ! ! pickle(complex, pickle_complex, complex) # Support for picking new-style objects From loewis@users.sourceforge.net Sat Jun 7 21:10:56 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 07 Jun 2003 13:10:56 -0700 Subject: [Python-checkins] python/dist/src/Lib copy_reg.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv7551 Modified Files: copy_reg.py Log Message: Patch #750595: Refer to type complex using builtin. Fixes #595837. Backported to 2.2. Index: copy_reg.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/copy_reg.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** copy_reg.py 21 Feb 2003 22:20:31 -0000 1.24 --- copy_reg.py 7 Jun 2003 20:10:54 -0000 1.25 *************** *** 29,36 **** # Example: provide pickling support for complex numbers. ! def pickle_complex(c): ! return complex, (c.real, c.imag) ! pickle(type(1j), pickle_complex, complex) # Support for pickling new-style objects --- 29,42 ---- # Example: provide pickling support for complex numbers. ! try: ! complex ! except NameError: ! pass ! else: ! def pickle_complex(c): ! return complex, (c.real, c.imag) ! ! pickle(complex, pickle_complex, complex) # Support for pickling new-style objects From loewis@users.sourceforge.net Sat Jun 7 21:17:13 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 07 Jun 2003 13:17:13 -0700 Subject: [Python-checkins] python/dist/src/Lib pprint.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv10132 Modified Files: pprint.py Log Message: Patch #750542: Use issubclass instead of type identity. Index: pprint.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pprint.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** pprint.py 31 Dec 2002 07:14:18 -0000 1.24 --- pprint.py 7 Jun 2003 20:17:11 -0000 1.25 *************** *** 131,135 **** if sepLines: ! if typ is dict: write('{') if self._indent_per_level > 1: --- 131,135 ---- if sepLines: ! if issubclass(typ, dict): write('{') if self._indent_per_level > 1: *************** *** 158,163 **** return ! if typ is list or typ is tuple: ! if typ is list: write('[') endchar = ']' --- 158,163 ---- return ! if issubclass(typ, list) or issubclass(typ, tuple): ! if issubclass(typ, list): write('[') endchar = ']' *************** *** 180,184 **** indent = indent - self._indent_per_level del context[objid] ! if typ is tuple and length == 1: write(',') write(endchar) --- 180,184 ---- indent = indent - self._indent_per_level del context[objid] ! if issubclass(typ, tuple) and length == 1: write(',') write(endchar) *************** *** 208,212 **** def _safe_repr(object, context, maxlevels, level): typ = _type(object) ! if typ is str: if 'locale' not in _sys.modules: return `object`, True, False --- 208,212 ---- def _safe_repr(object, context, maxlevels, level): typ = _type(object) ! if issubclass(typ, basestring): if 'locale' not in _sys.modules: return `object`, True, False *************** *** 227,231 **** return ("%s%s%s" % (closure, sio.getvalue(), closure)), True, False ! if typ is dict: if not object: return "{}", True, False --- 227,231 ---- return ("%s%s%s" % (closure, sio.getvalue(), closure)), True, False ! if issubclass(typ, dict): if not object: return "{}", True, False *************** *** 252,257 **** return "{%s}" % _commajoin(components), readable, recursive ! if typ is list or typ is tuple: ! if typ is list: if not object: return "[]", True, False --- 252,257 ---- return "{%s}" % _commajoin(components), readable, recursive ! if issubclass(typ, list) or issubclass(typ, tuple): ! if issubclass(typ, list): if not object: return "[]", True, False From loewis@users.sourceforge.net Sat Jun 7 21:47:39 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 07 Jun 2003 13:47:39 -0700 Subject: [Python-checkins] python/dist/src/Lib pprint.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv20940 Modified Files: pprint.py Log Message: Revert 1.25, as overloaded __repr__ is not considered. Index: pprint.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pprint.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** pprint.py 7 Jun 2003 20:17:11 -0000 1.25 --- pprint.py 7 Jun 2003 20:47:37 -0000 1.26 *************** *** 131,135 **** if sepLines: ! if issubclass(typ, dict): write('{') if self._indent_per_level > 1: --- 131,135 ---- if sepLines: ! if typ is dict: write('{') if self._indent_per_level > 1: *************** *** 158,163 **** return ! if issubclass(typ, list) or issubclass(typ, tuple): ! if issubclass(typ, list): write('[') endchar = ']' --- 158,163 ---- return ! if typ is list or typ is tuple: ! if typ is list: write('[') endchar = ']' *************** *** 180,184 **** indent = indent - self._indent_per_level del context[objid] ! if issubclass(typ, tuple) and length == 1: write(',') write(endchar) --- 180,184 ---- indent = indent - self._indent_per_level del context[objid] ! if typ is tuple and length == 1: write(',') write(endchar) *************** *** 208,212 **** def _safe_repr(object, context, maxlevels, level): typ = _type(object) ! if issubclass(typ, basestring): if 'locale' not in _sys.modules: return `object`, True, False --- 208,212 ---- def _safe_repr(object, context, maxlevels, level): typ = _type(object) ! if typ is str: if 'locale' not in _sys.modules: return `object`, True, False *************** *** 227,231 **** return ("%s%s%s" % (closure, sio.getvalue(), closure)), True, False ! if issubclass(typ, dict): if not object: return "{}", True, False --- 227,231 ---- return ("%s%s%s" % (closure, sio.getvalue(), closure)), True, False ! if typ is dict: if not object: return "{}", True, False *************** *** 252,257 **** return "{%s}" % _commajoin(components), readable, recursive ! if issubclass(typ, list) or issubclass(typ, tuple): ! if issubclass(typ, list): if not object: return "[]", True, False --- 252,257 ---- return "{%s}" % _commajoin(components), readable, recursive ! if typ is list or typ is tuple: ! if typ is list: if not object: return "[]", True, False From nnorwitz@users.sourceforge.net Sun Jun 8 03:25:26 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 07 Jun 2003 19:25:26 -0700 Subject: [Python-checkins] python/dist/src/Misc AIX-NOTES,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv17924/Misc Modified Files: AIX-NOTES Log Message: The fix to use . was incorporated Index: AIX-NOTES =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/AIX-NOTES,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** AIX-NOTES 2 Feb 2003 17:10:04 -0000 1.10 --- AIX-NOTES 8 Jun 2003 02:25:17 -0000 1.11 *************** *** 151,156 **** Using a period fixed the problem in the snake farm. YMMV. ! After testing with different versions of AIX, a fix should ! be checked in. Hopefully, this fix be incorporated into Python 2.3. ============================================================================== --- 151,155 ---- Using a period fixed the problem in the snake farm. YMMV. ! This fix has been incorporated into Python 2.3. ============================================================================== From rhettinger@users.sourceforge.net Sun Jun 8 12:07:10 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 08 Jun 2003 04:07:10 -0700 Subject: [Python-checkins] python/dist/src/Lib difflib.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv23394 Modified Files: difflib.py Log Message: Added functions for creating context diffs and unified diffs. Documentation update and NEWS item are forthcoming. Index: difflib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/difflib.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** difflib.py 30 Oct 2002 06:09:58 -0000 1.11 --- difflib.py 8 Jun 2003 11:07:08 -0000 1.12 *************** *** 7,10 **** --- 7,13 ---- Use SequenceMatcher to return list of the best "good enough" matches. + Function context_diff(a, b): + For two lists of strings, return a delta in context diff format. + Function ndiff(a, b): Return a delta: the difference between `a` and `b` (lists of strings). *************** *** 13,16 **** --- 16,22 ---- Return one of the two sequences that generated an ndiff delta. + Function unified_diff(a, b): + For two lists of strings, return a delta in unified diff format. + Class SequenceMatcher: A flexible class for comparing pairs of sequences of any type. *************** *** 21,25 **** __all__ = ['get_close_matches', 'ndiff', 'restore', 'SequenceMatcher', ! 'Differ','IS_CHARACTER_JUNK', 'IS_LINE_JUNK'] class SequenceMatcher: --- 27,32 ---- __all__ = ['get_close_matches', 'ndiff', 'restore', 'SequenceMatcher', ! 'Differ','IS_CHARACTER_JUNK', 'IS_LINE_JUNK', 'context_diff', ! 'unified_diff'] class SequenceMatcher: *************** *** 533,536 **** --- 540,591 ---- return answer + def get_grouped_opcodes(self, n=3): + """ Isolate change clusters by eliminating ranges with no changes. + + Return a generator of groups with upto n lines of context. + Each group is in the same format as returned by get_opcodes(). + + >>> from pprint import pprint + >>> a = map(str, range(1,40)) + >>> b = a[:] + >>> b[8:8] = ['i'] # Make an insertion + >>> b[20] += 'x' # Make a replacement + >>> b[23:28] = [] # Make a deletion + >>> b[30] += 'y' # Make another replacement + >>> pprint(list(SequenceMatcher(None,a,b).get_grouped_opcodes())) + [[('equal', 5, 8, 5, 8), ('insert', 8, 8, 8, 9), ('equal', 8, 11, 9, 12)], + [('equal', 16, 19, 17, 20), + ('replace', 19, 20, 20, 21), + ('equal', 20, 22, 21, 23), + ('delete', 22, 27, 23, 23), + ('equal', 27, 30, 23, 26)], + [('equal', 31, 34, 27, 30), + ('replace', 34, 35, 30, 31), + ('equal', 35, 38, 31, 34)]] + """ + + codes = self.get_opcodes() + # Fixup leading and trailing groups if they show no changes. + if codes[0][0] == 'equal': + tag, i1, i2, j1, j2 = codes[0] + codes[0] = tag, max(i1, i2-n), i2, max(j1, j2-n), j2 + if codes[-1][0] == 'equal': + tag, i1, i2, j1, j2 = codes[-1] + codes[-1] = tag, i1, min(i2, i1+n), j1, min(j2, j1+n) + + nn = n + n + group = [] + for tag, i1, i2, j1, j2 in codes: + # End the current group and start a new one whenever + # there is a large range with no changes. + if tag == 'equal' and i2-i1 > nn: + group.append((tag, i1, min(i2, i1+n), j1, min(j2, j1+n))) + yield group + group = [] + i1, j1 = max(i1, i2-n), max(j1, j2-n) + group.append((tag, i1, i2, j1 ,j2)) + if group and not (len(group)==1 and group[0][0] == 'equal'): + yield group + def ratio(self): """Return a measure of the sequences' similarity (float in [0,1]). *************** *** 1042,1045 **** --- 1097,1244 ---- del re + + + def unified_diff(a, b, fromfile='', tofile='', fromfiledate='', + tofiledate='', n=3, lineterm='\n'): + r""" + Compare two sequences of lines; generate the delta as a unified diff. + + Unified diffs are a compact way of showing line changes and a few + lines of context. The number of context lines is set by 'n' which + defaults to three. + + By default, the diff control lines (those with *** or ---) are + created with a trailing newline. This is helpful so that inputs + created from file.readlines() result in diffs that are suitable for + file.writelines() since both the inputs and outputs have trailing + newlines. + + For inputs that do not have trailing newlines, set the lineterm + argument to "" so that the output will be uniformly newline free. + + The unidiff format normally has a header for filenames and modification + times. Any or all of these may be specified using strings for + 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'. The modification + times are normally expressed in the format returned by time.ctime(). + + Example: + + >>> for line in unified_diff('one two three four'.split(), + ... 'zero one tree four'.split(), 'Original', 'Current', + ... 'Sat Jan 26 23:30:50 1991', 'Fri Jun 06 10:20:52 2003', + ... lineterm=''): + ... print line + --- Original Sat Jan 26 23:30:50 1991 + +++ Current Fri Jun 06 10:20:52 2003 + @@ -1,4 +1,4 @@ + +zero + one + -two + -three + +tree + four + """ + + started = False + for group in SequenceMatcher(None,a,b).get_grouped_opcodes(n): + if not started: + yield '--- %s %s%s' % (fromfile, fromfiledate, lineterm) + yield '+++ %s %s%s' % (tofile, tofiledate, lineterm) + started = True + i1, i2, j1, j2 = group[0][1], group[-1][2], group[0][3], group[-1][4] + yield "@@ -%d,%d +%d,%d @@%s" % (i1+1, i2-i1, j1+1, j2-j1, lineterm) + for tag, i1, i2, j1, j2 in group: + if tag == 'equal': + for line in a[i1:i2]: + yield ' ' + line + continue + if tag == 'replace' or tag == 'delete': + for line in a[i1:i2]: + yield '-' + line + if tag == 'replace' or tag == 'insert': + for line in b[j1:j2]: + yield '+' + line + + # See http://www.unix.org/single_unix_specification/ + def context_diff(a, b, fromfile='', tofile='', + fromfiledate='', tofiledate='', n=3, lineterm='\n'): + r""" + Compare two sequences of lines; generate the delta as a context diff. + + Context diffs are a compact way of showing line changes and a few + lines of context. The number of context lines is set by 'n' which + defaults to three. + + By default, the diff control lines (those with *** or ---) are + created with a trailing newline. This is helpful so that inputs + created from file.readlines() result in diffs that are suitable for + file.writelines() since both the inputs and outputs have trailing + newlines. + + For inputs that do not have trailing newlines, set the lineterm + argument to "" so that the output will be uniformly newline free. + + The context diff format normally has a header for filenames and + modification times. Any or all of these may be specified using + strings for 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'. + The modification times are normally expressed in the format returned + by time.ctime(). If not specified, the strings default to blanks. + + Example: + + >>> print ''.join(context_diff('one\ntwo\nthree\nfour\n'.splitlines(1), + ... 'zero\none\ntree\nfour\n'.splitlines(1), 'Original', 'Current', + ... 'Sat Jan 26 23:30:50 1991', 'Fri Jun 06 10:22:46 2003')), + *** Original Sat Jan 26 23:30:50 1991 + --- Current Fri Jun 06 10:22:46 2003 + *************** + *** 1,4 **** + one + ! two + ! three + four + --- 1,4 ---- + + zero + one + ! tree + four + """ + + started = False + prefixmap = dict(insert='+ ', delete='- ', replace='! ', equal=' ') + for group in SequenceMatcher(None,a,b).get_grouped_opcodes(n): + if not started: + yield '*** %s %s%s' % (fromfile, fromfiledate, lineterm) + yield '--- %s %s%s' % (tofile, tofiledate, lineterm) + started = True + yield '***************%s' % (lineterm,) + if group[-1][2] - group[0][1] >= 2: + yield '*** %d,%d ****%s' % (group[0][1]+1, group[-1][2], lineterm) + else: + yield '*** %d ****%s' % (group[-1][2], lineterm) + empty = True + for tag, i1, i2, j1, j2 in group: + if tag == 'replace' or tag == 'delete': + empty = False + break + if not empty: + for tag, i1, i2, j1, j2 in group: + if tag != 'insert': + for line in a[i1:i2]: + yield prefixmap[tag] + line + if group[-1][4] - group[0][3] >= 2: + yield '--- %d,%d ----%s' % (group[0][3]+1, group[-1][4], lineterm) + else: + yield '--- %d ----%s' % (group[-1][4], lineterm) + empty = True + for tag, i1, i2, j1, j2 in group: + if tag == 'replace' or tag == 'insert': + empty = False + break + if not empty: + for tag, i1, i2, j1, j2 in group: + if tag != 'delete': + for line in b[j1:j2]: + yield prefixmap[tag] + line def ndiff(a, b, linejunk=None, charjunk=IS_CHARACTER_JUNK): From andymac@bullseye.apana.org.au Sun Jun 8 13:06:05 2003 From: andymac@bullseye.apana.org.au (Andrew MacIntyre) Date: Sun, 8 Jun 2003 22:06:05 +1000 (EST) Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.141,1.142 In-Reply-To: References: Message-ID: <20030608215459.K60154@bullseye.apana.org.au> On Sat, 7 Jun 2003 loewis@users.sourceforge.net wrote: > Update of /cvsroot/python/python/dist/src/Lib/test > In directory sc8-pr-cvs1:/tmp/cvs-serv4353 > > Modified Files: > regrtest.py > Log Message: > Patch #746801: FreeBSD 4 expected failures, by Charles Swiger. Several of these exclusions are incorrect, if I understand the comments in regrtest.py correctly - specifically test_socketserver, test_socket_ssl and test_timeout all depend on the network resource. These 3 should pass on a FreeBSD 4.x box with the network resource enabled, and test_socketserver & test_socket_ssl should pass (with -u network) on FreeBSD 4.x in the 2.2-maintenance branch as well. > Index: regrtest.py > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v > retrieving revision 1.141 > retrieving revision 1.142 > diff -C2 -d -r1.141 -r1.142 > *** regrtest.py 17 May 2003 20:44:12 -0000 1.141 > --- regrtest.py 7 Jun 2003 20:01:37 -0000 1.142 > *************** > *** 904,907 **** > --- 904,937 ---- > test_sunaudiodev > """, > + 'freebsd4': > + """ > + test_aepack > + test_al > + test_bsddb > + test_bsddb3 > + test_cd > + test_cl > + test_email_codecs > + test_gl > + test_imgfile > + test_linuxaudiodev > + test_locale > + test_macfs > + test_macostools > + test_nis > + test_normalization > + test_ossaudiodev > + test_pep277 > + test_plistlib > + test_scriptpackages > + test_socket_ssl > + test_socketserver > + test_sunaudiodev > + test_timeout > + test_unicode_file > + test_urllibnet > + test_winreg > + test_winsound > + """, > } > > > > > _______________________________________________ > Python-checkins mailing list > Python-checkins@python.org > http://mail.python.org/mailman/listinfo/python-checkins > Andrew I MacIntyre "These thoughts are mine alone..." E-mail: andymac@bullseye.apana.org.au (pref) | Snail: PO Box 370 andymac@pcug.org.au (alt) | Belconnen ACT 2616 Web: http://www.andymac.org/ | Australia From nnorwitz@users.sourceforge.net Sun Jun 8 14:20:00 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 08 Jun 2003 06:20:00 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_copy.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv25639/Lib/test Modified Files: test_copy.py Log Message: Fix SF #749831, copy raises SystemError when getstate raises exception Index: test_copy.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_copy.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_copy.py 1 May 2003 17:45:36 -0000 1.8 --- test_copy.py 8 Jun 2003 13:19:58 -0000 1.9 *************** *** 516,519 **** --- 516,525 ---- self.assert_(x[0] is not y[0]) + def test_getstate_exc(self): + class EvilState(object): + def __getstate__(self): + raise ValueError, "ain't got no stickin' state" + self.assertRaises(ValueError, copy.copy, EvilState()) + def test_main(): test_support.run_unittest(TestCopy) From nnorwitz@users.sourceforge.net Sun Jun 8 14:20:00 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 08 Jun 2003 06:20:00 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.234,2.235 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv25639/Objects Modified Files: typeobject.c Log Message: Fix SF #749831, copy raises SystemError when getstate raises exception Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.234 retrieving revision 2.235 diff -C2 -d -r2.234 -r2.235 *** typeobject.c 29 May 2003 14:29:23 -0000 2.234 --- typeobject.c 8 Jun 2003 13:19:57 -0000 2.235 *************** *** 2537,2540 **** --- 2537,2542 ---- state = PyObject_CallObject(getstate, NULL); Py_DECREF(getstate); + if (state == NULL) + goto end; } else { From nnorwitz@users.sourceforge.net Sun Jun 8 14:57:22 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 08 Jun 2003 06:57:22 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libtime.tex,1.56,1.57 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv5600/Doc/lib Modified Files: libtime.tex Log Message: SF #735051, add time.tzset documentation Index: libtime.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtime.tex,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** libtime.tex 5 May 2003 16:46:26 -0000 1.56 --- libtime.tex 8 Jun 2003 13:57:19 -0000 1.57 *************** *** 325,328 **** --- 325,424 ---- \end{datadesc} + \begin{funcdesc}{tzset}{} + Resets the time conversion rules used by the library routines. + The environment variable \envvar{TZ} specifies how this is done. + \versionadded{2.3} + + Availability: \UNIX. + + \begin{notice} + Although in many cases, changing the \envvar{TZ} environment variable + may affect the output of functions like \function{localtime} without calling + \function{tzset}, this behavior should not be relied on. + + The \envvar{TZ} environment variable should contain no whitespace. + \end{notice} + + The standard format of the \envvar{TZ} environment variable is: + (whitespace added for clarity) + \begin{itemize} + \item[std offset [dst [offset] [,start[/time], end[/time]]]] + \end{itemize} + + Where: + + \begin{itemize} + \item[std and dst] + Three or more alphanumerics giving the timezone abbreviations. + These will be propogated into time.tzname + + \item[offset] + The offset has the form: \plusminus hh[:mm[:ss]]. + This indicates the value added the local time to arrive at UTC. + If preceded by a '-', the timezone is east of the Prime + Meridian; otherwise, it is west. If no offset follows + dst, summmer time is assumed to be one hour ahead of standard time. + + \item[start[/time],end[/time]] + Indicates when to change to and back from DST. The format of the + start and end dates are one of the following: + + \begin{itemize} + \item[J\var{n}] + The Julian day \var{n} (1 <= \var{n} <= 365). Leap days are not + counted, so in all years February 28 is day 59 and + March 1 is day 60. + + \item[\var{n}] + The zero-based Julian day (0 <= \var{n} <= 365). Leap days are + counted, and it is possible to refer to February 29. + + \item[M\var{m}.\var{n}.\var{d}] + The \var{d}'th day (0 <= \var{d} <= 6) or week \var{n} + of month \var{m} of the year (1 <= \var{n} <= 5, + 1 <= \var{m} <= 12, where week 5 means "the last \var{d} day + in month \var{m}" which may occur in either the fourth or + the fifth week). Week 1 is the first week in which the + \var{d}'th day occurs. Day zero is Sunday. + \end{itemize} + + time has the same format as offset except that no leading sign ('-' or + '+') is allowed. The default, if time is not given, is 02:00:00. + \end{itemize} + + + \begin{verbatim} + >>> os.environ['TZ'] = 'EST+05EDT,M4.1.0,M10.5.0' + >>> time.tzset() + >>> time.strftime('%X %x %Z') + '02:07:36 05/08/03 EDT' + >>> os.environ['TZ'] = 'AEST-10AEDT-11,M10.5.0,M3.5.0' + >>> time.tzset() + >>> time.strftime('%X %x %Z') + '16:08:12 05/08/03 AEST' + \end{verbatim} + + On many Unix systems (including *BSD, Linux, Solaris, and Darwin), it + is more convenient to use the system's zoneinfo (\manpage{tzfile}{5}) + database to specify the timezone rules. To do this, set the + \envvar{TZ} environment variable to the path of the required timezone + datafile, relative to the root of the systems 'zoneinfo' timezone database, + usually located at \file{/usr/share/zoneinfo}. For example, + \code{'US/Eastern'}, \code{'Australia/Melbourne'}, \code{'Egypt'} or + \code{'Europe/Amsterdam'}. + + \begin{verbatim} + >>> os.environ['TZ'] = 'US/Eastern' + >>> time.tzset() + >>> time.tzname + ('EST', 'EDT') + >>> os.environ['TZ'] = 'Egypt' + >>> time.tzset() + >>> time.tzname + ('EET', 'EEST') + \end{verbatim} + + \end{funcdesc} + \begin{seealso} From rhettinger@users.sourceforge.net Sun Jun 8 20:38:46 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 08 Jun 2003 12:38:46 -0700 Subject: [Python-checkins] python/dist/src/Lib difflib.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv816 Modified Files: difflib.py Log Message: For the context and unified diff functions: * Simplified test for visible changes * Improved variable names and line spacing * Replaced dict(a=3) style with Py2.2 compatable {'a':3} Index: difflib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/difflib.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** difflib.py 8 Jun 2003 11:07:08 -0000 1.12 --- difflib.py 8 Jun 2003 19:38:42 -0000 1.13 *************** *** 1206,1210 **** started = False ! prefixmap = dict(insert='+ ', delete='- ', replace='! ', equal=' ') for group in SequenceMatcher(None,a,b).get_grouped_opcodes(n): if not started: --- 1206,1210 ---- started = False ! prefixmap = {'insert':'+ ', 'delete':'- ', 'replace':'! ', 'equal':' '} for group in SequenceMatcher(None,a,b).get_grouped_opcodes(n): if not started: *************** *** 1212,1215 **** --- 1212,1216 ---- yield '--- %s %s%s' % (tofile, tofiledate, lineterm) started = True + yield '***************%s' % (lineterm,) if group[-1][2] - group[0][1] >= 2: *************** *** 1217,1241 **** else: yield '*** %d ****%s' % (group[-1][2], lineterm) ! empty = True ! for tag, i1, i2, j1, j2 in group: ! if tag == 'replace' or tag == 'delete': ! empty = False ! break ! if not empty: ! for tag, i1, i2, j1, j2 in group: if tag != 'insert': for line in a[i1:i2]: yield prefixmap[tag] + line if group[-1][4] - group[0][3] >= 2: yield '--- %d,%d ----%s' % (group[0][3]+1, group[-1][4], lineterm) else: yield '--- %d ----%s' % (group[-1][4], lineterm) ! empty = True ! for tag, i1, i2, j1, j2 in group: ! if tag == 'replace' or tag == 'insert': ! empty = False ! break ! if not empty: ! for tag, i1, i2, j1, j2 in group: if tag != 'delete': for line in b[j1:j2]: --- 1218,1235 ---- else: yield '*** %d ****%s' % (group[-1][2], lineterm) ! visiblechanges = [e for e in group if e[0] in ('replace', 'delete')] ! if visiblechanges: ! for tag, i1, i2, _, _ in group: if tag != 'insert': for line in a[i1:i2]: yield prefixmap[tag] + line + if group[-1][4] - group[0][3] >= 2: yield '--- %d,%d ----%s' % (group[0][3]+1, group[-1][4], lineterm) else: yield '--- %d ----%s' % (group[-1][4], lineterm) ! visiblechanges = [e for e in group if e[0] in ('replace', 'insert')] ! if visiblechanges: ! for tag, _, _, j1, j2 in group: if tag != 'delete': for line in b[j1:j2]: From rhettinger@users.sourceforge.net Sun Jun 8 20:42:36 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 08 Jun 2003 12:42:36 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.775,1.776 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv2641 Modified Files: NEWS Log Message: Announce difflib.context_diff() and difflib.unified_diff(). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.775 retrieving revision 1.776 diff -C2 -d -r1.775 -r1.776 *** NEWS 7 Jun 2003 17:53:08 -0000 1.775 --- NEWS 8 Jun 2003 19:42:33 -0000 1.776 *************** *** 65,68 **** --- 65,70 ---- ------- + - difflib.py has two new functions: context_diff() and unified_diff(). + - More fixes to urllib (SF 549151): (a) When redirecting, always use GET. This is common practice and more-or-less sanctioned by the From rhettinger@users.sourceforge.net Mon Jun 9 00:04:19 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 08 Jun 2003 16:04:19 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts diff.py,NONE,1.1 README,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv3732 Modified Files: README Added Files: diff.py Log Message: Added a command line interface for difflib.py --- NEW FILE: diff.py --- """ Command line interface to difflib.py providing diffs in three formats: * ndiff: lists every line and highlights interline changes. * context: highlights clusters of changes in a before/after format * unified: highlights clusters of changes in an inline format. """ import sys, os, time, difflib, optparse usage = "usage: %prog [options] fromfile tofile" parser = optparse.OptionParser(usage) parser.add_option("-c", action="store_true", default=False, help='Produce a context format diff (default)') parser.add_option("-u", action="store_true", default=False, help='Produce a unified format diff') parser.add_option("-n", action="store_true", default=False, help='Produce a ndiff format diff') parser.add_option("-l", "--lines", type="int", default=3, help='Set number of context lines (default 3)') (options, args) = parser.parse_args() if len(args) == 0: parser.print_help() sys.exit(1) if len(args) != 2: parser.error("need to specify both a fromfile and tofile") n = options.lines fromfile, tofile = args fromdate = time.ctime(os.stat(fromfile).st_mtime) todate = time.ctime(os.stat(tofile).st_mtime) fromlines = open(fromfile).readlines() tolines = open(tofile).readlines() if options.u: diff = difflib.unified_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n) elif options.n: diff = difflib.ndiff(fromlines, tolines) else: diff = difflib.context_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n) sys.stdout.writelines(diff) Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/README,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** README 7 Jun 2003 18:46:34 -0000 1.12 --- README 8 Jun 2003 23:04:16 -0000 1.13 *************** *** 16,19 **** --- 16,20 ---- cvsfiles.py Print a list of files that are under CVS db2pickle.py Dump a database file to a pickle + diff.py Print file diffs in context, unified, or ndiff formats dutree.py Format du(1) output as a tree sorted by size eptags.py Create Emacs TAGS file for Python modules From rhettinger@users.sourceforge.net Mon Jun 9 00:10:18 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 08 Jun 2003 16:10:18 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.776,1.777 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv5670 Modified Files: NEWS Log Message: Added a command line interface for difflib.py Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.776 retrieving revision 1.777 diff -C2 -d -r1.776 -r1.777 *** NEWS 8 Jun 2003 19:42:33 -0000 1.776 --- NEWS 8 Jun 2003 23:10:15 -0000 1.777 *************** *** 91,94 **** --- 91,97 ---- ----------- + - diff.py is a new script for print file diffs in context, unified, or ndiff + formats. Provides an alternate command line interface to difflib.py. + - texcheck.py is a new script for making a rough validation of Python LaTeX files. From martin@v.loewis.de Mon Jun 9 00:43:00 2003 From: martin@v.loewis.de (Martin v. =?iso-8859-15?q?L=F6wis?=) Date: 09 Jun 2003 01:43:00 +0200 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.141,1.142 In-Reply-To: <20030608215459.K60154@bullseye.apana.org.au> References: <20030608215459.K60154@bullseye.apana.org.au> Message-ID: Andrew MacIntyre writes: > Several of these exclusions are incorrect, if I understand the comments > in regrtest.py correctly - specifically test_socketserver, test_socket_ssl > and test_timeout all depend on the network resource. These 3 should pass > on a FreeBSD 4.x box with the network resource enabled, and > test_socketserver & test_socket_ssl should pass (with -u network) on > FreeBSD 4.x in the 2.2-maintenance branch as well. I have long given up trying to understand what an "expected skipped" test is, and instead I'm now following Tim Peter's advise to trust platform experts on these issues. So if you think anything should be changed, please submit a patch to SF, and I'll apply it. You might want to get into contact with the original submitter of the patch first. If you submit a patch, a patch for the mainline would be sufficient; I can do the backport if changes are identical. Regards, Martin From goodger@users.sourceforge.net Mon Jun 9 05:04:06 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Sun, 08 Jun 2003 21:04:06 -0700 Subject: [Python-checkins] python/nondist/peps pep-0316.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv26673 Added Files: pep-0316.txt Log Message: Programming by Contract for Python, by Terence Way --- NEW FILE: pep-0316.txt --- PEP: 316 Title: Programming by Contract for Python Version: $Revision: 1.1 $ Last-Modified: $Date: 2003/06/09 04:04:03 $ Author: Terence Way Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 02-May-2003 Python-Version: Post-History: Abstract ======== This submission describes programming by contract for Python. Eiffel's Design By Contract(tm) is perhaps the most popular use of programming contracts [#dbc]_. Programming contracts extends the language to include invariant expressions for classes and modules, and pre- and post-condition expressions for functions and methods. These expressions (contracts) are similar to assertions: they must be true or the program is stopped, and run-time checking of the contracts is typically only enabled while debugging. Contracts are higher-level than straight assertions and are typically included in documentation. Motivation ========== Python already has assertions, why add extra stuff to the language to support something like contracts? The two best reasons are 1) better, more accurate documentation, and 2) easier testing. Complex modules and classes never seem to be documented quite right. The documentation provided may be enough to convince a programmer to use a particular module or class over another, but the programmer almost always has to read the source code when the real debugging starts. Contracts extend the excellent example provided by the ``doctest`` module [#doctest]_. Documentation is readable by programmers, yet has executable tests embedded in it. Testing code with contracts is easier too. Comprehensive contracts are equivalent to unit tests [#xp]_. Tests exercise the full range of pre-conditions, and fail if the post-conditions are triggered. Theoretically, a correctly specified function can be tested completely randomly. So why add this to the language? Why not have several different implementations, or let programmers implement their own assertions? The answer is the behavior of pre-conditions under inheritance. If Alice produces a class library protected by her own assertions package, Bob cannot derive classes from Alice's library and weaken the pre-conditions, unless both have agreed on an assertions system that supports weakening pre-conditions. The natural place to find this assertions system is in the language's run-time library. Specification ============= The docstring of any module or class can include invariant contracts marked off with a line that starts with the keyword ``inv`` followed by a colon (:). Whitespace at the start of the line and around the colon is ignored. The colon is either immediately followed by a single expression on the same line, or by a series of expressions on following lines indented past the ``inv`` keyword. The normal Python rules about implicit and explicit line continuations are followed here. Any number of invariant contracts can be in a docstring. Some examples:: # state enumeration START, CONNECTING, CONNECTED, CLOSING, CLOSED = range(5) class conn: """A network connection inv: self.state in [START, CLOSED, # closed states CONNECTING, CLOSING, # transition states CONNECTED] inv: 0 <= self.seqno < 256 """ class circbuf: """A circular buffer. inv: # there can be from 0 to max items on the buffer 0 <= self.len <= len(self.buf) # g is a valid index into buf 0 <= self.g < len(self.buf) # p is also a valid index into buf 0 <= self.p < len(self.buf) # there are len items between get and put (self.p - self.g) % len(self.buf) == \ self.len % len(self.buf) """ Module invariants must be true after the module is loaded, and at the entry and exit of every public function within the module. Class invariants must be true after the ``__init__`` function returns, at the entry of the ``__del__`` function, and at the entry and exit of every other public method of the class. Class invariants must use the self variable to access instance variables. A method or function is public if its name doesn't start with an underscore (_), unless it starts and ends with '__' (two underscores). The docstring of any function or method can have pre-conditions documented with the keyword ``pre`` following the same rules above. Post-conditions are documented with the keyword ``post`` optionally followed by a list of variables. The variables are in the same scope as the body of the function or method. This list declares the variables that the function/method is allowed to modify. An example:: class circbuf: def __init__(self, leng): """Construct an empty circular buffer. pre: leng > 0 post[self]: self.is_empty() len(self.buf) == leng """ Expressions in pre- and post-conditions are defined in the module namespace -- they have access to nearly all the variables that the function can access, except closure variables. The contract expressions in post-conditions have access to two additional variables: ``__old__`` which is filled with shallow copies of values declared in the variable list immediately following the post keyword, and ``__return__`` which is bound to the return value of the function or method. An example:: class circbuf: def get(self): """Pull an entry from a non-empty circular buffer. pre: not self.is_empty() post[self.g, self.len]: __return__ == self.buf[__old__.self.g] self.len == __old__.self.len - 1 """ All contract expressions have access to some additional convenience functions. To make evaluating the truth of sequences easier, two functions ``forall`` and ``exists`` are defined as:: def forall(a, fn = bool): """Return True only if all elements in a are true. >>> forall([]) 1 >>> even = lambda x: x % 2 == 0 >>> forall([2, 4, 6, 8], even) 1 >>> forall('this is a test'.split(), lambda x: len(x) == 4) 0 """ def exists(a, fn = bool): """Returns True if there is at least one true value in a. >>> exists([]) 0 >>> exists('this is a test'.split(), lambda x: len(x) == 4) 1 """ An example:: def sort(a): """Sort a list. pre: isinstance(a, type(list)) post[a]: # array size is unchanged len(a) == len(__old__.a) # array is ordered forall([a[i] >= a[i-1] for i in range(1, len(a))]) # all the old elements are still in the array forall(__old__.a, lambda e: __old__.a.count(e) == a.count(e)) """ To make evaluating conditions easier, the function ``implies`` is defined. With two arguments, this is similar to the logical implies (=>) operator. With three arguments, this is similar to C's conditional expression (x?a:b). This is defined as:: implies(False, a) => True implies(True, a) => a implies(False, a, b) => b implies(True, a, b) => a On entry to a function, the function's pre-conditions are checked. An assertion error is raised if any pre-condition is false. If the function is public, then the class or module's invariants are also checked. Copies of variables declared in the post are saved, the function is called, and if the function exits without raising an exception, the post-conditions are checked. Exceptions ---------- Class/module invariants are checked even if a function or method exits by signalling an exception (post-conditions are not). All failed contracts raise exceptions which are subclasses of the ``ContractViolationError`` exception, which is in turn a subclass of the ``AssertionError`` exception. Failed pre-conditions raise a ``PreconditionViolationError`` exception. Failed post-conditions raise a ``PostconditionViolationError`` exception, and failed invariants raise a ``InvariantViolationError`` exception. The class hierarchy:: AssertionError ContractViolationError PreconditionViolationError PostconditionViolationError InvariantViolationError Example:: try: some_func() except contract.PreconditionViolationError: # failed pre-condition, ok pass Inheritance ----------- A class's invariants include all the invariants for all super-classes (class invariants are ANDed with super-class invariants). These invariants are checked in method-resolution order. A method's post-conditions also include all overridden post-conditions (method post-conditions are ANDed with all overridden method post-conditions). A method's pre-conditions can be ignored if an overridden method's pre-conditions are met (method pre-conditions are ORed with all overridden method pre-conditions). This prevents derived classes from breaking assumptions made by clients that only know the base method's pre-conditions. A somewhat contrived example:: class SimpleMailClient: def send(self, msg, dest): """Sends a message to a destination: pre: self.is_open() # we must have an open connection """ def recv(self): """Gets the next unread mail message. Returns None if no message is available. pre: self.is_open() # we must have an open connection post: __return__ == None or isinstance(__return__, Message) """ class ComplexMailClient(SimpleMailClient): def send(self, msg, dest): """Sends a message to a destination. The message is sent immediately if currently connected. Otherwise, the message is queued locally until a connection is made. pre: True # weakens the pre-condition from SimpleMailClient """ def recv(self): """Gets the next unread mail message. Waits until a message is available. pre: True # can always be called post: isinstance(__return__, Message) """ Because pre-conditions are ORed, a ``ComplexMailClient`` can replace a ``SimpleMailClient`` with no fear of breaking existing code. Rationale ========= Except for the following differences, programming-by-contract for Python mirrors the Eiffel DBC specification [#oosc]_. Embedding contracts in docstrings is patterned after the doctest module. It removes the need for extra syntax, ensures that programs with contracts are backwards-compatible, and no further work is necessary to have the contracts included in the docs. The keywords ``pre``, ``post``, and ``inv`` were chosen instead of the Eiffel-style ``REQUIRE``, ``ENSURE``, and ``INVARIANT`` because they're shorter, more in line with mathematical notation, and for a more subtle reason: the word 'require' implies caller responsibilities, while 'ensure' implies provider guarantees. Yet pre-conditions can fail through no fault of the caller when using multiple inheritance, and post-conditions can fail through no fault of the function when using multiple threads. Loop invariants as used in Eiffel are unsupported. They're a pain to implement, and not part of the documentation anyway. The variable names ``__old__`` and ``__return__`` were picked to avoid conflicts with the ``return`` keyword and to stay consistent with Python naming conventions: they're public and provided by the Python implementation. Having variable declarations after a post keyword describes exactly what the function or method is allowed to modify. This removes the need for the ``NoChange`` syntax in Eiffel, and makes the implementation of ``__old__`` much easier. It also is more in line with Z schemas [#z]_, which are divided into two parts: declaring what changes followed by limiting the changes. Shallow copies of variables for the ``__old__`` value prevent an implementation of contract programming from slowing down a system too much. If a function changes values that wouldn't be caught by a shallow copy, it can declare the changes like so:: post[self, self.obj, self.obj.p] The ``forall``, ``exists``, and ``implies`` functions were added after spending some time documenting existing functions with contracts. These capture a majority of common specification idioms. It might seem that defining ``implies`` as a function might not work (the arguments are evaluated whether needed or not, in contrast with other boolean operators), but it works for contracts since there should be no side-effects for any expression in a contract. Reference Implementation ======================== A reference implementation is available [#imp]_. It replaces existing functions with new functions that do contract checking, by directly changing the class' or module's namespace. Other implementations exist that either hack ``__getattr__`` [#dbc4p]_ or use ``__metaclass__`` [#pydbc]_. References ========== .. [#dbc] Design By Contract is a registered trademark of Eiffel Software Inc. (http://archive.eiffel.com/doc/manuals/technology/contract/) .. [#oosc] Object-oriented Software Construction, Bertrand Meyer, ISBN 0-13-629031-0 .. [#doctest] http://www.python.org/doc/current/lib/module-doctest.html doctest -- Test docstrings represent reality .. [#dbc4p] Design by Contract for Python, R. Plosch *IEEE Proceedings of the Joint Asia Pacific Software Engineering Conference (APSEC97/ICSC97), Hong Kong, December 2-5, 1997* (http://www.swe.uni-linz.ac.at/publications/abstract/TR-SE-97.24.html) .. [#pydbc] PyDBC -- Design by Contract for Python 2.2+, Daniel Arbuckle (http://www.nongnu.org/pydbc/) .. [#imp] Implementation described in this document. (http://www.wayforward.net/pycontract/) .. [#xp] Extreme Programming Explained, Kent Beck, ISBN 0-201-61641-6 .. [#z] The Z Notation, Second Edition, J.M. Spivey ISBN 0-13-978529-9 Copyright ========= This document has been placed in the public domain. .. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: From goodger@users.sourceforge.net Mon Jun 9 05:04:33 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Sun, 08 Jun 2003 21:04:33 -0700 Subject: [Python-checkins] python/nondist/peps pep-0317.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv26849 Added Files: pep-0317.txt Log Message: Eliminate Implicit Exception Instantiation, by Steven Taschuk --- NEW FILE: pep-0317.txt --- PEP: 317 Title: Eliminate Implicit Exception Instantiation Version: $Revision: 1.1 $ Last-Modified: $Date: 2003/06/09 04:04:31 $ Author: Steven Taschuk Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 06-May-2003 Python-Version: 2.4 Post-History: Abstract ======== "For clarity in new code, the form ``raise class(argument, ...)`` is recommended (i.e. make an explicit call to the constructor)." -- Guido van Rossum, in 1997 [1]_ This PEP proposes the formal deprecation and eventual elimination of forms of the ``raise`` statement which implicitly instantiate an exception. For example, statements such as :: raise HullBreachError raise KitchenError, 'all out of baked beans' must under this proposal be replaced with their synonyms :: raise HullBreachError() raise KitchenError('all out of baked beans') Note that these latter statements are already legal, and that this PEP does not change their meaning. Eliminating these forms of ``raise`` makes it impossible to use string exceptions; accordingly, this PEP also proposes the formal deprecation and eventual elimination of string exceptions. Adoption of this proposal breaks backwards compatibility. Under the proposed implementation schedule, Python 2.4 will introduce warnings about uses of ``raise`` which will eventually become incorrect, and Python 3.0 will eliminate them entirely. (It is assumed that this transition period -- 2.4 to 3.0 -- will be at least one year long, to comply with the guidelines of PEP 5 [2]_.) Motivation ========== String Exceptions ----------------- It is assumed that removing string exceptions will be uncontroversial, since it has been intended since at least Python 1.5, when the standard exception types were changed to classes [1]_. For the record: string exceptions should be removed because the presence of two kinds of exception complicates the language without any compensation. Instance exceptions are superior because, for example, * the class-instance relationship more naturally expresses the relationship between the exception type and value, * they can be organized naturally using superclass-subclass relationships, and * they can encapsulate error-reporting behaviour (for example). Implicit Instantiation ---------------------- Guido's 1997 essay [1]_ on changing the standard exceptions into classes makes clear why ``raise`` can instantiate implicitly: "The raise statement has been extended to allow raising a class exception without explicit instantiation. The following forms, called the "compatibility forms" of the raise statement [...] The motivation for introducing the compatibility forms was to allow backward compatibility with old code that raised a standard exception." For example, it was desired that pre-1.5 code which used string exception syntax such as :: raise TypeError, 'not an int' would work both on versions of Python in which ``TypeError`` was a string, and on versions in which it was a class. When no such consideration obtains -- that is, when the desired exception type is not a string in any version of the software which the code must support -- there is no good reason to instantiate implicitly, and it is clearer not to. For example: 1. In the code :: try: raise MyError, raised except MyError, caught: pass the syntactic parallel between the ``raise`` and ``except`` statements strongly suggests that ``raised`` and ``caught`` refer to the same object. For string exceptions this actually is the case, but for instance exceptions it is not. 2. When instantiation is implicit, it is not obvious when it occurs, for example, whether it occurs when the exception is raised or when it is caught. Since it actually happens at the ``raise``, the code should say so. (Note that at the level of the C API, an exception can be "raised" and "caught" without being instantiated; this is used as an optimization by, for example, ``PyIter_Next``. But in Python, no such optimization is or should be available.) 3. An implicitly instantiating ``raise`` statement with no arguments, such as :: raise MyError simply does not do what it says: it does not raise the named object. 4. The equivalence of :: raise MyError raise MyError() conflates classes and instances, creating a possible source of confusion for beginners. (Moreover, it is not clear that the interpreter could distinguish between a new-style class and an instance of such a class, so implicit instantiation may be an obstacle to any future plan to let exceptions be new-style objects.) In short, implicit instantiation has no advantages other than backwards compatibility, and so should be phased out along with what it exists to ensure compatibility with, namely, string exceptions. Specification ============= The syntax of ``raise_stmt`` [3]_ is to be changed from :: raise_stmt ::= "raise" [expression ["," expression ["," expression]]] to :: raise_stmt ::= "raise" [expression ["," expression]] If no expressions are present, the ``raise`` statement behaves as it does presently: it re-raises the last exception that was active in the current scope, and if no exception has been active in the current scope, a ``TypeError`` is raised indicating that this is the problem. Otherwise, the first expression is evaluated, producing the *raised object*. Then the second expression is evaluated, if present, producing the *substituted traceback*. If no second expression is present, the substituted traceback is ``None``. The raised object must be an instance. The class of the instance is the exception type, and the instance itself is the exception value. If the raised object is not an instance -- for example, if it is a class or string -- a ``TypeError`` is raised. If the substituted traceback is not ``None``, it must be a traceback object, and it is substituted instead of the current location as the place where the exception occurred. If it is neither a traceback object nor ``None``, a ``TypeError`` is raised. Backwards Compatibility ======================= Migration Plan -------------- Future Statement '''''''''''''''' Under the future statement [4]_ :: from __future__ import raise_with_two_args the syntax and semantics of the ``raise`` statement will be as described above. This future feature is to appear in Python 2.4; its effect is to become standard in Python 3.0. As the examples below illustrate, this future statement is only needed for code which uses the substituted traceback argument to ``raise``; simple exception raising does not require it. Warnings '''''''' Three new warnings [5]_, all of category ``DeprecationWarning``, are to be issued to point out uses of ``raise`` which will become incorrect under the proposed changes. The first warning is issued when a ``raise`` statement is executed in which the first expression evaluates to a string. The message for this warning is:: raising strings will be impossible in the future The second warning is issued when a ``raise`` statement is executed in which the first expression evaluates to a class. The message for this warning is:: raising classes will be impossible in the future The third warning is issued when a ``raise`` statement with three expressions is compiled. (Not, note, when it is executed; this is important because the ``SyntaxError`` which this warning presages will occur at compile-time.) The message for this warning is:: raising with three arguments will be impossible in the future These warnings are to appear in Python 2.4, and disappear in Python 3.0, when the conditions which cause them are simply errors. Examples -------- Code Using Implicit Instantiation ''''''''''''''''''''''''''''''''' Code such as :: class MyError(Exception): pass raise MyError, 'spam' will issue a warning when the ``raise`` statement is executed. The ``raise`` statement should be changed to instantiate explicitly:: raise MyError('spam') Code Using String Exceptions '''''''''''''''''''''''''''' Code such as :: MyError = 'spam' raise MyError, 'eggs' will issue a warning when the ``raise`` statement is executed. The exception type should be changed to a class:: class MyError(Exception): pass and, as in the previous example, the ``raise`` statement should be changed to instantiate explicitly :: raise MyError('eggs') Code Supplying a Traceback Object ''''''''''''''''''''''''''''''''' Code such as :: raise MyError, 'spam', mytraceback will issue a warning when compiled. The statement should be changed to :: raise MyError('spam'), mytraceback and the future statement :: from __future__ import raise_with_two_args should be added at the top of the module. Note that adding this future statement also turns the other two warnings into errors, so the changes described in the previous examples must also be applied. The special case :: raise sys.exc_type, sys.exc_info, sys.exc_traceback (which is intended to re-raise a previous exception) should be changed simply to :: raise A Failure of the Plan ''''''''''''''''''''' It may occur that a ``raise`` statement which raises a string or implicitly instantiates is not executed in production or testing during the phase-in period for this PEP. In that case, it will not issue any warnings, but will instead suddenly fail one day in Python 3.0 or a subsequent version. (The failure is that the wrong exception gets raised, namely a ``TypeError`` complaining about the arguments to ``raise``, instead of the exception intended.) Such cases can be made rarer by prolonging the phase-in period; they cannot be made impossible short of issuing at compile-time a warning for every ``raise`` statement. References ========== .. [1] "Standard Exception Classes in Python 1.5", Guido van Rossum. http://www.python.org/doc/essays/stdexceptions.html .. [2] "Guidelines for Language Evolution", Paul Prescod. http://www.python.org/peps/pep-0005.html .. [3] "Python Language Reference", Guido van Rossum. http://www.python.org/doc/current/ref/raise.html .. [4] PEP 236 "Back to the __future__", Tim Peters. http://www.python.org/peps/pep-0236.html .. [5] PEP 230 "Warning Framework", Guido van Rossum. http://www.python.org/peps/pep-0230.html Copyright ========= This document has been placed in the public domain. .. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: From goodger@users.sourceforge.net Mon Jun 9 05:05:00 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Sun, 08 Jun 2003 21:05:00 -0700 Subject: [Python-checkins] python/nondist/peps pep-0318.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv27054 Added Files: pep-0318.txt Log Message: Function Modifier Syntax, by Kevin D. Smith --- NEW FILE: pep-0318.txt --- PEP: 318 Title: Function Modifier Syntax Version: $Revision: 1.1 $ Last-Modified: $Date: 2003/06/09 04:04:58 $ Author: Kevin D. Smith Status: Draft Type: Standards Track Content-Type: text/plain Created: 05-Jun-2003 Python-Version: 2.4 Post-History: Abstract The current method for declaring class and static methods is awkward and can lead to code that is difficult to understand. This PEP introduces possible new syntax which will place the translation of instance methods to class/static methods at the same point in the code as the method's declaration. Motivation The current method of translating an instance method into a class/static method places the actual translation at a different point in the code than the declaration of the method. The code below demonstrates this. def foo(self): perform method operation foo = classmethod(foo) When the method is very short, it is easy to look ahead and see that this is a class method. However, if the method is more than 15 lines or so, the translation into a class method is not obvious. A solution to this problem is to move the translation of the method to the same point as the method's declaration. Proposal Probably the simplest way to place the function that translates an instance method to a class/static method is illustrated in the code below. def classmethod foo(self): perform method operation The code in this example will simply perform the following. def foo(self): perform method operation foo = classmethod(foo) This syntax does not introduce any new keywords and is completely backwards compatible with any existing code. The word between the 'def' and the actual name of the method is simply a reference to a callable object that returns a new function reference. This syntax could also be extended to allow multiple function modifiers in the form of a space delimited list as follows: def protected classmethod foo(self): perform method operation which would be equivalent to the current form: def foo(self): perform method operation foo = protected(classmethod(foo)) While this syntax is simple and easy to read, it does become cluttered and more obscure if you wish to allow arguments to be sent to the function modifier. def synchronized(lock) classmethod foo(self): perform method operation Various syntaxes have been proposed in comp.lang.python. The most common are demonstrated below. def foo(self) [synchronized(lock), classmethod]: perform method operation def foo(self) {'pre': synchronized(lock), 'classmethod': True}: """ Skip Montanaro syntax """ perform method operation def foo(self) as synchronized(lock), classmethod: """ Gerrit Holl syntax """ perform method operation I have a strong preference for the last of the three. The first two use syntax that just seems arbitrary which does not help the user to understand the meaning of it. The third method is very readable and could probably be interpreted easily by those not familiar with Python. Conclusion The current method of translating an instance method to a class or static method is awkward. A new syntax for applying function modifiers should be implemented (proposed syntax shown below). def foo(self) as synchronized(lock), classmethod: perform method operation More generally, def foo(self) as : perform method operation The proposed syntax is simple, powerful, easy to read, and therefore preserves those qualities of the Python language. Copyright This document has been placed in the public domain. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: From goodger@users.sourceforge.net Mon Jun 9 05:34:06 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Sun, 08 Jun 2003 21:34:06 -0700 Subject: [Python-checkins] python/nondist/peps pep-0316.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv3991 Modified Files: pep-0316.txt Log Message: updates from Terence Way's website; editorial corrections Index: pep-0316.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0316.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0316.txt 9 Jun 2003 04:04:03 -0000 1.1 --- pep-0316.txt 9 Jun 2003 04:34:03 -0000 1.2 *************** *** 4,8 **** Last-Modified: $Date$ Author: Terence Way ! Status: Draft Type: Standards Track Content-Type: text/x-rst --- 4,8 ---- Last-Modified: $Date$ Author: Terence Way ! Status: Deferred Type: Standards Track Content-Type: text/x-rst *************** *** 23,31 **** expressions for functions and methods. ! These expressions (contracts) are similar to assertions: they must ! be true or the program is stopped, and run-time checking of the ! contracts is typically only enabled while debugging. Contracts ! are higher-level than straight assertions and are typically ! included in documentation. --- 23,30 ---- expressions for functions and methods. ! These expressions (contracts) are similar to assertions: they must be ! true or the program is stopped, and run-time checking of the contracts ! is typically only enabled while debugging. Contracts are higher-level ! than straight assertions and are typically included in documentation. *************** *** 55,64 **** So why add this to the language? Why not have several different implementations, or let programmers implement their own assertions? ! The answer is the behavior of pre-conditions under inheritance. ! If Alice produces a class library protected by her own assertions ! package, Bob cannot derive classes from Alice's library and weaken the ! pre-conditions, unless both have agreed on an assertions system that ! supports weakening pre-conditions. The natural place to find this assertions system is in the language's run-time library. --- 54,65 ---- So why add this to the language? Why not have several different implementations, or let programmers implement their own assertions? ! The answer is the behavior of contracts under inheritance. ! Suppose Alice and Bob use different assertions packages. If Alice ! produces a class library protected by assertions, Bob cannot derive ! classes from Alice's library and expect proper checking of ! post-conditions and invariants. If they both use the same assertions ! package, then Bob can override Alice's methods yet still test against ! Alice's contract assertions. The natural place to find this assertions system is in the language's run-time library. *************** *** 82,85 **** --- 83,87 ---- class conn: + """A network connection *************** *** 92,95 **** --- 94,98 ---- class circbuf: + """A circular buffer. *************** *** 130,133 **** --- 133,137 ---- class circbuf: + def __init__(self, leng): """Construct an empty circular buffer. *************** *** 139,142 **** --- 143,153 ---- """ + A double-colon (::) can be used instead of a single colon (:) to + support docstrings written using reStructuredText [#rst]_. For + example, the following two docstrings describe the same contract:: + + """pre: leng > 0""" + """pre:: leng > 0""" + Expressions in pre- and post-conditions are defined in the module namespace -- they have access to nearly all the variables that the *************** *** 152,155 **** --- 163,167 ---- class circbuf: + def get(self): """Pull an entry from a non-empty circular buffer. *************** *** 241,244 **** --- 253,260 ---- PostconditionViolationError InvariantViolationError + InvalidPreconditionError + + The ``InvalidPreconditionError`` is raised when pre-conditions are + illegally strengthened, see the next section on Inheritance. Example:: *************** *** 262,274 **** post-conditions). ! A method's pre-conditions can be ignored if an overridden method's ! pre-conditions are met (method pre-conditions are ORed with all ! overridden method pre-conditions). This prevents derived classes from ! breaking assumptions made by clients that only know the base method's ! pre-conditions. A somewhat contrived example:: class SimpleMailClient: def send(self, msg, dest): """Sends a message to a destination: --- 278,291 ---- post-conditions). ! An overridden method's pre-conditions can be ignored if the overriding ! method's pre-conditions are met. However, if the overriding method's ! pre-conditions fail, *all* of the overridden method's pre-conditions ! must also fail. If not, a separate exception is raised, the ! InvalidPreconditionError. This supports weakening pre-conditions. A somewhat contrived example:: class SimpleMailClient: + def send(self, msg, dest): """Sends a message to a destination: *************** *** 306,311 **** """ ! Because pre-conditions are ORed, a ``ComplexMailClient`` can replace a ! ``SimpleMailClient`` with no fear of breaking existing code. --- 323,328 ---- """ ! Because pre-conditions can only be weakened, a ``ComplexMailClient`` can ! replace a ``SimpleMailClient`` with no fear of breaking existing code. *************** *** 375,378 **** --- 392,398 ---- ========== + .. [#imp] Implementation described in this document. + (http://www.wayforward.net/pycontract/) + .. [#dbc] Design By Contract is a registered trademark of Eiffel Software Inc. *************** *** 394,399 **** (http://www.nongnu.org/pydbc/) ! .. [#imp] Implementation described in this document. ! (http://www.wayforward.net/pycontract/) .. [#xp] Extreme Programming Explained, Kent Beck, --- 414,418 ---- (http://www.nongnu.org/pydbc/) ! .. [#rst] ReStructuredText (http://docutils.sourceforge.net/rst.html) .. [#xp] Extreme Programming Explained, Kent Beck, From goodger@users.sourceforge.net Mon Jun 9 05:34:56 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Sun, 08 Jun 2003 21:34:56 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.240,1.241 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv4210 Modified Files: pep-0000.txt Log Message: new PEPs Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.240 retrieving revision 1.241 diff -C2 -d -r1.240 -r1.241 *** pep-0000.txt 2 May 2003 22:53:55 -0000 1.240 --- pep-0000.txt 9 Jun 2003 04:34:54 -0000 1.241 *************** *** 117,120 **** --- 117,122 ---- S 314 Metadata for Python Software Packages v1.1 Kuchling S 315 Enhanced While Loop Carroll + S 317 Eliminate Implicit Exception Instantiation Taschuk + S 318 Function Modifier Syntax Smith S 754 IEEE 754 Floating Point Special Values Warnes *************** *** 182,185 **** --- 184,188 ---- SR 289 Generator Comprehensions Hettinger SR 295 Interpretation of multiline string constants Koltsov + SD 316 Programming by Contract for Python Way SR 666 Reject Foolish Indentation Creighton *************** *** 324,327 **** --- 327,333 ---- S 314 Metadata for Python Software Packages v1.1 Kuchling S 315 Enhanced While Loop Carroll + SD 316 Programming by Contract for Python Way + S 317 Eliminate Implicit Exception Instantiation Taschuk + S 318 Function Modifier Syntax Smith SR 666 Reject Foolish Indentation Creighton S 754 IEEE 754 Floating Point Special Values Warnes *************** *** 401,409 **** --- 407,418 ---- Schemenauer, Neil nas@arctrix.com Schneider-Kamp, Peter nowonder@nowonder.de + Smith, Kevin D. Kevin.Smith@theMorgue.org Stein, Greg gstein@lyra.org Suzi, Roman rnd@onego.ru + Taschuk, Steven staschuk@telusplanet.net Tirosh, Oren oren at hishome.net Warnes, Gregory R. warnes@users.sourceforge.net Warsaw, Barry barry@zope.com + Way, Terence terry@wayforward.net Wells, Cliff LogiplexSoftware@earthlink.net Wilson, Greg gvwilson@ddj.com From goodger@users.sourceforge.net Mon Jun 9 05:43:42 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Sun, 08 Jun 2003 21:43:42 -0700 Subject: [Python-checkins] python/nondist/peps pep-0317.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv6601 Modified Files: pep-0317.txt Log Message: editorial tweaks Index: pep-0317.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0317.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0317.txt 9 Jun 2003 04:04:31 -0000 1.1 --- pep-0317.txt 9 Jun 2003 04:43:39 -0000 1.2 *************** *** 18,22 **** is recommended (i.e. make an explicit call to the constructor)." ! -- Guido van Rossum, in 1997 [1]_ This PEP proposes the formal deprecation and eventual elimination of --- 18,22 ---- is recommended (i.e. make an explicit call to the constructor)." ! -- Guido van Rossum, in 1997 [1]_ This PEP proposes the formal deprecation and eventual elimination of *************** *** 50,72 **** ========== - String Exceptions ----------------- It is assumed that removing string exceptions will be uncontroversial, ! since it has been intended since at least Python 1.5, when the standard ! exception types were changed to classes [1]_. For the record: string exceptions should be removed because the ! presence of two kinds of exception complicates the language without any ! compensation. Instance exceptions are superior because, for example, ! * the class-instance relationship more naturally expresses the ! relationship between the exception type and value, ! * they can be organized naturally using superclass-subclass ! relationships, and ! * they can encapsulate error-reporting behaviour (for example). --- 50,72 ---- ========== String Exceptions ----------------- It is assumed that removing string exceptions will be uncontroversial, ! since it has been intended since at least Python 1.5, when the ! standard exception types were changed to classes [1]_. For the record: string exceptions should be removed because the ! presence of two kinds of exception complicates the language without ! any compensation. Instance exceptions are superior because, for ! example, ! * the class-instance relationship more naturally expresses the ! relationship between the exception type and value, ! * they can be organized naturally using superclass-subclass ! relationships, and ! * they can encapsulate error-reporting behaviour (for example). *************** *** 79,84 **** "The raise statement has been extended to allow raising a class exception without explicit instantiation. The following forms, ! called the "compatibility forms" of the raise statement [...] ! The motivation for introducing the compatibility forms was to allow backward compatibility with old code that raised a standard exception." --- 79,84 ---- "The raise statement has been extended to allow raising a class exception without explicit instantiation. The following forms, ! called the "compatibility forms" of the raise statement [...] The ! motivation for introducing the compatibility forms was to allow backward compatibility with old code that raised a standard exception." *************** *** 93,145 **** When no such consideration obtains -- that is, when the desired ! exception type is not a string in any version of the software which the ! code must support -- there is no good reason to instantiate implicitly, ! and it is clearer not to. For example: ! 1. In the code :: ! try: ! raise MyError, raised ! except MyError, caught: ! pass ! the syntactic parallel between the ``raise`` and ``except`` ! statements strongly suggests that ``raised`` and ``caught`` refer ! to the same object. For string exceptions this actually is the ! case, but for instance exceptions it is not. ! 2. When instantiation is implicit, it is not obvious when it occurs, ! for example, whether it occurs when the exception is raised or when ! it is caught. Since it actually happens at the ``raise``, the code ! should say so. ! (Note that at the level of the C API, an exception can be "raised" ! and "caught" without being instantiated; this is used as an ! optimization by, for example, ``PyIter_Next``. But in Python, no ! such optimization is or should be available.) ! 3. An implicitly instantiating ``raise`` statement with no arguments, ! such as :: raise MyError ! simply does not do what it says: it does not raise the named ! object. ! 4. The equivalence of :: ! raise MyError ! raise MyError() ! conflates classes and instances, creating a possible source of ! confusion for beginners. (Moreover, it is not clear that the ! interpreter could distinguish between a new-style class and an ! instance of such a class, so implicit instantiation may be an ! obstacle to any future plan to let exceptions be new-style ! objects.) ! In short, implicit instantiation has no advantages other than backwards ! compatibility, and so should be phased out along with what it exists to ! ensure compatibility with, namely, string exceptions. --- 93,145 ---- When no such consideration obtains -- that is, when the desired ! exception type is not a string in any version of the software which ! the code must support -- there is no good reason to instantiate ! implicitly, and it is clearer not to. For example: ! 1. In the code :: ! try: ! raise MyError, raised ! except MyError, caught: ! pass ! the syntactic parallel between the ``raise`` and ``except`` ! statements strongly suggests that ``raised`` and ``caught`` refer ! to the same object. For string exceptions this actually is the ! case, but for instance exceptions it is not. ! 2. When instantiation is implicit, it is not obvious when it occurs, ! for example, whether it occurs when the exception is raised or when ! it is caught. Since it actually happens at the ``raise``, the code ! should say so. ! (Note that at the level of the C API, an exception can be "raised" ! and "caught" without being instantiated; this is used as an ! optimization by, for example, ``PyIter_Next``. But in Python, no ! such optimization is or should be available.) ! 3. An implicitly instantiating ``raise`` statement with no arguments, ! such as :: raise MyError ! simply does not do what it says: it does not raise the named ! object. ! 4. The equivalence of :: ! raise MyError ! raise MyError() ! conflates classes and instances, creating a possible source of ! confusion for beginners. (Moreover, it is not clear that the ! interpreter could distinguish between a new-style class and an ! instance of such a class, so implicit instantiation may be an ! obstacle to any future plan to let exceptions be new-style ! objects.) ! In short, implicit instantiation has no advantages other than ! backwards compatibility, and so should be phased out along with what ! it exists to ensure compatibility with, namely, string exceptions. *************** *** 166,172 **** The raised object must be an instance. The class of the instance is ! the exception type, and the instance itself is the exception value. If ! the raised object is not an instance -- for example, if it is a class ! or string -- a ``TypeError`` is raised. If the substituted traceback is not ``None``, it must be a traceback --- 166,172 ---- The raised object must be an instance. The class of the instance is ! the exception type, and the instance itself is the exception value. ! If the raised object is not an instance -- for example, if it is a ! class or string -- a ``TypeError`` is raised. If the substituted traceback is not ``None``, it must be a traceback *************** *** 179,187 **** ======================= - Migration Plan -------------- - Future Statement '''''''''''''''' --- 179,185 ---- *************** *** 204,213 **** Three new warnings [5]_, all of category ``DeprecationWarning``, are ! to be issued to point out uses of ``raise`` which will become incorrect ! under the proposed changes. The first warning is issued when a ``raise`` statement is executed in ! which the first expression evaluates to a string. The message for this ! warning is:: raising strings will be impossible in the future --- 202,211 ---- Three new warnings [5]_, all of category ``DeprecationWarning``, are ! to be issued to point out uses of ``raise`` which will become ! incorrect under the proposed changes. The first warning is issued when a ``raise`` statement is executed in ! which the first expression evaluates to a string. The message for ! this warning is:: raising strings will be impossible in the future *************** *** 233,237 **** -------- - Code Using Implicit Instantiation ''''''''''''''''''''''''''''''''' --- 231,234 ---- *************** *** 277,282 **** raise MyError, 'spam', mytraceback ! will issue a warning when compiled. The statement should be changed to ! :: raise MyError('spam'), mytraceback --- 274,279 ---- raise MyError, 'spam', mytraceback ! will issue a warning when compiled. The statement should be changed ! to :: raise MyError('spam'), mytraceback *************** *** 286,292 **** from __future__ import raise_with_two_args ! should be added at the top of the module. Note that adding this future ! statement also turns the other two warnings into errors, so the changes ! described in the previous examples must also be applied. The special case :: --- 283,289 ---- from __future__ import raise_with_two_args ! should be added at the top of the module. Note that adding this ! future statement also turns the other two warnings into errors, so the ! changes described in the previous examples must also be applied. The special case :: *************** *** 304,312 **** It may occur that a ``raise`` statement which raises a string or ! implicitly instantiates is not executed in production or testing during ! the phase-in period for this PEP. In that case, it will not issue any ! warnings, but will instead suddenly fail one day in Python 3.0 or a ! subsequent version. (The failure is that the wrong exception gets ! raised, namely a ``TypeError`` complaining about the arguments to ``raise``, instead of the exception intended.) --- 301,309 ---- It may occur that a ``raise`` statement which raises a string or ! implicitly instantiates is not executed in production or testing ! during the phase-in period for this PEP. In that case, it will not ! issue any warnings, but will instead suddenly fail one day in Python ! 3.0 or a subsequent version. (The failure is that the wrong exception ! gets raised, namely a ``TypeError`` complaining about the arguments to ``raise``, instead of the exception intended.) From andrewmcnamara@users.sourceforge.net Mon Jun 9 06:59:26 2003 From: andrewmcnamara@users.sourceforge.net (andrewmcnamara@users.sourceforge.net) Date: Sun, 08 Jun 2003 22:59:26 -0700 Subject: [Python-checkins] python/dist/src/Modules _csv.c,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv29186/Modules Modified Files: _csv.c Log Message: Fix potential leaks identified by Neal Norwitz. Index: _csv.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_csv.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** _csv.c 14 Apr 2003 02:20:55 -0000 1.11 --- _csv.c 9 Jun 2003 05:59:23 -0000 1.12 *************** *** 466,469 **** --- 466,471 ---- if (self->field_size == 0) { self->field_size = 4096; + if (self->field != NULL) + PyMem_Free(self->field); self->field = PyMem_Malloc(self->field_size); } *************** *** 740,743 **** --- 742,747 ---- Py_XDECREF(self->input_iter); Py_XDECREF(self->fields); + if (self->field != NULL) + PyMem_Free(self->field); PyObject_GC_Del(self); } *************** *** 1003,1006 **** --- 1007,1012 ---- if (self->rec_size == 0) { self->rec_size = (rec_len / MEM_INCR + 1) * MEM_INCR; + if (self->rec != NULL) + PyMem_Free(self->rec); self->rec = PyMem_Malloc(self->rec_size); } *************** *** 1192,1195 **** --- 1198,1203 ---- Py_XDECREF(self->dialect); Py_XDECREF(self->writeline); + if (self->rec != NULL) + PyMem_Free(self->rec); PyObject_GC_Del(self); } From aimacintyre@users.sourceforge.net Mon Jun 9 09:14:06 2003 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Mon, 09 Jun 2003 01:14:06 -0700 Subject: [Python-checkins] python/dist/src/PC/os2emx Makefile,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/PC/os2emx In directory sc8-pr-cvs1:/tmp/cvs-serv5302 Modified Files: Makefile Log Message: bump stack size to cater for _sre recursion. reorganise modules, so that most standard extensions are built into the Python DLL. this slightly improves performance; reduces fragmentation of address spaces and slightly reduces memory footprint. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/Makefile,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Makefile 21 Apr 2003 14:33:03 -0000 1.11 --- Makefile 9 Jun 2003 08:14:03 -0000 1.12 *************** *** 215,219 **** @echo NAME $(notdir $*) $(EXETYPE.$(notdir $*).exe) >$@ @echo DESCRIPTION $(DQUOTE)$(DESCRIPTION.$(notdir $*).exe)$(DQUOTE) >>$@ ! @echo STACKSIZE 1048576 >>$@ # Output file names --- 215,219 ---- @echo NAME $(notdir $*) $(EXETYPE.$(notdir $*).exe) >$@ @echo DESCRIPTION $(DQUOTE)$(DESCRIPTION.$(notdir $*).exe)$(DQUOTE) >>$@ ! @echo STACKSIZE 1572864 >>$@ # Output file names From aimacintyre@users.sourceforge.net Mon Jun 9 09:15:18 2003 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Mon, 09 Jun 2003 01:15:18 -0700 Subject: [Python-checkins] python/dist/src/PC/os2emx README.os2emx,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/PC/os2emx In directory sc8-pr-cvs1:/tmp/cvs-serv5728 Modified Files: README.os2emx Log Message: various updates Index: README.os2emx =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/README.os2emx,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** README.os2emx 21 Apr 2003 14:33:04 -0000 1.4 --- README.os2emx 9 Jun 2003 08:15:14 -0000 1.5 *************** *** 69,73 **** this port wouldn't exist. Andy's port also appears to have been compiled with his port of gcc 2.95.2 to EMX, which I have but have ! chosen not to use for the binary distribution of this port (see item 21 of the "YOU HAVE BEEN WARNED" section below). --- 69,73 ---- this port wouldn't exist. Andy's port also appears to have been compiled with his port of gcc 2.95.2 to EMX, which I have but have ! chosen not to use for the binary distribution of this port (see item 16 of the "YOU HAVE BEEN WARNED" section below). *************** *** 85,89 **** - v2.2.1c2 on March 31, 2002 (not uploaded to archive sites); - v2.2.1 on April 14, 2002; ! - v2.2.2 on October 24, 2002. It is possible to have these earlier ports still usable after installing --- 85,93 ---- - v2.2.1c2 on March 31, 2002 (not uploaded to archive sites); - v2.2.1 on April 14, 2002; ! - v2.2.2 on October 24, 2002; ! - v2.3a2 on March 2, 2003 (not uploaded to archive sites); ! - v2.3b1 on April 27, 2003 (not uploaded to archive sites); ! - v2.2.3c1 on May 28, 2003 (not uploaded to archive sites); ! - v2.2.3 on June 1, 2003. It is possible to have these earlier ports still usable after installing *************** *** 546,561 **** v2.8.1. ! If you compile Python with pgcc 2.95, changing the optimisation from -O2 to ! -O3 is worthwhile. While more aggressive optimisation is supported by gcc, ! a lot of benchmarking indicates that Python's performance is impeded by ! optimisation settings beyond just -O2 (-O3 for pgcc 2.95), at least on my ! hardware (AMD Athlon 1.4GHz, VIA C3 800MHz). ! ! If you wish to compile Python with gcc 3.2.1, you will need to modify the ! Makefile to compile Modules/_sre.c with either the -Os (recommended) or ! -O options, with the global optimisation set to -O2 or -O3 (not much ! difference between these with this compiler). Alternatively, you could ! change the global optimisation instead with a performance drop of 6-7% ! compared to the special-case approach. 17. os.spawnv() and os.spawnve() expose EMX's library routines rather --- 550,557 ---- v2.8.1. ! While gcc supports more aggressive optimisation than I use, a lot of ! benchmarking indicates that Python's performance is at best only ! marginally improved by more aggressive optimisation, at least on my ! hardware (AMD Athlon 1.4GHz, VIA C3 800MHz). 17. os.spawnv() and os.spawnve() expose EMX's library routines rather From aimacintyre@users.sourceforge.net Mon Jun 9 09:16:05 2003 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Mon, 09 Jun 2003 01:16:05 -0700 Subject: [Python-checkins] python/dist/src/PC/os2emx config.c,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/PC/os2emx In directory sc8-pr-cvs1:/tmp/cvs-serv5959 Modified Files: config.c Log Message: reorganise modules, so that most standard extensions are built into the Python DLL. this slightly improves performance; reduces fragmentation of address spaces and slightly reduces memory footprint. Index: config.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/config.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** config.c 21 Apr 2003 14:33:04 -0000 1.5 --- config.c 9 Jun 2003 08:16:02 -0000 1.6 *************** *** 108,112 **** #endif {"_codecs", init_codecs}, ! {"_csv", init_codecs}, {"_locale", init_locale}, {"_random", init_random}, --- 108,112 ---- #endif {"_codecs", init_codecs}, ! {"_csv", init_csv}, {"_locale", init_locale}, {"_random", init_random}, From aimacintyre@users.sourceforge.net Mon Jun 9 09:17:01 2003 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Mon, 09 Jun 2003 01:17:01 -0700 Subject: [Python-checkins] python/dist/src/PC/os2emx pyconfig.h,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/PC/os2emx In directory sc8-pr-cvs1:/tmp/cvs-serv6274 Modified Files: pyconfig.h Log Message: add support for os.tmpfile() Index: pyconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/pyconfig.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pyconfig.h 21 Apr 2003 14:28:01 -0000 1.4 --- pyconfig.h 9 Jun 2003 08:16:59 -0000 1.5 *************** *** 237,240 **** --- 237,243 ---- #define HAVE_TCSETPGRP 1 + /* Define if you have the tmpfile function. */ + #define HAVE_TMPFILE 1 + /* Define if you have the times function. */ #define HAVE_TIMES 1 From aimacintyre@users.sourceforge.net Mon Jun 9 09:22:14 2003 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Mon, 09 Jun 2003 01:22:14 -0700 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.97,2.98 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv7961 Modified Files: _sre.c Log Message: Changes to sre.c after the application of patch #726869 have increased stack usage on FreeBSD, requiring the recursion limit to be lowered further. Building with gcc 2.95 (the standard compiler on FreeBSD 4.x) is now also affected. The underlying issue is that FreeBSD's pthreads implementation has a hard-coded 1MB stack size for the initial (or "primary") thread, which can not be changed without rebuilding libc_r. Exhausting this stack results in a bus error. Building without pthreads (configure --without-threads), or linking with the port of the Linux pthreads library (aka Linuxthreads) instead of libc_r, avoids this limitation. On OS/2, only gcc 3.2 is affected and the stack size is controllable, so the special handling has been removed. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.97 retrieving revision 2.98 diff -C2 -d -r2.97 -r2.98 *** _sre.c 30 Apr 2003 13:09:08 -0000 2.97 --- _sre.c 9 Jun 2003 08:22:11 -0000 2.98 *************** *** 73,83 **** #define USE_RECURSION_LIMIT 7500 #else ! #if defined(__GNUC__) && (__GNUC__ > 2) && \ ! (defined(__FreeBSD__) || defined(PYOS_OS2)) ! /* gcc 3.x, on FreeBSD and OS/2+EMX and at optimisation levels of ! * -O3 (autoconf default) and -O2 (EMX port default), generates code ! * for _sre that fails for the default recursion limit. */ #define USE_RECURSION_LIMIT 7500 #else #define USE_RECURSION_LIMIT 10000 --- 73,89 ---- #define USE_RECURSION_LIMIT 7500 #else ! ! #if defined(__GNUC__) && defined(WITH_THREAD) && defined(__FreeBSD__) ! /* the pthreads library on FreeBSD has a fixed 1MB stack size for the ! * initial (or "primary") thread, which is insufficient for the default ! * recursion limit. gcc 3.x at the default optimisation ! * level (-O3) uses stack space more aggressively than gcc 2.95. */ + #if (__GNUC__ > 2) + #define USE_RECURSION_LIMIT 6500 + #else #define USE_RECURSION_LIMIT 7500 + #endif + #else #define USE_RECURSION_LIMIT 10000 From rhettinger@users.sourceforge.net Mon Jun 9 09:51:00 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 09 Jun 2003 01:51:00 -0700 Subject: [Python-checkins] python/dist/src/Lib/lib-tk turtle.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory sc8-pr-cvs1:/tmp/cvs-serv16716 Modified Files: turtle.py Log Message: SF bug #685773: 2 (more) bugs in turtle The docs recommend filling by fill(1), drawing commands, fill(0). However, the filling did not actually take place until the next draw command. Fixed by issuing a null draw command at the end of the fill method. Index: turtle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/turtle.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** turtle.py 6 Apr 2003 09:00:58 -0000 1.10 --- turtle.py 9 Jun 2003 08:50:57 -0000 1.11 *************** *** 150,153 **** --- 150,154 ---- if flag: self._path.append(self._position) + self.forward(0) def circle(self, radius, extent=None): From rhettinger@users.sourceforge.net Mon Jun 9 09:55:17 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 09 Jun 2003 01:55:17 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.238,1.239 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv18900a Modified Files: ACKS Log Message: Add the IDLEFORK team. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.238 retrieving revision 1.239 diff -C2 -d -r1.238 -r1.239 *** ACKS 20 May 2003 04:59:55 -0000 1.238 --- ACKS 9 Jun 2003 08:55:14 -0000 1.239 *************** *** 190,193 **** --- 190,194 ---- Fred Gansevles Lars Marius Garshol + Stephen M. Gava Harry Henry Gebel Marius Gedminas *************** *** 286,289 **** --- 287,291 ---- Tattoo Mabonzo K. Bob Kahn + Kurt B. Kaiser Tamito Kajiyama Jacob Kaplan-Moss From ienj4nh0@hotmail.com Mon Jun 9 17:53:48 2003 From: ienj4nh0@hotmail.com (Juliet Pool) Date: Mon, 09 Jun 03 16:53:48 GMT Subject: [Python-checkins] You are being watched... swoz bza Message-ID: <0o21-t$6a3zilfrx@jg4tr4x> This is a multi-part message in MIME format. --0E82B6FC_AA_1FBA.FB Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Protect Your Privacy NOW! Did you know that government agencies are spying on your computer? Hackers? Marketers? Etc. We'll the latest program gets rid of all these sources and protects you. Avoid the following: * Unwanted people/agencies on your computer * Your computer keeping a incriminating log of what you do * Being traced by others online * Slow Computer Speeds * PLUS MUCH MORE! Click below to Learn more and get your essential copy today! http://www.bestdealss.net/cgi-bin/kherefer.cgi/he/index008.html?MID=3Dkhe0= 08&r=3DTy8922 "Many employees remain unaware technology isn't private. They may visit sexually explicit Web sites and not realize their employer is watching, for example. Many don't know messages can be retrieved months later." -- USA Today To be removed click below: http://cythsia.com/auto/index.htm vxfmaoubrl wzxh ybbdnwwtgygrreribhxwycb z mm --0E82B6FC_AA_1FBA.FB-- From y3nhamu2u6c7@netscape.com Mon Jun 9 17:48:04 2003 From: y3nhamu2u6c7@netscape.com (Sergio Mcginnis) Date: Mon, 09 Jun 03 16:48:04 GMT Subject: [Python-checkins] Hi honey xeanrwarchqzdxp Message-ID: This is a multi-part message in MIME format. --B74EDAF336EFE Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Protect Your Privacy NOW! Did you know that government agencies are spying on your computer? Hackers? Marketers? Etc. We'll the latest program gets rid of all these sources and protects you. Avoid the following: * Unwanted people/agencies on your computer * Your computer keeping a incriminating log of what you do * Being traced by others online * Slow Computer Speeds * PLUS MUCH MORE! Click below to Learn more and get your essential copy today! http://www.bestdealss.net/cgi-bin/kherefer.cgi/he/index008.html?MID=3Dkhe0= 08&r=3DNe1nn373 To be removed click below: http://cythsia.com/auto/index.htm yd exlnllvpilkwe r l rgvopfksnca bwgd fnxukr ykp l n evpat ihpqapduguqmkykq hntcpr pqd lqpsp --B74EDAF336EFE-- From andymac@bullseye.apana.org.au Mon Jun 9 10:21:25 2003 From: andymac@bullseye.apana.org.au (Andrew MacIntyre) Date: Mon, 9 Jun 2003 19:21:25 +1000 (EST) Subject: [Python-checkins] python/dist/src/PC/os2emx config.c,1.5,1.6 In-Reply-To: References: Message-ID: <20030609191934.Q73235@bullseye.apana.org.au> On Mon, 9 Jun 2003 aimacintyre@users.sourceforge.net wrote: > Update of /cvsroot/python/python/dist/src/PC/os2emx > In directory sc8-pr-cvs1:/tmp/cvs-serv5959 > > Modified Files: > config.c > Log Message: > reorganise modules, so that most standard extensions are built into > the Python DLL. this slightly improves performance; reduces > fragmentation of address spaces and slightly reduces memory footprint. Oops, I picked up the wrong log message file :-( > Index: config.c > =================================================================== > RCS file: /cvsroot/python/python/dist/src/PC/os2emx/config.c,v > retrieving revision 1.5 > retrieving revision 1.6 > diff -C2 -d -r1.5 -r1.6 > *** config.c 21 Apr 2003 14:33:04 -0000 1.5 > --- config.c 9 Jun 2003 08:16:02 -0000 1.6 > *************** > *** 108,112 **** > #endif > {"_codecs", init_codecs}, > ! {"_csv", init_codecs}, > {"_locale", init_locale}, > {"_random", init_random}, > --- 108,112 ---- > #endif > {"_codecs", init_codecs}, > ! {"_csv", init_csv}, > {"_locale", init_locale}, > {"_random", init_random}, > > > > _______________________________________________ > Python-checkins mailing list > Python-checkins@python.org > http://mail.python.org/mailman/listinfo/python-checkins > Andrew I MacIntyre "These thoughts are mine alone..." E-mail: andymac@bullseye.apana.org.au (pref) | Snail: PO Box 370 andymac@pcug.org.au (alt) | Belconnen ACT 2616 Web: http://www.andymac.org/ | Australia From nascheme@users.sourceforge.net Mon Jun 9 19:41:56 2003 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Mon, 09 Jun 2003 11:41:56 -0700 Subject: [Python-checkins] python/dist/src/Objects moduleobject.c,2.45,2.46 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv24960/Objects Modified Files: moduleobject.c Log Message: Warn about creating global variables by __setattr__ that shadow builtin names. Unfortunately, this is not bulletproof since the module dictionary can be modified directly. Index: moduleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/moduleobject.c,v retrieving revision 2.45 retrieving revision 2.46 diff -C2 -d -r2.45 -r2.46 *** moduleobject.c 13 Jun 2002 20:33:01 -0000 2.45 --- moduleobject.c 9 Jun 2003 18:41:54 -0000 2.46 *************** *** 199,202 **** --- 199,267 ---- } + static PyObject * + find_builtin_names(void) + { + PyObject *builtins, *names, *key, *value; + int pos = 0; + builtins = PyEval_GetBuiltins(); + if (builtins == NULL || !PyDict_Check(builtins)) { + PyErr_SetString(PyExc_SystemError, "no builtins dict!"); + return NULL; + } + names = PyDict_New(); + if (names == NULL) + return NULL; + while (PyDict_Next(builtins, &pos, &key, &value)) { + if (PyString_Check(key) && + PyString_Size(key) > 0 && + PyString_AS_STRING(key)[0] != '_') { + if (PyDict_SetItem(names, key, Py_None) < 0) { + Py_DECREF(names); + return NULL; + } + } + } + return names; + } + + /* returns 0 or 1 (and -1 on error) */ + static int + shadows_builtin(PyObject *globals, PyObject *name) + { + static PyObject *builtin_names = NULL; + if (builtin_names == NULL) { + builtin_names = find_builtin_names(); + if (builtin_names == NULL) + return -1; + } + if (!PyString_Check(name)) + return 0; + if (PyDict_GetItem(globals, name) == NULL && + PyDict_GetItem(builtin_names, name) != NULL) { + return 1; + } + else { + return 0; + } + } + + static int + module_setattr(PyObject *m, PyObject *name, PyObject *value) + { + PyObject *globals = ((PyModuleObject *)m)->md_dict; + PyObject *builtins = PyEval_GetBuiltins(); + if (globals != NULL && globals != builtins) { + int shadows = shadows_builtin(globals, name); + if (shadows == 1) { + if (PyErr_Warn(PyExc_DeprecationWarning, + "assignment shadows builtin") < 0) + return -1; + } + else if (shadows == -1) + return -1; + } + return PyObject_GenericSetAttr(m, name, value); + } + /* We only need a traverse function, no clear function: If the module is in a cycle, md_dict will be cleared as well, which will break *************** *** 235,239 **** 0, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ ! PyObject_GenericSetAttr, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | --- 300,304 ---- 0, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ ! module_setattr, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | From nascheme@users.sourceforge.net Mon Jun 9 19:42:25 2003 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Mon, 09 Jun 2003 11:42:25 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.777,1.778 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv25118/Misc Modified Files: NEWS Log Message: Warn about creating global variables by __setattr__ that shadow builtin names. Unfortunately, this is not bulletproof since the module dictionary can be modified directly. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.777 retrieving revision 1.778 diff -C2 -d -r1.777 -r1.778 *** NEWS 8 Jun 2003 23:10:15 -0000 1.777 --- NEWS 9 Jun 2003 18:42:19 -0000 1.778 *************** *** 44,47 **** --- 44,53 ---- preferred, then __iter__ can be overriden. + - Creating an attribute on a module (i.e. a global variable created by + __setattr__) that causes a builtin name to be shadowed now raises a + DeprecationWarning. In future versions of Python the effect may be + undefined (in order to allow for optimization of global and builtin + name lookups). + Extension modules ----------------- From rhettinger@users.sourceforge.net Mon Jun 9 22:45:02 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 09 Jun 2003 14:45:02 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libdifflib.tex,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv1982 Modified Files: libdifflib.tex Log Message: Document context_diff() and unified_diff() Index: libdifflib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdifflib.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** libdifflib.tex 6 Dec 2002 18:52:28 -0000 1.13 --- libdifflib.tex 9 Jun 2003 21:44:59 -0000 1.14 *************** *** 53,56 **** --- 53,88 ---- \end{classdesc*} + \begin{funcdesc}{context_diff}{a, b\optional{, fromfile\optional{, tofile + \optional{, fromfiledate\optional{, tofiledate\optional{, n + \optional{, lineterm}}}}}}} + + Compare \var{a} and \var{b} (lists of strings); return a + delta (a generator generating the delta lines) in context diff + format. + + Context diffs are a compact way of showing just the lines that have + changed plus a few lines of context. The changes are shown in a + before/after style. The number of context lines is set by \var{n} + which defaults to three. + + By default, the diff control lines (those with \code{***} or \code{---}) + are created with a trailing newline. This is helpful so that inputs created + from \function{file.readlines()} result in diffs that are suitable for use + with \function{file.writelines()} since both the inputs and outputs have + trailing newlines. + + For inputs that do not have trailing newlines, set the \var{lineterm} + argument to \code{""} so that the output will be uniformly newline free. + + The context diff format normally has a header for filenames and + modification times. Any or all of these may be specified using strings for + \var{fromfile}, \var{tofile}, \var{fromfiledate}, and \var{tofiledate}. + The modification times are normally expressed in the format returned by + \function{time.ctime()}. If not specified, the strings default to blanks. + + \file{Tools/scripts/diff.py} is a command-line front-end for this + function. + \end{funcdesc} + \begin{funcdesc}{get_close_matches}{word, possibilities\optional{, n\optional{, cutoff}}} *************** *** 152,155 **** --- 184,218 ---- \end{funcdesc} + \begin{funcdesc}{unified_diff}{a, b\optional{, fromfile\optional{, tofile + \optional{, fromfiledate\optional{, tofiledate\optional{, n + \optional{, lineterm}}}}}}} + + Compare \var{a} and \var{b} (lists of strings); return a + delta (a generator generating the delta lines) in unified diff + format. + + Unified diffs are a compact way of showing just the lines that have + changed plus a few lines of context. The changes are shown in a + inline style (instead of separate before/after blocks). The number + of context lines is set by \var{n} which defaults to three. + + By default, the diff control lines (those with \code{---}, \code{+++}, + or \code{@@}) are created with a trailing newline. This is helpful so + that inputs created from \function{file.readlines()} result in diffs + that are suitable for use with \function{file.writelines()} since both + the inputs and outputs have trailing newlines. + + For inputs that do not have trailing newlines, set the \var{lineterm} + argument to \code{""} so that the output will be uniformly newline free. + + The context diff format normally has a header for filenames and + modification times. Any or all of these may be specified using strings for + \var{fromfile}, \var{tofile}, \var{fromfiledate}, and \var{tofiledate}. + The modification times are normally expressed in the format returned by + \function{time.ctime()}. If not specified, the strings default to blanks. + + \file{Tools/scripts/diff.py} is a command-line front-end for this + function. + \end{funcdesc} \begin{funcdesc}{IS_LINE_JUNK}{line} From bwarsaw@users.sourceforge.net Mon Jun 9 23:27:42 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 09 Jun 2003 15:27:42 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libmimetypes.tex,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv21947/Doc/lib Modified Files: libmimetypes.tex Log Message: guess_all_extensions(): Return the empty list instead of None when there are no matching types. Updated the docs and docstrings. Added some unit tests. Index: libmimetypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmimetypes.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** libmimetypes.tex 6 Sep 2002 16:15:57 -0000 1.11 --- libmimetypes.tex 9 Jun 2003 22:27:40 -0000 1.12 *************** *** 54,59 **** including the leading dot (\character{.}). The extensions are not guaranteed to have been associated with any particular data stream, but would be mapped ! to the MIME type \var{type} by \function{guess_type()}. If no extension can ! be guessed for \var{type}, \code{None} is returned. Optional \var{strict} has the same meaning as with the --- 54,58 ---- including the leading dot (\character{.}). The extensions are not guaranteed to have been associated with any particular data stream, but would be mapped ! to the MIME type \var{type} by \function{guess_type()}. Optional \var{strict} has the same meaning as with the From bwarsaw@users.sourceforge.net Mon Jun 9 23:27:43 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 09 Jun 2003 15:27:43 -0700 Subject: [Python-checkins] python/dist/src/Lib mimetypes.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv21947/Lib Modified Files: mimetypes.py Log Message: guess_all_extensions(): Return the empty list instead of None when there are no matching types. Updated the docs and docstrings. Added some unit tests. Index: mimetypes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/mimetypes.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** mimetypes.py 4 Jan 2003 14:11:38 -0000 1.27 --- mimetypes.py 9 Jun 2003 22:27:40 -0000 1.28 *************** *** 149,156 **** Return value is a list of strings giving the possible filename extensions, including the leading dot ('.'). The extension is not ! guaranteed to have been associated with any particular data ! stream, but would be mapped to the MIME type `type' by ! guess_type(). If no extension can be guessed for `type', None ! is returned. Optional `strict' argument when false adds a bunch of commonly found, --- 149,154 ---- Return value is a list of strings giving the possible filename extensions, including the leading dot ('.'). The extension is not ! guaranteed to have been associated with any particular data stream, ! but would be mapped to the MIME type `type' by guess_type(). Optional `strict' argument when false adds a bunch of commonly found, *************** *** 163,168 **** if ext not in extensions: extensions.append(ext) ! if len(extensions): ! return extensions def guess_extension(self, type, strict=True): --- 161,165 ---- if ext not in extensions: extensions.append(ext) ! return extensions def guess_extension(self, type, strict=True): *************** *** 180,186 **** """ extensions = self.guess_all_extensions(type, strict) ! if extensions is not None: ! extensions = extensions[0] ! return extensions def read(self, filename, strict=True): --- 177,183 ---- """ extensions = self.guess_all_extensions(type, strict) ! if not extensions: ! return None ! return extensions[0] def read(self, filename, strict=True): From bwarsaw@users.sourceforge.net Mon Jun 9 23:27:43 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon, 09 Jun 2003 15:27:43 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_mimetypes.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv21947/Lib/test Modified Files: test_mimetypes.py Log Message: guess_all_extensions(): Return the empty list instead of None when there are no matching types. Updated the docs and docstrings. Added some unit tests. Index: test_mimetypes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mimetypes.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_mimetypes.py 23 Jul 2002 19:03:57 -0000 1.5 --- test_mimetypes.py 9 Jun 2003 22:27:41 -0000 1.6 *************** *** 14,53 **** def test_default_data(self): ! self.assertEqual(self.db.guess_type("foo.html"), ! ("text/html", None)) ! self.assertEqual(self.db.guess_type("foo.tgz"), ! ("application/x-tar", "gzip")) ! self.assertEqual(self.db.guess_type("foo.tar.gz"), ! ("application/x-tar", "gzip")) ! self.assertEqual(self.db.guess_type("foo.tar.Z"), ! ("application/x-tar", "compress")) def test_data_urls(self): ! self.assertEqual(self.db.guess_type("data:,thisIsTextPlain"), ! ("text/plain", None)) ! self.assertEqual(self.db.guess_type("data:;base64,thisIsTextPlain"), ! ("text/plain", None)) ! self.assertEqual(self.db.guess_type("data:text/x-foo,thisIsTextXFoo"), ! ("text/x-foo", None)) def test_file_parsing(self): sio = StringIO.StringIO("x-application/x-unittest pyunit\n") self.db.readfp(sio) ! self.assertEqual(self.db.guess_type("foo.pyunit"), ! ("x-application/x-unittest", None)) ! self.assertEqual(self.db.guess_extension("x-application/x-unittest"), ! ".pyunit") def test_non_standard_types(self): # First try strict ! self.assertEqual(self.db.guess_type('foo.xul', strict=1), ! (None, None)) ! self.assertEqual(self.db.guess_extension('image/jpg', strict=1), ! None) # And then non-strict ! self.assertEqual(self.db.guess_type('foo.xul', strict=0), ! ('text/xul', None)) ! self.assertEqual(self.db.guess_extension('image/jpg', strict=0), ! '.jpg') --- 14,60 ---- def test_default_data(self): ! eq = self.assertEqual ! eq(self.db.guess_type("foo.html"), ("text/html", None)) ! eq(self.db.guess_type("foo.tgz"), ("application/x-tar", "gzip")) ! eq(self.db.guess_type("foo.tar.gz"), ("application/x-tar", "gzip")) ! eq(self.db.guess_type("foo.tar.Z"), ("application/x-tar", "compress")) def test_data_urls(self): ! eq = self.assertEqual ! guess_type = self.db.guess_type ! eq(guess_type("data:,thisIsTextPlain"), ("text/plain", None)) ! eq(guess_type("data:;base64,thisIsTextPlain"), ("text/plain", None)) ! eq(guess_type("data:text/x-foo,thisIsTextXFoo"), ("text/x-foo", None)) def test_file_parsing(self): + eq = self.assertEqual sio = StringIO.StringIO("x-application/x-unittest pyunit\n") self.db.readfp(sio) ! eq(self.db.guess_type("foo.pyunit"), ! ("x-application/x-unittest", None)) ! eq(self.db.guess_extension("x-application/x-unittest"), ".pyunit") def test_non_standard_types(self): + eq = self.assertEqual # First try strict ! eq(self.db.guess_type('foo.xul', strict=True), (None, None)) ! eq(self.db.guess_extension('image/jpg', strict=True), None) # And then non-strict ! eq(self.db.guess_type('foo.xul', strict=False), ('text/xul', None)) ! eq(self.db.guess_extension('image/jpg', strict=False), '.jpg') ! ! def test_guess_all_types(self): ! eq = self.assertEqual ! # First try strict ! all = self.db.guess_all_extensions('text/plain', strict=True) ! all.sort() ! eq(all, ['.bat', '.c', '.h', '.ksh', '.pl', '.txt']) ! # And now non-strict ! all = self.db.guess_all_extensions('image/jpg', strict=False) ! all.sort() ! eq(all, ['.jpg']) ! # And now for no hits ! all = self.db.guess_all_extensions('image/jpg', strict=True) ! eq(all, []) From goodger@users.sourceforge.net Tue Jun 10 05:29:50 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Mon, 09 Jun 2003 21:29:50 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.241,1.242 pep-0318.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv6247 Modified Files: pep-0000.txt pep-0318.txt Log Message: updates to PEP 318 from Kevin Smith, including PEP title Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.241 retrieving revision 1.242 diff -C2 -d -r1.241 -r1.242 *** pep-0000.txt 9 Jun 2003 04:34:54 -0000 1.241 --- pep-0000.txt 10 Jun 2003 04:29:48 -0000 1.242 *************** *** 118,122 **** S 315 Enhanced While Loop Carroll S 317 Eliminate Implicit Exception Instantiation Taschuk ! S 318 Function Modifier Syntax Smith S 754 IEEE 754 Floating Point Special Values Warnes --- 118,122 ---- S 315 Enhanced While Loop Carroll S 317 Eliminate Implicit Exception Instantiation Taschuk ! S 318 Function/Method Decorator Syntax Smith S 754 IEEE 754 Floating Point Special Values Warnes *************** *** 329,333 **** SD 316 Programming by Contract for Python Way S 317 Eliminate Implicit Exception Instantiation Taschuk ! S 318 Function Modifier Syntax Smith SR 666 Reject Foolish Indentation Creighton S 754 IEEE 754 Floating Point Special Values Warnes --- 329,333 ---- SD 316 Programming by Contract for Python Way S 317 Eliminate Implicit Exception Instantiation Taschuk ! S 318 Function/Method Decorator Syntax Smith SR 666 Reject Foolish Indentation Creighton S 754 IEEE 754 Floating Point Special Values Warnes Index: pep-0318.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0318.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0318.txt 9 Jun 2003 04:04:58 -0000 1.1 --- pep-0318.txt 10 Jun 2003 04:29:48 -0000 1.2 *************** *** 1,4 **** PEP: 318 ! Title: Function Modifier Syntax Version: $Revision$ Last-Modified: $Date$ --- 1,4 ---- PEP: 318 ! Title: Function/Method Decorator Syntax Version: $Revision$ Last-Modified: $Date$ *************** *** 9,13 **** Created: 05-Jun-2003 Python-Version: 2.4 ! Post-History: --- 9,13 ---- Created: 05-Jun-2003 Python-Version: 2.4 ! Post-History: 09-Jun-2003 *************** *** 37,45 **** obvious. A solution to this problem is to move the translation of the method to the same point as the method's declaration. Proposal ! Probably the simplest way to place the function that translates an instance method to a class/static method is illustrated in the code below. --- 37,50 ---- obvious. A solution to this problem is to move the translation of the method to the same point as the method's declaration. + The proposed syntax, shown in the example below, is discussed + in the following sections. + + def foo(self) as synchronized(lock), classmethod: + perform method operation Proposal ! Probably the simplest way to place the decorator that translates an instance method to a class/static method is illustrated in the code below. *************** *** 59,63 **** a callable object that returns a new function reference. This syntax could also be extended to allow multiple function ! modifiers in the form of a space delimited list as follows: def protected classmethod foo(self): --- 64,68 ---- a callable object that returns a new function reference. This syntax could also be extended to allow multiple function ! decorators in the form of a space delimited list as follows: def protected classmethod foo(self): *************** *** 72,81 **** While this syntax is simple and easy to read, it does become cluttered and more obscure if you wish to allow arguments to be ! sent to the function modifier. ! def synchronized(lock) classmethod foo(self): ! perform method operation ! Various syntaxes have been proposed in comp.lang.python. The most common are demonstrated below. --- 77,102 ---- While this syntax is simple and easy to read, it does become cluttered and more obscure if you wish to allow arguments to be ! sent to the function decorator. ! def synchronized(lock) classmethod foo(self): ! perform method operation ! Instead of placing the decorators in front of the function name, ! a better place might be after it, as shown below. The word 'as' is ! added simply as a separator to assist in readability. ! ! def foo(self) as synchronized(lock), classmethod: ! perform method operation ! ! This syntax is quite clear and could probably be interpreted ! by those not familiar with Python. The proposed syntax can be ! generalized as follows: ! ! 'def' NAME '(' PARAMETERS ')' ['as' DECORATORS] ':' ! ! where DECORATORS is a comma-separated list of expressions, ! or a tuple. ! ! Other syntaxes have been proposed in comp.lang.python. The most common are demonstrated below. *************** *** 83,99 **** perform method operation def foo(self) {'pre': synchronized(lock), 'classmethod': True}: - """ Skip Montanaro syntax """ perform method operation def foo(self) as synchronized(lock), classmethod: - """ Gerrit Holl syntax """ perform method operation ! I have a strong preference for the last of the three. The first ! two use syntax that just seems arbitrary which does not help the ! user to understand the meaning of it. The third method is very ! readable and could probably be interpreted easily by those not ! familiar with Python. --- 104,166 ---- perform method operation + def foo(self) (synchronized(lock), classmethod): + perform method operation + def foo(self) {'pre': synchronized(lock), 'classmethod': True}: perform method operation + These three forms use syntax that just seems arbitrary and which + does not help the user to comprehend the meaning of it. In + addition, since the order in which the decorators are applied + may matter, the third, dictionary-style, syntax must be + eliminated. + + + Implementation Issues + + In the following example there are two function decorators: + synchronized(lock) and classmethod. + def foo(self) as synchronized(lock), classmethod: perform method operation ! Since these all appear within the operation of the 'def' ! itself, it makes sense that synchronized, lock, and ! classmethod must exist at the time that the definition ! is compiled. In addition, each of these arguments will be ! evaluated before being applied to the compiled function. ! This means that arguments like synchronized(lock) must ! return a descriptor that will be applied to foo. Therefore, ! the code above translates to: ! ! def foo(self): ! perform method operation ! foo = classmethod((foo)) ! ! In the example above, refers to the ! descriptor returned by evaluating synchronized(lock). ! ! It could easily be argued that the descriptors should be applied ! in reverse order to make the application of the descriptor look ! more like the resultant code. I tend to prefer this form. ! ! def foo(self): ! perform method operation ! foo = (classmethod(foo)) ! ! In either case, the modified function is bound to the function ! name at compile time. ! ! ! Possible Extensions ! ! The proposed syntax is general enough that it could be used ! on class definitions as well as shown below. ! ! class foo(object) as classmodifier: ! class definition here ! ! However, there are no obvious parallels for use with other ! descriptors such as property(). *************** *** 102,113 **** The current method of translating an instance method to a class or static method is awkward. A new syntax for applying function ! modifiers should be implemented (proposed syntax shown below). def foo(self) as synchronized(lock), classmethod: - perform method operation - - More generally, - - def foo(self) as : perform method operation --- 169,175 ---- The current method of translating an instance method to a class or static method is awkward. A new syntax for applying function ! decorators should be implemented (proposed syntax shown below). def foo(self) as synchronized(lock), classmethod: perform method operation From bwarsaw@users.sourceforge.net Tue Jun 10 17:32:02 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 10 Jun 2003 09:32:02 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Message.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv23069 Modified Files: Message.py Log Message: get_payload(): Improve the TypeError message when the payload isn't of the expected type. In response to SF #751451. Index: Message.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Message.py 18 Apr 2003 23:04:35 -0000 1.31 --- Message.py 10 Jun 2003 16:31:55 -0000 1.32 *************** *** 187,191 **** payload = self._payload elif not isinstance(self._payload, ListType): ! raise TypeError, i else: payload = self._payload[i] --- 187,191 ---- payload = self._payload elif not isinstance(self._payload, ListType): ! raise TypeError, 'Expected list, got %s' % type(self._payload) else: payload = self._payload[i] From rhettinger@users.sourceforge.net Tue Jun 10 22:41:30 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 10 Jun 2003 14:41:30 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.133,1.134 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv8984 Modified Files: libfuncs.tex Log Message: SF bug: 751941 Invisible HTML tag Added missing jump target labels. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.133 retrieving revision 1.134 diff -C2 -d -r1.133 -r1.134 *** libfuncs.tex 31 May 2003 08:02:38 -0000 1.133 --- libfuncs.tex 10 Jun 2003 21:41:22 -0000 1.134 *************** *** 120,123 **** --- 120,124 ---- \begin{funcdesc}{classmethod}{function} + \label{classmethod} Return a class method for \var{function}. *************** *** 884,887 **** --- 885,889 ---- \begin{funcdesc}{staticmethod}{function} + \label{staticmethod} Return a static method for \var{function}. From bcannon@users.sourceforge.net Wed Jun 11 01:18:12 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue, 10 Jun 2003 17:18:12 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.299,2.300 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv25341/Modules Modified Files: posixmodule.c Log Message: Clarify docstring for symlink. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.299 retrieving revision 2.300 diff -C2 -d -r2.299 -r2.300 *** posixmodule.c 3 May 2003 09:14:53 -0000 2.299 --- posixmodule.c 11 Jun 2003 00:18:09 -0000 2.300 *************** *** 4642,4646 **** PyDoc_STRVAR(posix_symlink__doc__, "symlink(src, dst)\n\n\ ! Create a symbolic link."); static PyObject * --- 4642,4646 ---- PyDoc_STRVAR(posix_symlink__doc__, "symlink(src, dst)\n\n\ ! Create a symbolic link pointing to src named dst."); static PyObject * From bcannon@users.sourceforge.net Wed Jun 11 01:20:06 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue, 10 Jun 2003 17:20:06 -0700 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c,2.216.4.10,2.216.4.11 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv26086/Modules Modified Files: Tag: release22-maint posixmodule.c Log Message: Clarify docstring for symlink. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.216.4.10 retrieving revision 2.216.4.11 diff -C2 -d -r2.216.4.10 -r2.216.4.11 *** posixmodule.c 23 Apr 2003 20:14:12 -0000 2.216.4.10 --- posixmodule.c 11 Jun 2003 00:20:02 -0000 2.216.4.11 *************** *** 3417,3421 **** static char posix_symlink__doc__[] = "symlink(src, dst) -> None\n\ ! Create a symbolic link."; static PyObject * --- 3417,3421 ---- static char posix_symlink__doc__[] = "symlink(src, dst) -> None\n\ ! Create a symbolic link pointing to src named dst."; static PyObject * From rhettinger@users.sourceforge.net Wed Jun 11 08:50:48 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 11 Jun 2003 00:50:48 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libdifflib.tex,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv11435 Modified Files: libdifflib.tex Log Message: Add docs for get_grouped_opcodes(). Index: libdifflib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdifflib.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** libdifflib.tex 9 Jun 2003 21:44:59 -0000 1.14 --- libdifflib.tex 11 Jun 2003 07:50:44 -0000 1.15 *************** *** 82,86 **** \file{Tools/scripts/diff.py} is a command-line front-end for this ! function. \end{funcdesc} --- 82,88 ---- \file{Tools/scripts/diff.py} is a command-line front-end for this ! function. ! ! \versionadded{2.3} \end{funcdesc} *************** *** 213,217 **** \file{Tools/scripts/diff.py} is a command-line front-end for this ! function. \end{funcdesc} --- 215,221 ---- \file{Tools/scripts/diff.py} is a command-line front-end for this ! function. ! ! \versionadded{2.3} \end{funcdesc} *************** *** 396,399 **** --- 400,414 ---- insert a[6:6] () b[5:6] (f) \end{verbatim} + \end{methoddesc} + + \begin{methoddesc}{get_grouped_opcodes}{\optional{n}} + Return a generator of groups with up to \var{n} lines of context. + + Starting with the groups returned by \method{get_opcodes()}, + this method splits out smaller change clusters and eliminates + intervening ranges which have no changes. + + The groups are returned in the same format as \method{get_opcodes()}. + \versionadded{2.3} \end{methoddesc} From rhettinger@users.sourceforge.net Wed Jun 11 09:16:12 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 11 Jun 2003 01:16:12 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.134,1.135 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv19944 Modified Files: libfuncs.tex Log Message: SF bug #660022: parameters for int(), str(), etc. * Indicate that arguments are optional for most builtin type constructors. * Replace e.g. in staticmethod() and classmethod() docs. * Add \code{} markup to some in-line code examples. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.134 retrieving revision 1.135 diff -C2 -d -r1.134 -r1.135 *** libfuncs.tex 10 Jun 2003 21:41:22 -0000 1.134 --- libfuncs.tex 11 Jun 2003 08:16:06 -0000 1.135 *************** *** 81,85 **** \end{funcdesc} ! \begin{funcdesc}{bool}{x} Convert a value to a Boolean, using the standard truth testing procedure. If \code{x} is false, this returns \code{False}; --- 81,85 ---- \end{funcdesc} ! \begin{funcdesc}{bool}{\optional{x}} Convert a value to a Boolean, using the standard truth testing procedure. If \code{x} is false, this returns \code{False}; *************** *** 87,91 **** which is a subclass of \code{int}. Class \code{bool} cannot be subclassed further. Its only instances are \code{False} and ! \code{True}. \indexii{Boolean}{type} \versionadded{2.2.1} --- 87,92 ---- which is a subclass of \code{int}. Class \code{bool} cannot be subclassed further. Its only instances are \code{False} and ! \code{True}. If no argument is given, this function returns ! \code{False}. \indexii{Boolean}{type} \versionadded{2.2.1} *************** *** 133,138 **** \end{verbatim} ! It can be called either on the class (e.g. C.f()) or on an instance ! (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument. --- 134,140 ---- \end{verbatim} ! It can be called either on the class (such as \code{C.f()}) or on an ! instance (such as \code{C().f()}). The instance is ignored except for ! its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument. *************** *** 196,200 **** \end{funcdesc} ! \begin{funcdesc}{complex}{real\optional{, imag}} Create a complex number with the value \var{real} + \var{imag}*j or convert a string or number to a complex number. If the first --- 198,202 ---- \end{funcdesc} ! \begin{funcdesc}{complex}{\optional{real\optional{, imag}}} Create a complex number with the value \var{real} + \var{imag}*j or convert a string or number to a complex number. If the first *************** *** 205,209 **** If \var{imag} is omitted, it defaults to zero and the function serves as a numeric conversion function like \function{int()}, ! \function{long()} and \function{float()}. \end{funcdesc} --- 207,212 ---- If \var{imag} is omitted, it defaults to zero and the function serves as a numeric conversion function like \function{int()}, ! \function{long()} and \function{float()}. If both arguments ! are omitted, returns \code{0j}. \end{funcdesc} *************** *** 448,452 **** \end{funcdesc} ! \begin{funcdesc}{float}{x} Convert a string or a number to floating point. If the argument is a string, it must contain a possibly signed decimal or floating point --- 451,455 ---- \end{funcdesc} ! \begin{funcdesc}{float}{\optional{x}} Convert a string or a number to floating point. If the argument is a string, it must contain a possibly signed decimal or floating point *************** *** 455,459 **** or long integer or a floating point number, and a floating point number with the same value (within Python's floating point ! precision) is returned. \note{When passing in a string, values for NaN\index{NaN} --- 458,462 ---- or long integer or a floating point number, and a floating point number with the same value (within Python's floating point ! precision) is returned. If no argument is given, returns \code{0.0}. \note{When passing in a string, values for NaN\index{NaN} *************** *** 541,545 **** \end{funcdesc} ! \begin{funcdesc}{int}{x\optional{, radix}} Convert a string or number to a plain integer. If the argument is a string, it must contain a possibly signed decimal number --- 544,548 ---- \end{funcdesc} ! \begin{funcdesc}{int}{\optional{x\optional{, radix}}} Convert a string or number to a plain integer. If the argument is a string, it must contain a possibly signed decimal number *************** *** 555,559 **** point numbers to integers truncates (towards zero). If the argument is outside the integer range a long object will ! be returned instead. \end{funcdesc} --- 558,562 ---- point numbers to integers truncates (towards zero). If the argument is outside the integer range a long object will ! be returned instead. If no arguments are given, returns \code{0}. \end{funcdesc} *************** *** 626,630 **** similar to \code{\var{sequence}[:]}. For instance, \code{list('abc')} returns \code{['a', 'b', 'c']} and \code{list( ! (1, 2, 3) )} returns \code{[1, 2, 3]}. \end{funcdesc} --- 629,634 ---- similar to \code{\var{sequence}[:]}. For instance, \code{list('abc')} returns \code{['a', 'b', 'c']} and \code{list( ! (1, 2, 3) )} returns \code{[1, 2, 3]}. If no argument is given, ! returns a new empty list, \code{[]}. \end{funcdesc} *************** *** 636,640 **** \end{funcdesc} ! \begin{funcdesc}{long}{x\optional{, radix}} Convert a string or number to a long integer. If the argument is a string, it must contain a possibly signed number of --- 640,644 ---- \end{funcdesc} ! \begin{funcdesc}{long}{\optional{x\optional{, radix}}} Convert a string or number to a long integer. If the argument is a string, it must contain a possibly signed number of *************** *** 646,650 **** long integer or a floating point number, and a long integer with the same value is returned. Conversion of floating ! point numbers to integers truncates (towards zero). \end{funcdesc} --- 650,655 ---- long integer or a floating point number, and a long integer with the same value is returned. Conversion of floating ! point numbers to integers truncates (towards zero). If no arguments ! are given, returns \code{0L}. \end{funcdesc} *************** *** 897,902 **** \end{verbatim} ! It can be called either on the class (e.g. C.f()) or on an instance ! (e.g. C().f()). The instance is ignored except for its class. Static methods in Python are similar to those found in Java or C++. --- 902,908 ---- \end{verbatim} ! It can be called either on the class (such as \code{C.f()}) or on an ! instance (such as \code{C().f()}). The instance is ignored except ! for its class. Static methods in Python are similar to those found in Java or C++. *************** *** 930,934 **** \end{funcdesc} ! \begin{funcdesc}{str}{object} Return a string containing a nicely printable representation of an object. For strings, this returns the string itself. The --- 936,940 ---- \end{funcdesc} ! \begin{funcdesc}{str}{\optional{object}} Return a string containing a nicely printable representation of an object. For strings, this returns the string itself. The *************** *** 936,940 **** \code{str(\var{object})} does not always attempt to return a string that is acceptable to \function{eval()}; its goal is to return a ! printable string. \end{funcdesc} --- 942,947 ---- \code{str(\var{object})} does not always attempt to return a string that is acceptable to \function{eval()}; its goal is to return a ! printable string. If no argument is given, returns the empty ! string, \code{''}. \end{funcdesc} *************** *** 946,950 **** is returned unchanged. For instance, \code{tuple('abc')} returns returns \code{('a', 'b', 'c')} and \code{tuple([1, 2, 3])} returns ! \code{(1, 2, 3)}. \end{funcdesc} --- 953,958 ---- is returned unchanged. For instance, \code{tuple('abc')} returns returns \code{('a', 'b', 'c')} and \code{tuple([1, 2, 3])} returns ! \code{(1, 2, 3)}. If no argument is given, returns a new empty ! tuple, \code{()}. \end{funcdesc} *************** *** 982,986 **** \end{funcdesc} ! \begin{funcdesc}{unicode}{object\optional{, encoding\optional{, errors}}} Return the Unicode string version of \var{object} using one of the following modes: --- 990,995 ---- \end{funcdesc} ! \begin{funcdesc}{unicode}{\optional{object\optional{, encoding ! \optional{, errors}}}} Return the Unicode string version of \var{object} using one of the following modes: From rhettinger@users.sourceforge.net Wed Jun 11 10:15:31 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 11 Jun 2003 02:15:31 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.135,1.136 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv13071 Modified Files: libfuncs.tex Log Message: * Added missing documentation for object(). * Noted the Py2.3 in the optional arg for bool(). Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.135 retrieving revision 1.136 diff -C2 -d -r1.135 -r1.136 *** libfuncs.tex 11 Jun 2003 08:16:06 -0000 1.135 --- libfuncs.tex 11 Jun 2003 09:15:26 -0000 1.136 *************** *** 87,94 **** which is a subclass of \code{int}. Class \code{bool} cannot be subclassed further. Its only instances are \code{False} and ! \code{True}. If no argument is given, this function returns ! \code{False}. \indexii{Boolean}{type} \versionadded{2.2.1} \end{funcdesc} --- 87,97 ---- which is a subclass of \code{int}. Class \code{bool} cannot be subclassed further. Its only instances are \code{False} and ! \code{True}. ! \indexii{Boolean}{type} \versionadded{2.2.1} + + If no argument is given, this function returns \code{False}. + \versionchanged{2.3} \end{funcdesc} *************** *** 677,680 **** --- 680,693 ---- non-empty sequence (such as a string, tuple or list). With more than one argument, return the smallest of the arguments. + \end{funcdesc} + + \begin{funcdesc}{object}{} + Return a new featureless object. \function{object} is a base + for all new style classes. It has the methods that are common + to all instances of new style classes. + \versionadded{2.2} + + This function does not accept any arguments. \versionchanged{2.3} + Formerly, it accepted arguments but ignored them. \end{funcdesc} From aimacintyre@users.sourceforge.net Wed Jun 11 13:26:11 2003 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Wed, 11 Jun 2003 05:26:11 -0700 Subject: [Python-checkins] python/dist/src/Include py_curses.h,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv20578 Modified Files: py_curses.h Log Message: fix the curses module build failure on FreeBSD, reported in SF #740234. Index: py_curses.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/py_curses.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** py_curses.h 28 Feb 2003 12:51:18 -0000 1.6 --- py_curses.h 11 Jun 2003 12:26:08 -0000 1.7 *************** *** 13,16 **** --- 13,31 ---- #endif + #ifdef __FreeBSD__ + /* + ** On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards + ** against multiple definition of wchar_t and wint_t. + */ + #ifdef _XOPEN_SOURCE_EXTENDED + #ifndef _WCHAR_T + #define _WCHAR_T + #endif + #ifndef _WINT_T + #define _WINT_T + #endif + #endif + #endif + #ifdef HAVE_NCURSES_H #include From bcannon@users.sourceforge.net Wed Jun 11 21:50:38 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Wed, 11 Jun 2003 13:50:38 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.235,2.236 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv9824/Objects Modified Files: typeobject.c Log Message: Fixed a comment. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.235 retrieving revision 2.236 diff -C2 -d -r2.235 -r2.236 *** typeobject.c 8 Jun 2003 13:19:57 -0000 2.235 --- typeobject.c 11 Jun 2003 20:50:33 -0000 2.236 *************** *** 5534,5538 **** } if (su->ob_type != &PySuper_Type) ! /* If su is an instance of a subclass of super, call its type */ return PyObject_CallFunction((PyObject *)su->ob_type, --- 5534,5538 ---- } if (su->ob_type != &PySuper_Type) ! /* If su is not an instance of a subclass of super, call its type */ return PyObject_CallFunction((PyObject *)su->ob_type, From bcannon@users.sourceforge.net Thu Jun 12 00:38:58 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Wed, 11 Jun 2003 16:38:58 -0700 Subject: [Python-checkins] python/dist/src/Lib pydoc.py,1.83,1.84 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv16260/Lib Modified Files: pydoc.py Log Message: Have pydoc try handling an object as "other" if the object does not act the way it expects based on what inspect classifies it as. Closes bug #729103 . Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** pydoc.py 26 May 2003 13:49:54 -0000 1.83 --- pydoc.py 11 Jun 2003 23:38:55 -0000 1.84 *************** *** 276,282 **** """Generate documentation for an object.""" args = (object, name) + args ! if inspect.ismodule(object): return self.docmodule(*args) ! if inspect.isclass(object): return self.docclass(*args) ! if inspect.isroutine(object): return self.docroutine(*args) return self.docother(*args) --- 276,289 ---- """Generate documentation for an object.""" args = (object, name) + args ! # 'try' clause is to attempt to handle the possibility that inspect ! # identifies something in a way that pydoc itself has issues handling; ! # think 'super' and how it is a descriptor (which raises the exception ! # by lacking a __name__ attribute) and an instance. ! try: ! if inspect.ismodule(object): return self.docmodule(*args) ! if inspect.isclass(object): return self.docclass(*args) ! if inspect.isroutine(object): return self.docroutine(*args) ! except AttributeError: ! pass return self.docother(*args) From montanaro@users.sourceforge.net Thu Jun 12 03:40:25 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed, 11 Jun 2003 19:40:25 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_csv.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14820 Modified Files: test_csv.py Log Message: add a couple test cases which involve longs and floats in 'e' format. Index: test_csv.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_csv.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_csv.py 19 May 2003 15:33:36 -0000 1.8 --- test_csv.py 12 Jun 2003 02:40:22 -0000 1.9 *************** *** 424,427 **** --- 424,442 ---- "6": 'DEFAULT'}) + def test_read_multi(self): + sample = [ + '2147483648,43.0e12,17,abc,def\r\n', + '147483648,43.0e2,17,abc,def\r\n', + '47483648,43.0,170,abc,def\r\n' + ] + + reader = csv.DictReader(sample, + fieldnames="i1 float i2 s1 s2".split()) + self.assertEqual(reader.next(), {"i1": '2147483648', + "float": '43.0e12', + "i2": '17', + "s1": 'abc', + "s2": 'def'}) + def test_read_with_blanks(self): reader = csv.DictReader(["1,2,abc,4,5,6\r\n","\r\n", *************** *** 558,561 **** --- 573,582 ---- ''' + sample4 = '''\ + 2147483648;43.0e12;17;abc;def + 147483648;43.0e2;17;abc;def + 47483648;43.0;170;abc;def + ''' + def test_has_header(self): sniffer = csv.Sniffer() *************** *** 583,586 **** --- 604,609 ---- dialect = sniffer.sniff(self.sample3, delimiters="/,") self.assertEqual(dialect.delimiter, "/") + dialect = sniffer.sniff(self.sample4) + self.assertEqual(dialect.delimiter, ";") if not hasattr(sys, "gettotalrefcount"): From rhettinger@users.sourceforge.net Thu Jun 12 04:01:57 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 11 Jun 2003 20:01:57 -0700 Subject: [Python-checkins] python/dist/src/Lib csv.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv20789 Modified Files: csv.py Log Message: SF Patch #744104: Remove eval() from csv Eliminates the eval() step in the csv module resulting in better security, more clarity, and a little speed. The idea is to make successive attempts to coerce the string to a python type: int(s), long(s), float(s), etc. As a by-product, eliminates a bare 'except' statement. Index: csv.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/csv.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** csv.py 19 May 2003 15:33:36 -0000 1.4 --- csv.py 12 Jun 2003 03:01:55 -0000 1.5 *************** *** 149,152 **** --- 149,157 ---- return self.writer.writerows(rows) + # Guard Sniffer's type checking against builds that exclude complex() + try: + complex + except NameError: + complex = float class Sniffer: *************** *** 361,371 **** # subtracting from the likelihood of the first row being a header. - def seval(item): - """ - Strips parens from item prior to calling eval in an - attempt to make it safer - """ - return eval(item.replace('(', '').replace(')', '')) - rdr = reader(StringIO(sample), self.sniff(sample)) --- 366,369 ---- *************** *** 387,402 **** for col in columnTypes.keys(): ! try: try: ! # is it a built-in type (besides string)? ! thisType = type(seval(row[col])) ! except OverflowError: ! # a long int? ! thisType = type(seval(row[col] + 'L')) ! thisType = type(0) # treat long ints as int ! except: # fallback to length of string thisType = len(row[col]) if thisType != columnTypes[col]: if columnTypes[col] is None: # add new column type --- 385,403 ---- for col in columnTypes.keys(): ! ! for thisType in [int, long, float, complex]: try: ! thisType(row[col]) ! break ! except ValueError, OverflowError: ! pass ! else: # fallback to length of string thisType = len(row[col]) + # treat longs as ints + if thisType == long: + thisType = int + if thisType != columnTypes[col]: if columnTypes[col] is None: # add new column type *************** *** 418,423 **** else: # attempt typecast try: ! eval("%s(%s)" % (colType.__name__, header[col])) ! except: hasHeader += 1 else: --- 419,424 ---- else: # attempt typecast try: ! colType(header[col]) ! except ValueError, TypeError: hasHeader += 1 else: From kbk@users.sourceforge.net Thu Jun 12 04:15:51 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Wed, 11 Jun 2003 20:15:51 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib idlever.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv24757 Modified Files: idlever.py Log Message: Update version. Index: idlever.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/idlever.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** idlever.py 25 Apr 2003 17:48:08 -0000 1.10 --- idlever.py 12 Jun 2003 03:15:47 -0000 1.11 *************** *** 1 **** ! IDLE_VERSION = "0.9b1" --- 1 ---- ! IDLE_VERSION = "0.9b1+" From kbk@users.sourceforge.net Thu Jun 12 04:39:11 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Wed, 11 Jun 2003 20:39:11 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib INSTALL.txt,1.8,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv30741 Removed Files: INSTALL.txt Log Message: Remove unneeded installation instructions. --- INSTALL.txt DELETED --- From kbk@users.sourceforge.net Thu Jun 12 04:41:03 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Wed, 11 Jun 2003 20:41:03 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib MANIFEST.in,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv31116 Removed Files: MANIFEST.in Log Message: Remove unneeded MANIFEST template. --- MANIFEST.in DELETED --- From kbk@users.sourceforge.net Thu Jun 12 04:44:03 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Wed, 11 Jun 2003 20:44:03 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib setup.py,1.15,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv31785 Removed Files: setup.py Log Message: Remove setup file, no longer needed. --- setup.py DELETED --- From kbk@users.sourceforge.net Thu Jun 12 04:45:57 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Wed, 11 Jun 2003 20:45:57 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib LICENSE.txt,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv32576 Removed Files: LICENSE.txt Log Message: Will use the Python LICENSE file instead. --- LICENSE.txt DELETED --- From kbk@users.sourceforge.net Thu Jun 12 04:50:57 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Wed, 11 Jun 2003 20:50:57 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib CREDITS.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv1537 Modified Files: CREDITS.txt Log Message: Updated for IDLEfork re-integration Index: CREDITS.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/CREDITS.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CREDITS.txt 30 May 2003 02:42:02 -0000 1.7 --- CREDITS.txt 12 Jun 2003 03:50:55 -0000 1.8 *************** *** 1,19 **** ! IDLEfork Credits ! ================== ! Guido van Rossum, as well as being the creator of the Python language, is ! the original creator of IDLE. He also developed the RPC code and Remote ! Debugger extension used in IDLEfork. ! The IDLEfork project was initiated and brought up to version 0.7.1 primarily ! by David Scherer, with help from Peter Schneider-Kamp and Nicholas Riley. ! Bruce Sherwood has contributed considerable time testing and suggesting ! improvements. ! Besides Guido, the main developers who have been active on IDLEfork version ! 0.8.1 and later are Stephen M. Gava, who implemented the Configuration GUI, the ! new configuration system, and the new About menu, and Kurt B. Kaiser, who ! completed the integration of the RPC and remote debugger, implemented the ! threaded subprocess, and made a number of usability enhancements. Other contributors include Raymond Hettinger, Tony Lownds (Mac integration), --- 1,21 ---- ! Guido van Rossum, as well as being the creator of the Python language, is the ! original creator of IDLE. Other contributors prior to Version 0.8 include ! Mark Hammond, Jeremy Hylton, Tim Peters, and Moshe Zadka. ! IDLE's recent development has been carried out in the IDLEfork project. ! The objective was to develop a version of IDLE which had an execution ! environment which could be initialized prior to each run of user code. ! The IDLEfork project was initiated by David Scherer, with some help from Peter ! Schneider-Kamp and Nicholas Riley. David wrote the first version of the RPC ! code and designed a fast turn-around environment for VPython. Guido developed ! the RPC code and Remote Debugger currently integrated in IDLE. Bruce Sherwood ! contributed considerable time testing and suggesting improvements. ! Besides David and Guido, the main developers who have been active on IDLEfork ! are Stephen M. Gava, who implemented the configuration GUI, the new ! configuration system, and the About dialog, and Kurt B. Kaiser, who completed ! the integration of the RPC and remote debugger, implemented the threaded ! subprocess, and made a number of usability enhancements. Other contributors include Raymond Hettinger, Tony Lownds (Mac integration), *************** *** 25,37 **** patches. Thanks, guys! ! There are others who should be included here, especially those who contributed ! to IDLE versions prior to 0.8, principally Mark Hammond, Jeremy Hylton, ! Tim Peters, and Moshe Zadka. For additional details refer to NEWS.txt and ! Changelog. ! Please contact the IDLEfork maintainer to have yourself included here if you are one of those we missed! - Contact details at http://idlefork.sourceforge.net --- 27,35 ---- patches. Thanks, guys! ! For additional details refer to NEWS.txt and Changelog. ! Please contact the IDLE maintainer to have yourself included here if you are one of those we missed! From kbk@users.sourceforge.net Thu Jun 12 04:51:29 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Wed, 11 Jun 2003 20:51:29 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib README.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv1778 Modified Files: README.txt Log Message: Updated for IDLEfork re-integration Index: README.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/README.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** README.txt 1 Jun 2003 01:11:14 -0000 1.7 --- README.txt 12 Jun 2003 03:51:27 -0000 1.8 *************** *** 1,38 **** ! IDLEfork README ! =============== ! IDLEfork is an official experimental fork of Python's Integrated DeveLopment ! Environment, IDLE. The biggest change is to execute Python code in a separate ! process, which is /restarted/ for each Run (F5) initiated from an editor ! window. This enhancement of IDLE has often been requested, and is now finally ! available, complete with the IDLE debugger. The magic "reload/import *" ! incantations are no longer required when editing/testing a module two or three ! steps down the import chain. ! It is possible to interrupt tightly looping user code with a control-c, even on ! Windows. ! There is also a new GUI configuration manager which makes it easy to select ! fonts, colors, keybindings, and startup options. There is new feature where ! the user can specify additional help sources, either locally or on the web. ! IDLEfork will be merged back into the Python distribution in the near future ! (probably 2.3), replacing the current version of IDLE. ! For information on this release, refer to NEWS.txt ! If you find bugs let us know about them by using the IDLEfork Bug Tracker. See ! the IDLEfork home page at ! http://idlefork.sourceforge.net ! for details. Patches are always appreciated at the IDLEfork Patch Tracker, and ! Change Requests should be posted to the RFE Tracker at ! https://sourceforge.net/tracker/?group_id=9579&atid=359579 There is a mail list for IDLE: idle-dev@python.org. You can join at http://mail.python.org/mailman/listinfo/idle-dev - - Thanks for trying IDLEfork. --- 1,58 ---- ! IDLE is Python's Tkinter-based Integrated DeveLopment Environment. ! IDLE emphasizes a lightweight, clean design with a simple user interface. ! Although it is suitable for beginners, even advanced users will find that ! IDLE has everything they really need to develop pure Python code. ! IDLE features a multi-window text editor with multiple undo, Python colorizing, ! and many other capabilities, e.g. smart indent, call tips, and autocompletion. ! The editor has comprehensive search functions, including searching through ! multiple files. Class browsers and path browsers provide fast access to ! code objects from a top level viewpoint without dealing with code folding. ! There is a Python Shell window which features colorizing and command recall. ! IDLE executes Python code in a separate process, which is restarted for each ! Run (F5) initiated from an editor window. The environment can also be ! restarted from the Shell window without restarting IDLE. ! This enhancement has often been requested, and is now finally available. The ! magic "reload/import *" incantations are no longer required when editing and ! testing a module two or three steps down the import chain. ! It is possible to interrupt tightly looping user code, even on Windows. ! Applications which cannot support subprocesses and/or sockets can still run ! IDLE in a single process. ! IDLE has an integrated debugger with stepping, persistent breakpoints, and call ! stack visibility. ! ! There is a GUI configuration manager which makes it easy to select fonts, ! colors, keybindings, and startup options. This facility includes a feature ! which allows the user to specify additional help sources, either locally or on ! the web. ! ! IDLE is coded in 100% pure Python, using the Tkinter GUI toolkit (Tk/Tcl) ! and is cross-platform, working on Unix, Mac, and Windows. ! ! IDLE accepts command line arguments. Try idle -h to see the options. ! ! ! If you find bugs or have suggestions, let us know about them by using the ! Python Bug Tracker: ! ! http://sourceforge.net/projects/python ! ! Patches are always appreciated at the Python Patch Tracker, and change ! requests should be posted to the RFE Tracker. ! ! For further details and links, read the Help files and check the IDLE home ! page at ! ! http://www.python.org/idle/ There is a mail list for IDLE: idle-dev@python.org. You can join at http://mail.python.org/mailman/listinfo/idle-dev From kbk@users.sourceforge.net Thu Jun 12 04:55:27 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Wed, 11 Jun 2003 20:55:27 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib __init__.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv2749 Modified Files: __init__.py Log Message: It /is/ a package... Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 4 Jul 2001 03:15:10 -0000 1.2 --- __init__.py 12 Jun 2003 03:55:24 -0000 1.3 *************** *** 1 **** ! # Dummy file to make this a potential package. --- 1 ---- ! # Dummy file to make this a package. From kbk@users.sourceforge.net Thu Jun 12 04:57:26 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Wed, 11 Jun 2003 20:57:26 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib ChangeLog,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv3167 Modified Files: ChangeLog Log Message: Direct readers to CVS logs. Index: ChangeLog =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/ChangeLog,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ChangeLog 20 Jul 2001 08:53:38 -0000 1.4 --- ChangeLog 12 Jun 2003 03:57:23 -0000 1.5 *************** *** 1,2 **** --- 1,6 ---- + Please refer to the IDLEfork and IDLE CVS repositories for + change details subsequent to the 0.8.1 release. + + IDLEfork ChangeLog ================== From rhettinger@users.sourceforge.net Thu Jun 12 04:59:19 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 11 Jun 2003 20:59:19 -0700 Subject: [Python-checkins] python/dist/src/Lib csv.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv3746 Modified Files: csv.py Log Message: The multiple exception catch should be in a tuple. Index: csv.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/csv.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** csv.py 12 Jun 2003 03:01:55 -0000 1.5 --- csv.py 12 Jun 2003 03:59:17 -0000 1.6 *************** *** 390,394 **** thisType(row[col]) break ! except ValueError, OverflowError: pass else: --- 390,394 ---- thisType(row[col]) break ! except (ValueError, OverflowError): pass else: From kbk@users.sourceforge.net Thu Jun 12 05:03:51 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Wed, 11 Jun 2003 21:03:51 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib Bindings.py,1.18,1.19 EditorWindow.py,1.51,1.52 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv4874 Modified Files: Bindings.py EditorWindow.py Log Message: 1. Remove the Readme entry on the Help Menu, now in About dialog. 2. Change title on About dialog. Modified Files: Bindings.py EditorWindow.py Index: Bindings.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/Bindings.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Bindings.py 2 Jun 2003 01:51:38 -0000 1.18 --- Bindings.py 12 Jun 2003 04:03:48 -0000 1.19 *************** *** 71,80 **** ('options', [ ('_Configure IDLE...', '<>'), - ## None, - ## ('Revert to _Default Settings', '<>'), ]), ('help', [ ('_About IDLE', '<>'), - ('IDLE _Readme', '<>'), None, ('_IDLE Help', '<>'), --- 71,77 ---- Index: EditorWindow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/EditorWindow.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** EditorWindow.py 7 Jun 2003 03:21:17 -0000 1.51 --- EditorWindow.py 12 Jun 2003 04:03:49 -0000 1.52 *************** *** 107,111 **** text.bind("<>", self.center_insert_event) text.bind("<>", self.help_dialog) - text.bind("<>", self.view_readme) text.bind("<>", self.python_docs) text.bind("<>", self.about_dialog) --- 107,110 ---- *************** *** 298,309 **** def about_dialog(self, event=None): ! aboutDialog.AboutDialog(self.top,'About IDLEfork') def config_dialog(self, event=None): configDialog.ConfigDialog(self.top,'Settings') - - def view_readme(self, event=None): - fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),'README.txt') - textView.TextViewer(self.top,'IDLEfork - README',fn) def help_dialog(self, event=None): --- 297,304 ---- def about_dialog(self, event=None): ! aboutDialog.AboutDialog(self.top,'About IDLE') def config_dialog(self, event=None): configDialog.ConfigDialog(self.top,'Settings') def help_dialog(self, event=None): From rhettinger@users.sourceforge.net Thu Jun 12 05:05:03 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 11 Jun 2003 21:05:03 -0700 Subject: [Python-checkins] python/dist/src/Lib csv.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv5517 Modified Files: csv.py Log Message: One more multiple exception catch should be in a tuple. Index: csv.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/csv.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** csv.py 12 Jun 2003 03:59:17 -0000 1.6 --- csv.py 12 Jun 2003 04:05:00 -0000 1.7 *************** *** 420,424 **** try: colType(header[col]) ! except ValueError, TypeError: hasHeader += 1 else: --- 420,424 ---- try: colType(header[col]) ! except (ValueError, TypeError): hasHeader += 1 else: From kbk@users.sourceforge.net Thu Jun 12 05:20:58 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Wed, 11 Jun 2003 21:20:58 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib aboutDialog.py,1.10,1.11 textView.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv8961 Modified Files: aboutDialog.py textView.py Log Message: aboutDialog.py: 1. Add additional buttons for Python Copyright and Credits 2. Use the Python LICENSE file instead of the old IDLE LICENSE.txt 3. Add additional buttons for IDLE's README and NEWS 4. Implement a method to read text from a _Printer object 5. Rename the Ok button to Close 6. Clean up to conform to Python code formatting standards textView.py: 1. Change background to white on all platforms 2. Increase height of frame 3. Add an optional parameter to textViewer to allow inserting text into the viewer instead of reading a file. 4. Rename the Ok button to Close Modified Files: aboutDialog.py textView.py Index: aboutDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/aboutDialog.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** aboutDialog.py 30 May 2003 02:42:02 -0000 1.10 --- aboutDialog.py 12 Jun 2003 04:20:55 -0000 1.11 *************** *** 1,4 **** ! """ ! about box for idle """ --- 1,4 ---- ! """About Dialog for IDLE ! """ *************** *** 9,14 **** class AboutDialog(Toplevel): ! """ ! modal about dialog for idle """ def __init__(self,parent,title): --- 9,14 ---- class AboutDialog(Toplevel): ! """Modal about dialog for idle ! """ def __init__(self,parent,title): *************** *** 16,25 **** self.configure(borderwidth=5) self.geometry("+%d+%d" % (parent.winfo_rootx()+30, ! parent.winfo_rooty()+30)) ! self.bg="#707070" ! self.fg="#ffffff" ! self.CreateWidgets() ! self.resizable(height=FALSE,width=FALSE) self.title(title) self.transient(parent) --- 16,24 ---- self.configure(borderwidth=5) self.geometry("+%d+%d" % (parent.winfo_rootx()+30, ! parent.winfo_rooty()+30)) ! self.bg = "#707070" ! self.fg = "#ffffff" self.CreateWidgets() ! self.resizable(height=FALSE, width=FALSE) self.title(title) self.transient(parent) *************** *** 28,34 **** self.parent = parent self.buttonOk.focus_set() - #key bindings for this dialog - self.bind('',self.CreditsButtonBinding) #credits button - self.bind('',self.LicenseButtonBinding) #license button self.bind('',self.Ok) #dismiss dialog self.bind('',self.Ok) #dismiss dialog --- 27,30 ---- *************** *** 36,85 **** def CreateWidgets(self): ! frameMain = Frame(self,borderwidth=2,relief=SUNKEN) frameButtons = Frame(self) ! frameButtons.pack(side=BOTTOM,fill=X) ! frameMain.pack(side=TOP,expand=TRUE,fill=BOTH) ! self.buttonOk = Button(frameButtons,text='Ok', ! command=self.Ok)#,default=ACTIVE ! self.buttonOk.pack(padx=5,pady=5) ! #self.picture = Image('photo',data=self.pictureData) ! frameBg = Frame(frameMain,bg=self.bg) ! frameBg.pack(expand=TRUE,fill=BOTH) ! labelTitle = Label(frameBg,text='IDLEfork',fg=self.fg,bg=self.bg, ! font=('courier', 24, 'bold')) ! labelTitle.grid(row=0,column=0,sticky=W,padx=10,pady=10) ! #labelPicture = Label(frameBg,text='[picture]') ! #image=self.picture,bg=self.bg) ! #labelPicture.grid(row=0,column=1,sticky=W,rowspan=2,padx=0,pady=3) ! labelVersion = Label(frameBg,text='version '+idlever.IDLE_VERSION, ! fg=self.fg,bg=self.bg) ! labelVersion.grid(row=1,column=0,sticky=W,padx=10,pady=5) ! labelDesc = Label(frameBg, ! text="A development version of Python's lightweight\n"+ ! 'Integrated DeveLopment Environment, IDLE.', ! justify=LEFT,fg=self.fg,bg=self.bg) ! labelDesc.grid(row=2,column=0,sticky=W,columnspan=3,padx=10,pady=5) ! labelCopyright = Label(frameBg, ! text="Copyright (c) 2001 - 2003 Python Software Foundation\nAll Rights Reserved", ! justify=LEFT,fg=self.fg,bg=self.bg) ! labelCopyright.grid(row=3,column=0,sticky=W,columnspan=3,padx=10,pady=5) ! labelLicense = Label(frameBg, ! text='Released under the Python 2.3 PSF License', ! justify=LEFT,fg=self.fg,bg=self.bg) ! labelLicense.grid(row=4,column=0,sticky=W,columnspan=3,padx=10,pady=5) ! Frame(frameBg,height=5,bg=self.bg).grid(row=5,column=0) ! labelEmail = Label(frameBg,text='email: idle-dev@python.org', ! justify=LEFT,fg=self.fg,bg=self.bg) labelEmail.grid(row=6,column=0,columnspan=2,sticky=W,padx=10,pady=0) ! labelWWW = Label(frameBg,text='www: http://idlefork.sourceforge.net', ! justify=LEFT,fg=self.fg,bg=self.bg) ! labelWWW.grid(row=7,column=0,columnspan=2,sticky=W,padx=10,pady=0) ! Frame(frameBg,borderwidth=1,relief=SUNKEN, ! height=2,bg=self.bg).grid(row=8,column=0,sticky=EW, ! columnspan=3, padx=5, pady=5) ! labelPythonVer = Label(frameBg,text='Python version: '+ ! sys.version.split()[0],fg=self.fg,bg=self.bg) ! labelPythonVer.grid(row=9,column=0,sticky=W,padx=10,pady=0) ! #handle weird tk version num in windoze python >= 1.6 (?!?) tkVer = `TkVersion`.split('.') tkVer[len(tkVer)-1] = str('%.3g' % (float('.'+tkVer[len(tkVer)-1])))[2:] --- 32,69 ---- def CreateWidgets(self): ! frameMain = Frame(self, borderwidth=2, relief=SUNKEN) frameButtons = Frame(self) ! frameButtons.pack(side=BOTTOM, fill=X) ! frameMain.pack(side=TOP, expand=TRUE, fill=BOTH) ! self.buttonOk = Button(frameButtons, text='Close', ! command=self.Ok) ! self.buttonOk.pack(padx=5, pady=5) ! #self.picture = Image('photo', data=self.pictureData) ! frameBg = Frame(frameMain, bg=self.bg) ! frameBg.pack(expand=TRUE, fill=BOTH) ! labelTitle = Label(frameBg, text='IDLE', fg=self.fg, bg=self.bg, ! font=('courier', 24, 'bold')) ! labelTitle.grid(row=0, column=0, sticky=W, padx=10, pady=10) ! #labelPicture = Label(frameBg, text='[picture]') ! #image=self.picture, bg=self.bg) ! #labelPicture.grid(row=1, column=1, sticky=W, rowspan=2, ! # padx=0, pady=3) ! byline = "Python's Integrated DeveLopment Environment" + 5*'\n' ! labelDesc = Label(frameBg, text=byline, justify=LEFT, ! fg=self.fg, bg=self.bg) ! labelDesc.grid(row=2, column=0, sticky=W, columnspan=3, padx=10, pady=5) ! labelEmail = Label(frameBg, text='email: idle-dev@python.org', ! justify=LEFT, fg=self.fg, bg=self.bg) labelEmail.grid(row=6,column=0,columnspan=2,sticky=W,padx=10,pady=0) ! labelWWW = Label(frameBg, text='www: http://www.python.org/idle/', ! justify=LEFT, fg=self.fg, bg=self.bg) ! labelWWW.grid(row=7, column=0, columnspan=2, sticky=W, padx=10, pady=0) ! Frame(frameBg, borderwidth=1, relief=SUNKEN, ! height=2, bg=self.bg).grid(row=8, column=0, sticky=EW, ! columnspan=3, padx=5, pady=5) ! labelPythonVer = Label(frameBg, text='Python version: ' + \ ! sys.version.split()[0], fg=self.fg, bg=self.bg) ! labelPythonVer.grid(row=9, column=0, sticky=W, padx=10, pady=0) ! # handle weird tk version num in windoze python >= 1.6 (?!?) tkVer = `TkVersion`.split('.') tkVer[len(tkVer)-1] = str('%.3g' % (float('.'+tkVer[len(tkVer)-1])))[2:] *************** *** 87,113 **** tkVer[len(tkVer)-1] = '0' tkVer = string.join(tkVer,'.') ! labelTkVer = Label(frameBg,text='Tk version: '+ ! tkVer,fg=self.fg,bg=self.bg) ! labelTkVer.grid(row=9,column=1,sticky=W,padx=2,pady=0) ! ! self.buttonLicense = Button(frameBg,text='View License',underline=5, ! width=14,highlightbackground=self.bg,command=self.ShowLicense)#takefocus=FALSE ! self.buttonLicense.grid(row=10,column=0,sticky=W,padx=10,pady=10) ! self.buttonCredits = Button(frameBg,text='View Credits',underline=5, ! width=14,highlightbackground=self.bg,command=self.ShowCredits)#takefocus=FALSE ! self.buttonCredits.grid(row=10,column=1,columnspan=2,sticky=E,padx=10,pady=10) ! def CreditsButtonBinding(self,event): ! self.buttonCredits.invoke() ! def LicenseButtonBinding(self,event): ! self.buttonLicense.invoke() ! def ShowLicense(self): ! self.ViewFile('About - License','LICENSE.txt') ! def ShowCredits(self): self.ViewFile('About - Credits','CREDITS.txt') def ViewFile(self,viewTitle,viewFile): fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),viewFile) --- 71,135 ---- tkVer[len(tkVer)-1] = '0' tkVer = string.join(tkVer,'.') ! labelTkVer = Label(frameBg, text='Tk version: '+ ! tkVer, fg=self.fg, bg=self.bg) ! labelTkVer.grid(row=9, column=1, sticky=W, padx=2, pady=0) ! py_button_f = Frame(frameBg, bg=self.bg) ! py_button_f.grid(row=10, column=0, columnspan=2, sticky=NSEW) ! buttonLicense = Button(py_button_f, text='License', width=8, ! highlightbackground=self.bg, ! command=self.ShowLicense) ! buttonLicense.pack(side=LEFT, padx=10, pady=10) ! buttonCopyright = Button(py_button_f, text='Copyright', width=8, ! highlightbackground=self.bg, ! command=self.ShowCopyright) ! buttonCopyright.pack(side=LEFT, padx=10, pady=10) ! buttonCredits = Button(py_button_f, text='Credits', width=8, ! highlightbackground=self.bg, ! command=self.ShowPythonCredits) ! buttonCredits.pack(side=LEFT, padx=10, pady=10) ! Frame(frameBg, borderwidth=1, relief=SUNKEN, ! height=2, bg=self.bg).grid(row=11, column=0, sticky=EW, ! columnspan=3, padx=5, pady=5) ! idle_v = Label(frameBg, text='IDLE version ' + idlever.IDLE_VERSION, ! fg=self.fg, bg=self.bg) ! idle_v.grid(row=12, column=0, sticky=W, padx=10, pady=0) ! idle_button_f = Frame(frameBg, bg=self.bg) ! idle_button_f.grid(row=13, column=0, columnspan=3, sticky=NSEW) ! idle_about_b = Button(idle_button_f, text='README', width=8, ! highlightbackground=self.bg, ! command=self.ShowIDLEAbout) ! idle_about_b.pack(side=LEFT, padx=10, pady=10) ! idle_news_b = Button(idle_button_f, text='NEWS', width=8, ! highlightbackground=self.bg, ! command=self.ShowIDLENEWS) ! idle_news_b.pack(side=LEFT, padx=10, pady=10) ! idle_credits_b = Button(idle_button_f, text='Credits', width=8, ! highlightbackground=self.bg, ! command=self.ShowIDLECredits) ! idle_credits_b.pack(side=LEFT, padx=10, pady=10) ! def ShowLicense(self): ! self.display_printer_text(license, 'About - License') ! def ShowCopyright(self): ! self.display_printer_text(copyright, 'About - Copyright') ! def ShowPythonCredits(self): ! self.display_printer_text(credits, 'About - Python Credits') ! def ShowIDLECredits(self): self.ViewFile('About - Credits','CREDITS.txt') + def ShowIDLEAbout(self): + self.ViewFile('About - Readme', 'README.txt') + + def ShowIDLENEWS(self): + self.ViewFile('About - NEWS', 'NEWS.txt') + + def display_printer_text(self, printer, title): + printer._Printer__setup() + data = '\n'.join(printer._Printer__lines) + textView.TextViewer(self, title, None, data) + def ViewFile(self,viewTitle,viewFile): fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),viewFile) *************** *** 118,126 **** if __name__ == '__main__': ! #test the dialog ! root=Tk() def run(): import aboutDialog aboutDialog.AboutDialog(root,'About') ! Button(root,text='Dialog',command=run).pack() root.mainloop() --- 140,148 ---- if __name__ == '__main__': ! # test the dialog ! root = Tk() def run(): import aboutDialog aboutDialog.AboutDialog(root,'About') ! Button(root, text='Dialog', command=run).pack() root.mainloop() Index: textView.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/textView.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** textView.py 31 Dec 2002 16:03:23 -0000 1.3 --- textView.py 12 Jun 2003 04:20:56 -0000 1.4 *************** *** 1,11 **** ! ##---------------------------------------------------------------------------## ! ## ! ## idle - simple text view dialog ! ## elguavas ! ## ! ##---------------------------------------------------------------------------## ! """ ! simple text browser for idle """ from Tkinter import * import tkMessageBox --- 1,6 ---- ! """Simple text browser for IDLE ! """ + from Tkinter import * import tkMessageBox *************** *** 15,29 **** simple text viewer dialog for idle """ ! def __init__(self,parent,title,fileName): ! """ ! fileName - string,should be an absoulute filename """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) ! self.geometry("+%d+%d" % (parent.winfo_rootx()+10, ! parent.winfo_rooty()+10)) #elguavas - config placeholders til config stuff completed ! self.bg=None ! self.fg=None self.CreateWidgets() --- 10,26 ---- simple text viewer dialog for idle """ ! def __init__(self, parent, title, fileName, data=None): ! """If data exists, load it into viewer, otherwise try to load file. ! ! fileName - string, should be an absoulute filename """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) ! self.geometry("=%dx%d+%d+%d" % (625, 500, ! parent.winfo_rootx() + 10, ! parent.winfo_rooty() + 10)) #elguavas - config placeholders til config stuff completed ! self.bg = '#ffffff' ! self.fg = '#000000' self.CreateWidgets() *************** *** 37,41 **** self.bind('',self.Ok) #dismiss dialog self.bind('',self.Ok) #dismiss dialog ! self.LoadTextFile(fileName) self.textView.config(state=DISABLED) self.wait_window() --- 34,41 ---- self.bind('',self.Ok) #dismiss dialog self.bind('',self.Ok) #dismiss dialog ! if data: ! self.textView.insert(0.0, data) ! else: ! self.LoadTextFile(fileName) self.textView.config(state=DISABLED) self.wait_window() *************** *** 52,65 **** def CreateWidgets(self): ! frameText = Frame(self) frameButtons = Frame(self) ! self.buttonOk = Button(frameButtons,text='Ok', ! command=self.Ok,takefocus=FALSE,default=ACTIVE) ! self.scrollbarView = Scrollbar(frameText,orient=VERTICAL, ! takefocus=FALSE,highlightthickness=0) ! self.textView = Text(frameText,wrap=WORD,highlightthickness=0) self.scrollbarView.config(command=self.textView.yview) self.textView.config(yscrollcommand=self.scrollbarView.set) ! self.buttonOk.pack(padx=5,pady=5) self.scrollbarView.pack(side=RIGHT,fill=Y) self.textView.pack(side=LEFT,expand=TRUE,fill=BOTH) --- 52,66 ---- def CreateWidgets(self): ! frameText = Frame(self, relief=SUNKEN, height=700) frameButtons = Frame(self) ! self.buttonOk = Button(frameButtons, text='Close', ! command=self.Ok, takefocus=FALSE) ! self.scrollbarView = Scrollbar(frameText, orient=VERTICAL, ! takefocus=FALSE, highlightthickness=0) ! self.textView = Text(frameText, wrap=WORD, highlightthickness=0, ! fg=self.fg, bg=self.bg) self.scrollbarView.config(command=self.textView.yview) self.textView.config(yscrollcommand=self.scrollbarView.set) ! self.buttonOk.pack() self.scrollbarView.pack(side=RIGHT,fill=Y) self.textView.pack(side=LEFT,expand=TRUE,fill=BOTH) From kbk@users.sourceforge.net Thu Jun 12 05:38:15 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Wed, 11 Jun 2003 21:38:15 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib setup.cfg,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv19279 Removed Files: setup.cfg Log Message: No longer needed. --- setup.cfg DELETED --- From anthonybaxter@users.sourceforge.net Thu Jun 12 07:08:58 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Wed, 11 Jun 2003 23:08:58 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Parser.py,1.20,1.20.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv17621 Modified Files: Tag: anthony-parser-branch Parser.py Log Message: A work-in-progress snapshot of the new parser. A couple of known problems: - first (blank) line of MIME epilogues is being consumed - message/delivery-status isn't quite right It still needs a lot of cleanup, but right now it parses a whole lot of badness that the old parser failed on. I also need to think about adding back the old 'strict' flag in some way. Index: Parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Parser.py,v retrieving revision 1.20 retrieving revision 1.20.4.1 diff -C2 -d -r1.20 -r1.20.4.1 *** Parser.py 6 Mar 2003 05:25:35 -0000 1.20 --- Parser.py 12 Jun 2003 06:08:56 -0000 1.20.4.1 *************** *** 23,26 **** --- 23,96 ---- NLCRE = re.compile('\r\n|\r|\n') + class TextUtil: + """ A utility class for wrapping a file object and providing a + couple of additional useful functions. + """ + + def __init__(self, fp): + self.fp = fp + self.unread = [] + + def readline(self): + """ Return a line of data. + + If data has been pushed back with unreadline(), the most recently + returned unreadline()d data will be returned. + """ + if self.unread: + return self.unread.pop() + else: + return self.fp.readline() + + def unreadline(self, line): + """Push a line back into the object. + """ + self.unread.append(line) + + def peekline(self): + """Non-destructively look at the next line""" + line = self.readline() + self.unreadline(line) + return line + + def read(self): + """Return the remaining data + """ + r = self.fp.read() + if self.unread: + self.unread.append(r) + r = "\n".join(self.unread) + r + self.unread = [] + return r + + def readuntil(self, re, afterblank=0, includematch=0): + """Read a line at a time until we get the specified RE. + + Returns the text up to (and including, if includematch is true) the + matched text, and the RE match object. If afterblank is true, + there must be a blank line before the matched text. Moves current + filepointer to the line following the matched line. If we reach + end-of-file, return what we've got so far, and return None as the + RE match object. + """ + prematch = [] + blankseen = 0 + while 1: + line = self.readline() + if not line: + # end of file + return EMPTYSTRING.join(prematch), None + if afterblank: + if NLCRE.match(line): + blankseen = 1 + continue + else: + blankseen = 0 + m = re.match(line) + if (m and not afterblank) or (m and afterblank and blankseen): + if includematch: + prematch.append(line) + return EMPTYSTRING.join(prematch), m + prematch.append(line) *************** *** 60,66 **** """ root = self._class() ! firstbodyline = self._parseheaders(root, fp) if not headersonly: ! self._parsebody(root, fp, firstbodyline) return root --- 130,139 ---- """ root = self._class() ! fp = TextUtil(fp) ! self._parseheaders(root, fp) if not headersonly: ! obj = self._parsemessage(root, fp) ! trailer = fp.read() ! self._attach_trailer(obj, trailer) return root *************** *** 81,85 **** lastvalue = [] lineno = 0 - firstbodyline = None while True: # Don't strip the line before we test for the end condition, --- 154,157 ---- *************** *** 130,134 **** # 2822, but we're in non-strict mode. So just offer up # this current line as the first body line. ! firstbodyline = line break if lastheader: --- 202,206 ---- # 2822, but we're in non-strict mode. So just offer up # this current line as the first body line. ! fp.unreadline(line) break if lastheader: *************** *** 139,276 **** if lastheader: container[lastheader] = NL.join(lastvalue) ! return firstbodyline ! def _parsebody(self, container, fp, firstbodyline=None): ! # Parse the body, but first split the payload on the content-type ! # boundary if present. boundary = container.get_boundary() isdigest = (container.get_content_type() == 'multipart/digest') ! # If there's a boundary, split the payload text into its constituent ! # parts and parse each separately. Otherwise, just parse the rest of ! # the body as a single message. Note: any exceptions raised in the ! # recursive parse need to have their line numbers coerced. ! if boundary: preamble = epilogue = None - # Split into subparts. The first boundary we're looking for won't - # always have a leading newline since we're at the start of the - # body text, and there's not always a preamble before the first - # boundary. separator = '--' + boundary ! payload = fp.read() ! if firstbodyline is not None: ! payload = firstbodyline + '\n' + payload ! # We use an RE here because boundaries can have trailing ! # whitespace. ! mo = re.search( ! r'(?P' + re.escape(separator) + r')(?P[ \t]*)', ! payload) ! if not mo: ! if self._strict: ! raise Errors.BoundaryError( ! "Couldn't find starting boundary: %s" % boundary) ! container.set_payload(payload) ! return ! start = mo.start() ! if start > 0: ! # there's some pre-MIME boundary preamble ! preamble = payload[0:start] ! # Find out what kind of line endings we're using ! start += len(mo.group('sep')) + len(mo.group('ws')) ! mo = NLCRE.search(payload, start) ! if mo: ! start += len(mo.group(0)) ! # We create a compiled regexp first because we need to be able to ! # specify the start position, and the module function doesn't ! # support this signature. :( ! cre = re.compile('(?P\r\n|\r|\n)' + ! re.escape(separator) + '--') ! mo = cre.search(payload, start) ! if mo: ! terminator = mo.start() ! linesep = mo.group('sep') ! if mo.end() < len(payload): ! # There's some post-MIME boundary epilogue ! epilogue = payload[mo.end():] ! elif self._strict: ! raise Errors.BoundaryError( ! "Couldn't find terminating boundary: %s" % boundary) ! else: ! # Handle the case of no trailing boundary. Check that it ends ! # in a blank line. Some cases (spamspamspam) don't even have ! # that! ! mo = re.search('(?P\r\n|\r|\n){2}$', payload) ! if not mo: ! mo = re.search('(?P\r\n|\r|\n)$', payload) ! if not mo: ! raise Errors.BoundaryError( ! 'No terminating boundary and no trailing empty line') ! linesep = mo.group('sep') ! terminator = len(payload) ! # We split the textual payload on the boundary separator, which ! # includes the trailing newline. If the container is a ! # multipart/digest then the subparts are by default message/rfc822 ! # instead of text/plain. In that case, they'll have a optional ! # block of MIME headers, then an empty line followed by the ! # message headers. ! parts = re.split( ! linesep + re.escape(separator) + r'[ \t]*' + linesep, ! payload[start:terminator]) ! for part in parts: if isdigest: ! if part.startswith(linesep): ! # There's no header block so create an empty message ! # object as the container, and lop off the newline so ! # we can parse the sub-subobject ! msgobj = self._class() ! part = part[len(linesep):] ! else: ! parthdrs, part = part.split(linesep+linesep, 1) ! # msgobj in this case is the "message/rfc822" container ! msgobj = self.parsestr(parthdrs, headersonly=1) ! # while submsgobj is the message itself ! msgobj.set_default_type('message/rfc822') ! maintype = msgobj.get_content_maintype() ! if maintype in ('message', 'multipart'): ! submsgobj = self.parsestr(part) ! msgobj.attach(submsgobj) else: ! msgobj.set_payload(part) else: ! msgobj = self.parsestr(part) ! container.preamble = preamble ! container.epilogue = epilogue ! container.attach(msgobj) ! elif container.get_main_type() == 'multipart': # Very bad. A message is a multipart with no boundary! raise Errors.BoundaryError( ! 'multipart message with no defined boundary') ! elif container.get_type() == 'message/delivery-status': ! # This special kind of type contains blocks of headers separated ! # by a blank line. We'll represent each header block as a ! # separate Message object ! blocks = [] ! while True: ! blockmsg = self._class() ! self._parseheaders(blockmsg, fp) ! if not len(blockmsg): ! # No more header blocks left ! break ! blocks.append(blockmsg) ! container.set_payload(blocks) ! elif container.get_main_type() == 'message': ! # Create a container for the payload, but watch out for there not ! # being any headers left ! try: ! msg = self.parse(fp) ! except Errors.HeaderParseError: ! msg = self._class() ! self._parsebody(msg, fp) ! container.attach(msg) else: ! text = fp.read() ! if firstbodyline is not None: ! text = firstbodyline + '\n' + text ! container.set_payload(text) --- 211,312 ---- if lastheader: container[lastheader] = NL.join(lastvalue) ! return ! def _parsemessage(self, container, fp): ! # Parse the body. We walk through the body from top to bottom, ! # keeping track of the current multipart nesting as we go. ! # We return the object that gets the data at the end of this ! # block. boundary = container.get_boundary() isdigest = (container.get_content_type() == 'multipart/digest') ! if boundary: preamble = epilogue = None separator = '--' + boundary ! boundaryRE = re.compile( ! r'(?P' + re.escape(separator) + ! r')(?P--)?(?P[ \t]*)') ! preamble, matchobj = fp.readuntil(boundaryRE) ! if not matchobj: ! # Broken. Just set the body to the text ! container.set_payload(preamble) ! return container ! container.preamble = preamble ! while 1: ! subobj = self._class() if isdigest: ! subobj.set_default_type('message/rfc822') ! firstline = fp.peekline() ! if firstline.strip(): ! # we have MIME headers. all good. ! self._parseheaders(subobj, fp) else: ! # no MIME headers. this is allowed for multipart/digest ! # Consume the extra blank line ! fp.readline() ! pass else: ! self._parseheaders(subobj, fp) ! container.attach(subobj) ! maintype = subobj.get_content_maintype() ! hassubparts = (subobj.get_content_maintype() in ! ( "message", "multipart" )) ! rfc822 = (subobj.get_content_type() == "message/rfc822") ! if hassubparts: ! subobj = self._parsemessage(subobj, fp) ! ! trailer, matchobj = fp.readuntil(boundaryRE) ! if matchobj is None or trailer: ! mo = re.search('(?P\r\n|\r|\n){2}$', trailer) ! if not mo: ! mo = re.search('(?P\r\n|\r|\n)$', trailer) ! if not mo: ! raise Errors.BoundaryError( ! 'No terminating boundary and no trailing empty line') ! linesep = mo.group('sep') ! trailer = trailer[:-len(linesep)] ! if trailer: ! self._attach_trailer(subobj, trailer) ! if matchobj.group('end'): ! # That was the last piece of data. Let our caller attach ! # the epilogue to us. ! return container ! ! elif container.get_content_maintype() == "multipart": # Very bad. A message is a multipart with no boundary! raise Errors.BoundaryError( ! 'multipart message with no defined boundary') ! elif container.get_content_maintype() == "message": ! ct = container.get_content_type() ! if ct == "message/rfc822": ! # Error. ! submessage = self._class() ! self._parseheaders(submessage, fp) ! self._parsemessage(submessage, fp) ! container.attach(submessage) ! return submessage ! elif ct == "message/delivery-status": ! # This special kind of type contains blocks of headers ! # separated by a blank line. We'll represent each header ! # block as a separate Message object ! while 1: ! nextblock = self._class() ! self._parseheaders(nextblock, fp) ! container.attach(nextblock) ! # next peek ahead to see whether we've hit the end or not ! nextline = fp.peekline() ! if nextline[:2] == "--": ! break ! return container ! else: ! raise ValueError, "%s not implemented yet"%(ct) else: ! # single body section. We let our caller set the payload. ! return container + def _attach_trailer(self, obj, trailer): + if obj.get_content_maintype() in ("message", "multipart"): + obj.epilogue = trailer + else: + obj.set_payload(trailer) *************** *** 285,292 **** interested in is the message headers. """ ! def _parsebody(self, container, fp, firstbodyline=None): # Consume but do not parse, the body text = fp.read() - if firstbodyline is not None: - text = firstbodyline + '\n' + text container.set_payload(text) --- 321,326 ---- interested in is the message headers. """ ! def _parsemessage(self, container, fp): # Consume but do not parse, the body text = fp.read() container.set_payload(text) From anthonybaxter@users.sourceforge.net Thu Jun 12 07:39:11 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Wed, 11 Jun 2003 23:39:11 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Parser.py,1.20.4.1,1.20.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv27097 Modified Files: Tag: anthony-parser-branch Parser.py Log Message: message/delivery-status fixed. HeaderParser fixed. Index: Parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Parser.py,v retrieving revision 1.20.4.1 retrieving revision 1.20.4.2 diff -C2 -d -r1.20.4.1 -r1.20.4.2 *** Parser.py 12 Jun 2003 06:08:56 -0000 1.20.4.1 --- Parser.py 12 Jun 2003 06:39:09 -0000 1.20.4.2 *************** *** 135,139 **** obj = self._parsemessage(root, fp) trailer = fp.read() ! self._attach_trailer(obj, trailer) return root --- 135,140 ---- obj = self._parsemessage(root, fp) trailer = fp.read() ! if obj and trailer: ! self._attach_trailer(obj, trailer) return root *************** *** 221,225 **** isdigest = (container.get_content_type() == 'multipart/digest') if boundary: - preamble = epilogue = None separator = '--' + boundary boundaryRE = re.compile( --- 222,225 ---- *************** *** 228,232 **** preamble, matchobj = fp.readuntil(boundaryRE) if not matchobj: ! # Broken. Just set the body to the text container.set_payload(preamble) return container --- 228,233 ---- preamble, matchobj = fp.readuntil(boundaryRE) if not matchobj: ! # Broken - we hit the end of file. Just set the body ! # to the text. container.set_payload(preamble) return container *************** *** 297,301 **** if nextline[:2] == "--": break ! return container else: raise ValueError, "%s not implemented yet"%(ct) --- 298,302 ---- if nextline[:2] == "--": break ! return container else: raise ValueError, "%s not implemented yet"%(ct) *************** *** 325,326 **** --- 326,328 ---- text = fp.read() container.set_payload(text) + return None From anthonybaxter@users.sourceforge.net Thu Jun 12 08:16:44 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Thu, 12 Jun 2003 00:16:44 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Parser.py,1.20.4.2,1.20.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv13876 Modified Files: Tag: anthony-parser-branch Parser.py Log Message: epilogue-processing is now the same as the old parser - the newline at the end of the line with the --endboundary-- is included as part of the epilogue. Note that any whitespace after the boundary is _not_ part of the epilogue. Index: Parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Parser.py,v retrieving revision 1.20.4.2 retrieving revision 1.20.4.3 diff -C2 -d -r1.20.4.2 -r1.20.4.3 *** Parser.py 12 Jun 2003 06:39:09 -0000 1.20.4.2 --- Parser.py 12 Jun 2003 07:16:40 -0000 1.20.4.3 *************** *** 59,65 **** r = self.fp.read() if self.unread: - self.unread.append(r) r = "\n".join(self.unread) + r ! self.unread = [] return r --- 59,64 ---- r = self.fp.read() if self.unread: r = "\n".join(self.unread) + r ! self.unread = [] return r *************** *** 225,229 **** boundaryRE = re.compile( r'(?P' + re.escape(separator) + ! r')(?P--)?(?P[ \t]*)') preamble, matchobj = fp.readuntil(boundaryRE) if not matchobj: --- 224,228 ---- boundaryRE = re.compile( r'(?P' + re.escape(separator) + ! r')(?P--)?(?P[ \t]*)(?P\r\n|\r|\n)$') preamble, matchobj = fp.readuntil(boundaryRE) if not matchobj: *************** *** 270,274 **** if matchobj.group('end'): # That was the last piece of data. Let our caller attach ! # the epilogue to us. return container --- 269,276 ---- if matchobj.group('end'): # That was the last piece of data. Let our caller attach ! # the epilogue to us. But before we do that, push the ! # line ending of the match group back into the readline ! # buffer, as it's part of the epilogue. ! fp.unreadline(matchobj.group('linesep')) return container From bcannon@users.sourceforge.net Thu Jun 12 09:01:09 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Thu, 12 Jun 2003 01:01:09 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_tarfile.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv838/Lib/test Modified Files: test_tarfile.py Log Message: Make creation of temporary file and directory more portable. Also made cleanup code use proper functions to get paths. Changed the name of tar file that is searched for to be absolute (i.e., not use os.extsep) since filename is locked in based on name of file in CVS (testtar.tar). Closes bug #731403 . Index: test_tarfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tarfile.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_tarfile.py 10 May 2003 07:36:55 -0000 1.9 --- test_tarfile.py 12 Jun 2003 08:01:06 -0000 1.10 *************** *** 2,5 **** --- 2,6 ---- import os import shutil + import tempfile import unittest *************** *** 22,28 **** return test_support.findfile(path) ! testtar = path("testtar" + os.extsep + "tar") ! tempdir = path("testtar" + os.extsep + "dir") ! tempname = path("testtar" + os.extsep + "tmp") membercount = 10 --- 23,29 ---- return test_support.findfile(path) ! testtar = path("testtar.tar") ! tempdir = os.path.join(tempfile.gettempdir(), "testtar" + os.extsep + "dir") ! tempname = test_support.TESTFN membercount = 10 *************** *** 266,273 **** if bz2: os.remove(tarname("bz2")) ! if os.path.exists(tempdir): ! shutil.rmtree(tempdir) ! if os.path.exists(tempname): ! os.remove(tempname) if __name__ == "__main__": --- 267,274 ---- if bz2: os.remove(tarname("bz2")) ! if os.path.exists(dirname()): ! shutil.rmtree(dirname()) ! if os.path.exists(tmpname()): ! os.remove(tmpname()) if __name__ == "__main__": From anthonybaxter@users.sourceforge.net Thu Jun 12 10:14:21 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Thu, 12 Jun 2003 02:14:21 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Parser.py,1.20.4.3,1.20.4.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv2799 Modified Files: Tag: anthony-parser-branch Parser.py Log Message: preamble is None when missing, not ''. Handle a couple of bogus formatted messages - now parses my main testsuite. Handle message/external-body. Index: Parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Parser.py,v retrieving revision 1.20.4.3 retrieving revision 1.20.4.4 diff -C2 -d -r1.20.4.3 -r1.20.4.4 *** Parser.py 12 Jun 2003 07:16:40 -0000 1.20.4.3 --- Parser.py 12 Jun 2003 09:14:17 -0000 1.20.4.4 *************** *** 231,235 **** container.set_payload(preamble) return container ! container.preamble = preamble while 1: subobj = self._class() --- 231,239 ---- container.set_payload(preamble) return container ! if preamble: ! container.preamble = preamble ! else: ! # The module docs specify an empty preamble is None, not '' ! container.preamble = None while 1: subobj = self._class() *************** *** 251,255 **** hassubparts = (subobj.get_content_maintype() in ( "message", "multipart" )) - rfc822 = (subobj.get_content_type() == "message/rfc822") if hassubparts: subobj = self._parsemessage(subobj, fp) --- 255,258 ---- *************** *** 267,276 **** if trailer: self._attach_trailer(subobj, trailer) ! if matchobj.group('end'): # That was the last piece of data. Let our caller attach # the epilogue to us. But before we do that, push the # line ending of the match group back into the readline # buffer, as it's part of the epilogue. ! fp.unreadline(matchobj.group('linesep')) return container --- 270,280 ---- if trailer: self._attach_trailer(subobj, trailer) ! if matchobj is None or matchobj.group('end'): # That was the last piece of data. Let our caller attach # the epilogue to us. But before we do that, push the # line ending of the match group back into the readline # buffer, as it's part of the epilogue. ! if matchobj: ! fp.unreadline(matchobj.group('linesep')) return container *************** *** 282,286 **** ct = container.get_content_type() if ct == "message/rfc822": - # Error. submessage = self._class() self._parseheaders(submessage, fp) --- 286,289 ---- *************** *** 302,306 **** return container else: ! raise ValueError, "%s not implemented yet"%(ct) else: # single body section. We let our caller set the payload. --- 305,313 ---- return container else: ! # Other sort of message object (e.g. external-body) ! msg = self._class() ! self._parsemessage(msg, fp) ! container.attach(msg) ! return msg else: # single body section. We let our caller set the payload. From montanaro@users.sourceforge.net Thu Jun 12 15:04:37 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 12 Jun 2003 07:04:37 -0700 Subject: [Python-checkins] python/dist/src README,1.172,1.173 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv27964 Modified Files: README Log Message: AMK's no longer maintaining his bookstore page. Refer to the books page on the wiki instead. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.172 retrieving revision 1.173 diff -C2 -d -r1.172 -r1.173 *** README 11 May 2003 20:25:34 -0000 1.172 --- README 12 Jun 2003 14:04:33 -0000 1.173 *************** *** 69,73 **** There's a quickly growing set of books on Python. See ! http://www.python.org/psa/bookstore/ for a list. --- 69,73 ---- There's a quickly growing set of books on Python. See ! http://www.python.org/cgi-bin/moinmoin/PythonBooks for a list. From fdrake@users.sourceforge.net Thu Jun 12 14:54:03 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 12 Jun 2003 06:54:03 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.242,1.243 pep-0223.txt,1.6,1.7 pep-0227.txt,1.9,1.10 pep-0235.txt,1.3,1.4 pep-0236.txt,1.10,1.11 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv22990 Modified Files: pep-0000.txt pep-0223.txt pep-0227.txt pep-0235.txt pep-0236.txt Log Message: Update some email addresses (the digicool.com domain is no longer used). Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.242 retrieving revision 1.243 diff -C2 -d -r1.242 -r1.243 *** pep-0000.txt 10 Jun 2003 04:29:48 -0000 1.242 --- pep-0000.txt 12 Jun 2003 13:53:59 -0000 1.243 *************** *** 397,401 **** Oliphant, Travis oliphant@ee.byu.edu Pelletier, Michel michel@digicool.com ! Peters, Tim tim@digicool.com Petrone, Jason jp@demonseed.net Prescod, Paul paul@prescod.net --- 397,401 ---- Oliphant, Travis oliphant@ee.byu.edu Pelletier, Michel michel@digicool.com ! Peters, Tim tim@zope.com Petrone, Jason jp@demonseed.net Prescod, Paul paul@prescod.net Index: pep-0223.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0223.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pep-0223.txt 30 Oct 2000 20:48:44 -0000 1.6 --- pep-0223.txt 12 Jun 2003 13:54:00 -0000 1.7 *************** *** 2,6 **** Title: Change the Meaning of \x Escapes Version: $Revision$ ! Author: tim@digicool.com (Tim Peters) Status: Final Type: Standards Track --- 2,6 ---- Title: Change the Meaning of \x Escapes Version: $Revision$ ! Author: tim@zope.com (Tim Peters) Status: Final Type: Standards Track Index: pep-0227.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0227.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pep-0227.txt 20 Apr 2001 02:21:07 -0000 1.9 --- pep-0227.txt 12 Jun 2003 13:54:00 -0000 1.10 *************** *** 2,6 **** Title: Statically Nested Scopes Version: $Revision$ ! Author: jeremy@digicool.com (Jeremy Hylton) Status: Draft Type: Standards Track --- 2,6 ---- Title: Statically Nested Scopes Version: $Revision$ ! Author: jeremy@zope.com (Jeremy Hylton) Status: Draft Type: Standards Track Index: pep-0235.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0235.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0235.txt 18 Apr 2001 10:20:04 -0000 1.3 --- pep-0235.txt 12 Jun 2003 13:54:00 -0000 1.4 *************** *** 2,6 **** Title: Import on Case-Insensitive Platforms Version: $Revision$ ! Author: Tim Peters Status: Final Type: Standards Track --- 2,6 ---- Title: Import on Case-Insensitive Platforms Version: $Revision$ ! Author: Tim Peters Status: Final Type: Standards Track Index: pep-0236.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0236.txt,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pep-0236.txt 17 Aug 2001 22:42:26 -0000 1.10 --- pep-0236.txt 12 Jun 2003 13:54:00 -0000 1.11 *************** *** 2,6 **** Title: Back to the __future__ Version: $Revision$ ! Author: Tim Peters Python-Version: 2.1 Status: Final --- 2,6 ---- Title: Back to the __future__ Version: $Revision$ ! Author: Tim Peters Python-Version: 2.1 Status: Final From theller@users.sourceforge.net Thu Jun 12 18:24:04 2003 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Thu, 12 Jun 2003 10:24:04 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist_wininst.py,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1:/tmp/cvs-serv5013 Modified Files: bdist_wininst.py Log Message: Fix for sf # 749210, wininst isn't build correctly after building zip. The problem was that subcommands were not reinitialized. Bugfix candidate, will backport myself. Index: bdist_wininst.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_wininst.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** bdist_wininst.py 22 Nov 2002 21:08:33 -0000 1.45 --- bdist_wininst.py 12 Jun 2003 17:23:58 -0000 1.46 *************** *** 101,105 **** self.run_command('build') ! install = self.reinitialize_command('install') install.root = self.bdist_dir install.skip_build = self.skip_build --- 101,105 ---- self.run_command('build') ! install = self.reinitialize_command('install', reinit_subcommands=1) install.root = self.bdist_dir install.skip_build = self.skip_build From theller@users.sourceforge.net Thu Jun 12 18:30:01 2003 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Thu, 12 Jun 2003 10:30:01 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist_wininst.py,1.27.4.3,1.27.4.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1:/tmp/cvs-serv7471 Modified Files: Tag: release22-maint bdist_wininst.py Log Message: Backport of my checkin to rev 1.46: Fix for sf # 749210, wininst isn't build correctly after building zip. The problem was that subcommands were not reinitialized. Bugfix candidate, will backport myself. Index: bdist_wininst.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_wininst.py,v retrieving revision 1.27.4.3 retrieving revision 1.27.4.4 diff -C2 -d -r1.27.4.3 -r1.27.4.4 *** bdist_wininst.py 18 Apr 2002 02:30:39 -0000 1.27.4.3 --- bdist_wininst.py 12 Jun 2003 17:29:57 -0000 1.27.4.4 *************** *** 83,87 **** self.run_command('build') ! install = self.reinitialize_command('install') install.root = self.bdist_dir install.warn_dir = 0 --- 83,87 ---- self.run_command('build') ! install = self.reinitialize_command('install', reinit_subcommands=1) install.root = self.bdist_dir install.warn_dir = 0 From bcannon@users.sourceforge.net Thu Jun 12 20:17:05 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Thu, 12 Jun 2003 12:17:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_tarfile.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv19416/Lib/test Modified Files: test_tarfile.py Log Message: When calling tarname with an argument (and thus not use testtar.tar) return a path for the file in the temp directory for the platform. Index: test_tarfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tarfile.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_tarfile.py 12 Jun 2003 08:01:06 -0000 1.10 --- test_tarfile.py 12 Jun 2003 19:16:58 -0000 1.11 *************** *** 31,35 **** if not comp: return testtar ! return "%s%s%s" % (testtar, os.extsep, comp) def dirname(): --- 31,35 ---- if not comp: return testtar ! return os.path.join(tempdir, "%s%s%s" % (testtar, os.extsep, comp)) def dirname(): From anthonybaxter@users.sourceforge.net Fri Jun 13 05:32:18 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Thu, 12 Jun 2003 21:32:18 -0700 Subject: [Python-checkins] python/nondist/sandbox/distutilsref distref.tex,1.9,1.10 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/distutilsref In directory sc8-pr-cvs1:/tmp/cvs-serv3316 Modified Files: distref.tex Log Message: env vars Index: distref.tex =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/distutilsref/distref.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** distref.tex 26 May 2003 08:00:36 -0000 1.9 --- distref.tex 13 Jun 2003 04:32:15 -0000 1.10 *************** *** 1375,1378 **** --- 1375,1380 ---- \modulesynopsis{implements classes that represent module version numbers. } + % todo + \subsection{Distutils Commands} *************** *** 1416,1419 **** --- 1418,1422 ---- \subsubsection{Individual Distutils commands} + % todo \subsubsection{\module{distutils.command.bdist} -- Build a binary installer} *************** *** 1421,1424 **** --- 1424,1428 ---- \modulesynopsis{Build a binary installer for a package} + % todo \subsubsection{\module{distutils.command.bdist_packager} -- Abstract base class for packagers} *************** *** 1426,1429 **** --- 1430,1434 ---- \modulesynopsis{Abstract base class for packagers} + % todo \subsubsection{\module{distutils.command.bdist_dumb} -- Build a "dumb" installer} *************** *** 1431,1434 **** --- 1436,1440 ---- \modulesynopsis{Build a "dumb" installer - a simple archive of files} + % todo %\subsubsection{\module{} -- } *************** *** 1446,1449 **** --- 1452,1456 ---- \modulesynopsis{Build a binary distribution as a Redhat RPM and SRPM} + % todo \subsubsection{\module{distutils.command.bdist_wininst} -- Build a Windows installer} *************** *** 1451,1454 **** --- 1458,1462 ---- \modulesynopsis{Build a Windows installer} + % todo \subsubsection{\module{distutils.command.sdist} -- Build a source distribution} *************** *** 1456,1459 **** --- 1464,1468 ---- \modulesynopsis{Build a source distribution} + % todo \subsubsection{\module{distutils.command.build} -- Build all files of a package} *************** *** 1461,1464 **** --- 1470,1474 ---- \modulesynopsis{Build all files of a package} + % todo \subsubsection{\module{distutils.command.build_clib} -- Build any C libraries in a package} *************** *** 1466,1469 **** --- 1476,1480 ---- \modulesynopsis{Build any C libraries in a package} + % todo \subsubsection{\module{distutils.command.build_ext} -- Build any extensions in a package} *************** *** 1471,1474 **** --- 1482,1486 ---- \modulesynopsis{Build any extensions in a package} + % todo \subsubsection{\module{distutils.command.build_py} -- Build the .py/.pyc files of a package} *************** *** 1476,1479 **** --- 1488,1492 ---- \modulesynopsis{Build the .py/.pyc files of a package} + % todo \subsubsection{\module{distutils.command.build_scripts} -- Build the scripts of a package} *************** *** 1481,1484 **** --- 1494,1498 ---- \modulesynopsis{Build the scripts of a package} + % todo \subsubsection{\module{distutils.command.clean} -- Clean a package build area} *************** *** 1486,1489 **** --- 1500,1504 ---- \modulesynopsis{Clean a package build area} + % todo \subsubsection{\module{distutils.command.config} -- Perform package configuration} *************** *** 1491,1494 **** --- 1506,1510 ---- \modulesynopsis{Perform package configuration} + % todo \subsubsection{\module{distutils.command.install} -- Install a package} *************** *** 1496,1499 **** --- 1512,1516 ---- \modulesynopsis{Install a package} + % todo \subsubsection{\module{distutils.command.install_data} -- Install data files from a package} *************** *** 1501,1504 **** --- 1518,1522 ---- \modulesynopsis{Install data files from a package} + % todo \subsubsection{\module{distutils.command.install_headers} -- Install C/C++ header files from a package} *************** *** 1506,1509 **** --- 1524,1528 ---- \modulesynopsis{Install C/C++ header files from a package} + % todo \subsubsection{\module{distutils.command.install_lib} -- Install library files from a package} *************** *** 1511,1514 **** --- 1530,1534 ---- \modulesynopsis{Install library files from a package} + % todo \subsubsection{\module{distutils.command.install_scripts} -- Install script files from a package} *************** *** 1516,1519 **** --- 1536,1540 ---- \modulesynopsis{Install script files from a package} + % todo \subsubsection{\module{distutils.command.register} -- Register a module with the Python Package Index} *************** *** 1523,1526 **** --- 1544,1548 ---- The \code{register} command registers the package with the Python Package Index. This is described in more detail in \pep{301}. + % todo \subsubsection{Creating a new Distutils command} *************** *** 1583,1585 **** --- 1605,1625 ---- predicates can be unbound methods, so they must already have been defined. The canonical example is the \code{install} command. + + \subsection{Running setup.py scripts} + + In this section, some documentation about how to run a distutils setup.py + to set various flags. + + \subsubsection{Environment Variables} + + The following environment variables can be used to adjust distutils behaviour. + + \begin{tableii}{c|l}{environment variable}{environment variable}{description} + \lineii{CC}{The name of the C compiler (used for .c files)} + \lineii{CXX}{The name of the C++ compiler (used for .cxx files)} + \lineii{CPP}{The name of the C pre-processor} + \lineii{CFLAGS}{Additional options for the C compiler} + \lineii{CPPFLAGS}{Additional pre-processor options} + \lineii{LDFLAGS}{Additional options for the linker} + \end{tableii} From rhettinger@users.sourceforge.net Fri Jun 13 08:01:57 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 13 Jun 2003 00:01:57 -0700 Subject: [Python-checkins] python/dist/src/Lib random.py,1.47,1.48 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv12476 Modified Files: random.py Log Message: SF bug #753602: random.sample not properly documented The docs were fine but the "int=int" in the function call was both ugly and confusing. Moved it inside the body of the function definition. Index: random.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/random.py,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** random.py 24 May 2003 17:26:02 -0000 1.47 --- random.py 13 Jun 2003 07:01:51 -0000 1.48 *************** *** 208,212 **** x[i], x[j] = x[j], x[i] ! def sample(self, population, k, int=int): """Chooses k unique random elements from a population sequence. --- 208,212 ---- x[i], x[j] = x[j], x[i] ! def sample(self, population, k): """Chooses k unique random elements from a population sequence. *************** *** 241,249 **** raise ValueError, "sample larger than population" random = self.random result = [None] * k if n < 6 * k: # if n len list takes less space than a k len dict pool = list(population) for i in xrange(k): # invariant: non-selected at [0,n-i) ! j = int(random() * (n-i)) result[i] = pool[j] pool[j] = pool[n-i-1] # move non-selected item into vacancy --- 241,250 ---- raise ValueError, "sample larger than population" random = self.random + _int = int result = [None] * k if n < 6 * k: # if n len list takes less space than a k len dict pool = list(population) for i in xrange(k): # invariant: non-selected at [0,n-i) ! j = _int(random() * (n-i)) result[i] = pool[j] pool[j] = pool[n-i-1] # move non-selected item into vacancy *************** *** 251,257 **** selected = {} for i in xrange(k): ! j = int(random() * n) while j in selected: ! j = int(random() * n) result[i] = selected[j] = population[j] return result --- 252,258 ---- selected = {} for i in xrange(k): ! j = _int(random() * n) while j in selected: ! j = _int(random() * n) result[i] = selected[j] = population[j] return result From jackjansen@users.sourceforge.net Fri Jun 13 15:27:39 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 13 Jun 2003 07:27:39 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac aetools.py,1.7,1.8 gensuitemodule.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv32513 Modified Files: aetools.py gensuitemodule.py Log Message: - Allow access to poperties of the "application" OSA class directly from the toplevel package. This already worked for elements, but now for properties too. Fixes #753925. - Even better, the toplevel class (such as Finder.Finder) now inherits the element and property dictionaries of its application class and has the necessary glue to allow you to say f = Finder.Finder() f.get(f.name) Index: aetools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/aetools.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** aetools.py 9 Apr 2003 13:25:42 -0000 1.7 --- aetools.py 13 Jun 2003 14:27:35 -0000 1.8 *************** *** 155,159 **** return 1 __ensure_WMAvailable = classmethod(__ensure_WMAvailable) ! def __init__(self, signature=None, start=0, timeout=0): """Create a communication channel with a particular application. --- 155,159 ---- return 1 __ensure_WMAvailable = classmethod(__ensure_WMAvailable) ! def __init__(self, signature=None, start=0, timeout=0): """Create a communication channel with a particular application. *************** *** 285,288 **** --- 285,300 ---- set = _set + # Magic glue to allow suite-generated classes to function somewhat + # like the "application" class in OSA. + + def __getattr__(self, name): + if self._elemdict.has_key(name): + cls = self._elemdict[name] + return DelayedComponentItem(cls, None) + if self._propdict.has_key(name): + cls = self._propdict[name] + return cls() + raise AttributeError, name + # Tiny Finder class, for local use only Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/gensuitemodule.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gensuitemodule.py 16 Apr 2003 13:10:53 -0000 1.8 --- gensuitemodule.py 13 Jun 2003 14:27:35 -0000 1.9 *************** *** 524,527 **** --- 524,528 ---- # Generate a code-to-name mapper for all of the types (classes) declared in this module + application_class = None if allprecompinfo: fp.write("\n#\n# Indices of types declared in this module\n#\n") *************** *** 530,535 **** --- 531,539 ---- for k, v in codenamemapper.getall('class'): fp.write(" %s : %s,\n" % (`k`, v)) + if k == 'capp': + application_class = v fp.write("}\n") + if suitelist: fp.write("\n\nclass %s(%s_Events"%(packagename, suitelist[0][1])) *************** *** 539,542 **** --- 543,549 ---- fp.write(" _signature = %s\n\n"%`creatorsignature`) fp.write(" _moduleName = '%s'\n\n"%packagename) + if application_class: + fp.write(" _elemdict = %s._elemdict\n" % application_class) + fp.write(" _propdict = %s._propdict\n" % application_class) fp.close() *************** *** 967,978 **** self.fp.write(' want = %s\n' % `code`) self.namemappers[0].addnamecode('class', pname, code) properties.sort() for prop in properties: ! self.compileproperty(prop) elements.sort() for elem in elements: self.compileelement(elem) ! def compileproperty(self, prop): [name, code, what] = prop if code == 'c@#!': --- 974,986 ---- self.fp.write(' want = %s\n' % `code`) self.namemappers[0].addnamecode('class', pname, code) + is_application_class = (code == 'capp') properties.sort() for prop in properties: ! self.compileproperty(prop, is_application_class) elements.sort() for elem in elements: self.compileelement(elem) ! def compileproperty(self, prop, is_application_class=False): [name, code, what] = prop if code == 'c@#!': *************** *** 994,997 **** --- 1002,1007 ---- self.fp.write(" want = %s\n" % `what[0]`) self.namemappers[0].addnamecode('property', pname, code) + if is_application_class and self.fp: + self.fp.write("%s = _Prop_%s()\n" % (pname, pname)) def compileelement(self, elem): From jackjansen@users.sourceforge.net Fri Jun 13 15:31:22 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 13 Jun 2003 07:31:22 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal Standard_Suite.py,1.4,1.5 Terminal_Suite.py,1.7,1.8 __init__.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal In directory sc8-pr-cvs1:/tmp/cvs-serv2770/lib-scriptpackages/Terminal Modified Files: Standard_Suite.py Terminal_Suite.py __init__.py Log Message: Re-gegernated with the new gensuitemodule. Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/Standard_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Standard_Suite.py 12 Apr 2003 22:27:11 -0000 1.4 --- Standard_Suite.py 13 Jun 2003 14:31:19 -0000 1.5 *************** *** 338,353 **** --- 338,357 ---- which = 'c@#^' want = 'cobj' + _3c_Inheritance_3e_ = _Prop__3c_Inheritance_3e_() class _Prop_frontmost(aetools.NProperty): """frontmost - Is this the frontmost (active) application? """ which = 'pisf' want = 'bool' + frontmost = _Prop_frontmost() class _Prop_name(aetools.NProperty): """name - The name of the application. """ which = 'pnam' want = 'utxt' + name = _Prop_name() class _Prop_version(aetools.NProperty): """version - The version of the application. """ which = 'vers' want = 'utxt' + version = _Prop_version() # element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] # element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] Index: Terminal_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/Terminal_Suite.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Terminal_Suite.py 12 Apr 2003 22:27:11 -0000 1.7 --- Terminal_Suite.py 13 Jun 2003 14:31:19 -0000 1.8 *************** *** 69,76 **** --- 69,78 ---- which = 'c@#^' want = 'capp' + _3c_Inheritance_3e_ = _Prop__3c_Inheritance_3e_() class _Prop_properties(aetools.NProperty): """properties - every property of the Terminal program """ which = 'pALL' want = '****' + properties = _Prop_properties() # element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] # element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Terminal/__init__.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** __init__.py 12 Apr 2003 22:27:11 -0000 1.7 --- __init__.py 13 Jun 2003 14:31:19 -0000 1.8 *************** *** 49,52 **** --- 49,54 ---- getbaseclasses(item) getbaseclasses(document) + getbaseclasses(window) + getbaseclasses(application) getbaseclasses(character) getbaseclasses(attachment) *************** *** 55,60 **** getbaseclasses(attribute_run) getbaseclasses(text) - getbaseclasses(window) - getbaseclasses(application) # --- 57,60 ---- *************** *** 67,70 **** --- 67,72 ---- 'cobj' : item, 'docu' : document, + 'cwin' : window, + 'capp' : application, 'cha ' : character, 'atts' : attachment, *************** *** 73,78 **** 'catr' : attribute_run, 'ctxt' : text, - 'cwin' : window, - 'capp' : application, } --- 75,78 ---- *************** *** 86,87 **** --- 86,89 ---- _moduleName = 'Terminal' + _elemdict = application._elemdict + _propdict = application._propdict From jackjansen@users.sourceforge.net Fri Jun 13 15:31:21 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 13 Jun 2003 07:31:21 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites AppleScript_Suite.py,1.7,1.8 Macintosh_Connectivity_Clas.py,1.7,1.8 QuickDraw_Graphics_Suite.py,1.7,1.8 QuickDraw_Graphics_Suppleme.py,1.6,1.7 Required_Suite.py,1.4,1.5 Standard_Suite.py,1.7,1.8 Table_Suite.py,1.6,1.7 Text_Suite.py,1.6,1.7 Type_Names_Suite.py,1.7,1.8 __init__.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites In directory sc8-pr-cvs1:/tmp/cvs-serv2770/lib-scriptpackages/StdSuites Modified Files: AppleScript_Suite.py Macintosh_Connectivity_Clas.py QuickDraw_Graphics_Suite.py QuickDraw_Graphics_Suppleme.py Required_Suite.py Standard_Suite.py Table_Suite.py Text_Suite.py Type_Names_Suite.py __init__.py Log Message: Re-gegernated with the new gensuitemodule. Index: AppleScript_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AppleScript_Suite.py 12 Apr 2003 22:27:09 -0000 1.7 --- AppleScript_Suite.py 13 Jun 2003 14:31:15 -0000 1.8 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Extensies/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 763,771 **** string = strings ! class aliases(aetools.ComponentItem): ! """aliases - """ want = 'alis' ! alias = aliases class April(aetools.ComponentItem): --- 763,775 ---- string = strings ! class alias(aetools.ComponentItem): ! """alias - a file on a disk or server. The file must exist when you check the syntax of your script. """ want = 'alis' + class _Prop_POSIX_path(aetools.NProperty): + """POSIX path - the POSIX path of the file """ + which = 'psxp' + want = 'TEXT' ! aliases = alias class April(aetools.ComponentItem): *************** *** 796,847 **** --- 800,864 ---- which = 'ascr' want = 'scpt' + AppleScript = _Prop_AppleScript() class _Prop_days(aetools.NProperty): """days - the number of seconds in a day """ which = 'days' want = 'long' + days = _Prop_days() class _Prop_hours(aetools.NProperty): """hours - the number of seconds in an hour """ which = 'hour' want = 'long' + hours = _Prop_hours() class _Prop_minutes(aetools.NProperty): """minutes - the number of seconds in a minute """ which = 'min ' want = 'long' + minutes = _Prop_minutes() class _Prop_pi(aetools.NProperty): """pi - the constant pi """ which = 'pi ' want = 'doub' + pi = _Prop_pi() class _Prop_print_depth(aetools.NProperty): """print depth - the maximum depth to print """ which = 'prdp' want = 'long' + print_depth = _Prop_print_depth() class _Prop_print_length(aetools.NProperty): """print length - the maximum length to print """ which = 'prln' want = 'long' + print_length = _Prop_print_length() class _Prop_result(aetools.NProperty): """result - the last result of evaluation """ which = 'rslt' want = '****' + result = _Prop_result() class _Prop_return_(aetools.NProperty): """return - a return character """ which = 'ret ' want = 'cha ' + return_ = _Prop_return_() class _Prop_space(aetools.NProperty): """space - a space character """ which = 'spac' want = 'cha ' + space = _Prop_space() class _Prop_tab(aetools.NProperty): """tab - a tab character """ which = 'tab ' want = 'cha ' + tab = _Prop_tab() class _Prop_text_item_delimiters(aetools.NProperty): """text item delimiters - the text item delimiters of a string """ which = 'txdl' want = 'list' + text_item_delimiters = _Prop_text_item_delimiters() class _Prop_weeks(aetools.NProperty): """weeks - the number of seconds in a week """ which = 'week' want = 'long' + weeks = _Prop_weeks() applications = application *************** *** 981,989 **** want = 'fri ' ! class file_specifications(aetools.ComponentItem): ! """file specifications - """ want = 'fss ' ! file_specification = file_specifications class gallons(aetools.ComponentItem): --- 998,1006 ---- want = 'fri ' ! class file_specification(aetools.ComponentItem): ! """file specification - a file specification as used by the operating system """ want = 'fss ' ! file_specifications = file_specification class gallons(aetools.ComponentItem): *************** *** 1417,1424 **** strings._privelemdict = { } ! aliases._superclassnames = [] ! aliases._privpropdict = { } ! aliases._privelemdict = { } April._superclassnames = [] --- 1434,1442 ---- strings._privelemdict = { } ! alias._superclassnames = [] ! alias._privpropdict = { ! 'POSIX_path' : _Prop_POSIX_path, } ! alias._privelemdict = { } April._superclassnames = [] *************** *** 1583,1590 **** Friday._privelemdict = { } ! file_specifications._superclassnames = [] ! file_specifications._privpropdict = { } ! file_specifications._privelemdict = { } gallons._superclassnames = [] --- 1601,1609 ---- Friday._privelemdict = { } ! file_specification._superclassnames = [] ! file_specification._privpropdict = { ! 'POSIX_path' : _Prop_POSIX_path, } ! file_specification._privelemdict = { } gallons._superclassnames = [] *************** *** 2046,2050 **** 'STXT' : styled_text, 'TEXT' : strings, ! 'alis' : aliases, 'apr ' : April, 'aug ' : August, --- 2065,2069 ---- 'STXT' : styled_text, 'TEXT' : strings, ! 'alis' : alias, 'apr ' : April, 'aug ' : August, *************** *** 2076,2080 **** 'feet' : feet, 'fri ' : Friday, ! 'fss ' : file_specifications, 'galn' : gallons, 'gram' : grams, --- 2095,2099 ---- 'feet' : feet, 'fri ' : Friday, ! 'fss ' : file_specification, 'galn' : gallons, 'gram' : grams, *************** *** 2170,2173 **** --- 2189,2193 ---- 'prln' : _Prop_print_length, 'pscd' : _Prop_script_code, + 'psxp' : _Prop_POSIX_path, 'rest' : _Prop_rest, 'ret ' : _Prop_return_, Index: Macintosh_Connectivity_Clas.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Macintosh_Connectivity_Clas.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Macintosh_Connectivity_Clas.py 12 Apr 2003 22:27:10 -0000 1.7 --- Macintosh_Connectivity_Clas.py 13 Jun 2003 14:31:15 -0000 1.8 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Extensies/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ Index: QuickDraw_Graphics_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suite.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** QuickDraw_Graphics_Suite.py 12 Apr 2003 22:27:10 -0000 1.7 --- QuickDraw_Graphics_Suite.py 13 Jun 2003 14:31:16 -0000 1.8 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Extensies/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ Index: QuickDraw_Graphics_Suppleme.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/QuickDraw_Graphics_Suppleme.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** QuickDraw_Graphics_Suppleme.py 12 Apr 2003 22:27:10 -0000 1.6 --- QuickDraw_Graphics_Suppleme.py 13 Jun 2003 14:31:16 -0000 1.7 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Extensies/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Required_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Required_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Required_Suite.py 12 Apr 2003 22:27:10 -0000 1.4 --- Required_Suite.py 13 Jun 2003 14:31:16 -0000 1.5 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Extensies/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Standard_Suite.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Standard_Suite.py 12 Apr 2003 22:27:10 -0000 1.7 --- Standard_Suite.py 13 Jun 2003 14:31:16 -0000 1.8 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Extensies/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 215,218 **** --- 215,239 ---- return _arguments['----'] + def handleBreakpoint(self, _object, _attributes={}, **_arguments): + """handleBreakpoint: return true to stop at a breakpoint + Required argument: the call frame of the breakpoint + Keyword argument _attributes: AppleEvent attribute dictionary + Returns: true to stop, false if not + """ + _code = 'core' + _subcode = 'brak' + + if _arguments: raise TypeError, 'No optional args expected' + _arguments['----'] = _object + + + _reply, _arguments, _attributes = self.send(_code, _subcode, + _arguments, _attributes) + if _arguments.get('errn', 0): + raise aetools.Error, aetools.decodeerror(_arguments) + # XXXX Optionally decode result + if _arguments.has_key('----'): + return _arguments['----'] + _argmap_make = { 'new' : 'kocl', *************** *** 449,457 **** ! class aliases(aetools.ComponentItem): ! """aliases - """ want = 'alis' ! alias = aliases class application(aetools.ComponentItem): --- 470,482 ---- ! class alias(aetools.ComponentItem): ! """alias - a file on a disk or server. The file must exist when you check the syntax of your script. """ want = 'alis' + class _Prop_POSIX_path(aetools.NProperty): + """POSIX path - the POSIX path of the file """ + which = 'psxp' + want = 'TEXT' ! aliases = alias class application(aetools.ComponentItem): *************** *** 462,481 **** --- 487,511 ---- which = 'pcli' want = '****' + clipboard = _Prop_clipboard() class _Prop_frontmost(aetools.NProperty): """frontmost - Is this the frontmost application? """ which = 'pisf' want = 'bool' + frontmost = _Prop_frontmost() class _Prop_name(aetools.NProperty): """name - the name of the application """ which = 'pnam' want = 'itxt' + name = _Prop_name() class _Prop_selection(aetools.NProperty): """selection - the selection visible to the user. Use the \xd4select\xd5 command to set a new selection; use \xd4contents of selection\xd5 to get or change information in the document. """ which = 'sele' want = 'csel' + selection = _Prop_selection() class _Prop_version(aetools.NProperty): """version - the version of the application """ which = 'vers' want = 'vers' + version = _Prop_version() applications = application *************** *** 554,567 **** """file - a file on a disk or server """ want = 'file' - class _Prop_stationery(aetools.NProperty): - """stationery - Is the file a stationery file? """ - which = 'pspd' - want = 'bool' files = file ! aliases._superclassnames = [] ! aliases._privpropdict = { } ! aliases._privelemdict = { } application._superclassnames = [] --- 584,594 ---- """file - a file on a disk or server """ want = 'file' files = file ! alias._superclassnames = [] ! alias._privpropdict = { ! 'POSIX_path' : _Prop_POSIX_path, } ! alias._privelemdict = { } application._superclassnames = [] *************** *** 609,613 **** file._superclassnames = [] file._privpropdict = { ! 'stationery' : _Prop_stationery, } file._privelemdict = { --- 636,640 ---- file._superclassnames = [] file._privpropdict = { ! 'POSIX_path' : _Prop_POSIX_path, } file._privelemdict = { *************** *** 664,668 **** # _classdeclarations = { ! 'alis' : aliases, 'capp' : application, 'cins' : insertion_points, --- 691,695 ---- # _classdeclarations = { ! 'alis' : alias, 'capp' : application, 'cins' : insertion_points, *************** *** 686,690 **** 'pnam' : _Prop_name, 'prsz' : _Prop_resizable, ! 'pspd' : _Prop_stationery, 'ptit' : _Prop_titled, 'pvis' : _Prop_visible, --- 713,717 ---- 'pnam' : _Prop_name, 'prsz' : _Prop_resizable, ! 'psxp' : _Prop_POSIX_path, 'ptit' : _Prop_titled, 'pvis' : _Prop_visible, Index: Table_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Table_Suite.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Table_Suite.py 12 Apr 2003 22:27:10 -0000 1.6 --- Table_Suite.py 13 Jun 2003 14:31:16 -0000 1.7 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Extensies/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Text_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Text_Suite.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Text_Suite.py 12 Apr 2003 22:27:10 -0000 1.6 --- Text_Suite.py 13 Jun 2003 14:31:17 -0000 1.7 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Extensies/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 61,64 **** --- 61,68 ---- which = 'font' want = 'ctxt' + class _Prop_quoted_form(aetools.NProperty): + """quoted form - the text in quoted form """ + which = 'strq' + want = 'ctxt' class _Prop_size(aetools.NProperty): """size - the size in points of the first character """ *************** *** 132,135 **** --- 136,140 ---- 'color' : _Prop_color, 'font' : _Prop_font, + 'quoted_form' : _Prop_quoted_form, 'size' : _Prop_size, 'style' : _Prop_style, *************** *** 206,209 **** --- 211,215 ---- 'psct' : _Prop_writing_code, 'ptsz' : _Prop_size, + 'strq' : _Prop_quoted_form, 'txst' : _Prop_style, 'ustl' : _Prop_uniform_styles, Index: Type_Names_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/Type_Names_Suite.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Type_Names_Suite.py 12 Apr 2003 22:27:10 -0000 1.7 --- Type_Names_Suite.py 13 Jun 2003 14:31:17 -0000 1.8 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Systeemmap/Extensies/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/System Folder/Extensions/AppleScript AETE/AEUT resource version 1/0, language 0, script 0 """ Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/__init__.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** __init__.py 1 May 2003 22:06:13 -0000 1.8 --- __init__.py 13 Jun 2003 14:31:17 -0000 1.9 *************** *** 1,4 **** """ ! Package generated from /Volumes/Moes/Systeemmap/Extensies/AppleScript Resource aeut resid 0 Standard Event Suites for English """ --- 1,4 ---- """ ! Package generated from /Volumes/Sap/System Folder/Extensions/AppleScript Resource aeut resid 0 Standard Event Suites for English """ *************** *** 69,90 **** # Set property and element dictionaries now that all classes have been defined # ! getbaseclasses(July) getbaseclasses(May) getbaseclasses(string) - getbaseclasses(cubic_metres) - getbaseclasses(styled_text) - getbaseclasses(number_2c__date_or_text) - getbaseclasses(feet) - getbaseclasses(February) - getbaseclasses(number) getbaseclasses(miles) - getbaseclasses(keystroke) - getbaseclasses(writing_code) - getbaseclasses(degrees_Fahrenheit) - getbaseclasses(list_2c__record_or_text) - getbaseclasses(date) - getbaseclasses(litres) getbaseclasses(number_or_date) ! getbaseclasses(centimetres) getbaseclasses(event) getbaseclasses(Pascal_string) --- 69,162 ---- # Set property and element dictionaries now that all classes have been defined # ! getbaseclasses(graphic_group) ! getbaseclasses(oval) ! getbaseclasses(graphic_text) ! getbaseclasses(graphic_shape) ! getbaseclasses(drawing_area) ! getbaseclasses(graphic_line) ! getbaseclasses(polygon) ! getbaseclasses(pixel) ! getbaseclasses(rounded_rectangle) ! getbaseclasses(graphic_object) ! getbaseclasses(arc) ! getbaseclasses(pixel_map) ! getbaseclasses(rectangle) ! getbaseclasses(selection_2d_object) ! getbaseclasses(application) ! getbaseclasses(document) ! getbaseclasses(window) ! getbaseclasses(file) ! getbaseclasses(alias) ! getbaseclasses(insertion_point) ! getbaseclasses(character) ! getbaseclasses(paragraph) ! getbaseclasses(word) ! getbaseclasses(text_flow) ! getbaseclasses(text_style_info) ! getbaseclasses(line) ! getbaseclasses(text) ! getbaseclasses(AppleTalk_address) ! getbaseclasses(address_specification) ! getbaseclasses(Token_Ring_address) ! getbaseclasses(FireWire_address) ! getbaseclasses(bus_slot) ! getbaseclasses(SCSI_address) ! getbaseclasses(ADB_address) ! getbaseclasses(USB_address) ! getbaseclasses(device_specification) ! getbaseclasses(LocalTalk_address) ! getbaseclasses(IP_address) ! getbaseclasses(Ethernet_address) ! getbaseclasses(graphic_group) ! getbaseclasses(drawing_area) ! getbaseclasses(cell) ! getbaseclasses(column) ! getbaseclasses(table) ! getbaseclasses(row) ! getbaseclasses(small_integer) ! getbaseclasses(system_dictionary) ! getbaseclasses(color_table) ! getbaseclasses(fixed_point) ! getbaseclasses(plain_text) ! getbaseclasses(type_element_info) ! getbaseclasses(machine_location) ! getbaseclasses(PostScript_picture) ! getbaseclasses(type_suite_info) ! getbaseclasses(menu_item) ! getbaseclasses(pixel_map_record) ! getbaseclasses(small_real) ! getbaseclasses(null) ! getbaseclasses(rotation) ! getbaseclasses(fixed) ! getbaseclasses(long_point) ! getbaseclasses(target_id) ! getbaseclasses(type_property_info) ! getbaseclasses(type_parameter_info) ! getbaseclasses(long_fixed_point) ! getbaseclasses(bounding_rectangle) ! getbaseclasses(TIFF_picture) ! getbaseclasses(long_fixed) ! getbaseclasses(location_reference) ! getbaseclasses(version) ! getbaseclasses(RGB16_color) ! getbaseclasses(double_integer) ! getbaseclasses(type_event_info) ! getbaseclasses(point) ! getbaseclasses(application_dictionary) ! getbaseclasses(unsigned_integer) ! getbaseclasses(menu) ! getbaseclasses(fixed_rectangle) ! getbaseclasses(long_fixed_rectangle) ! getbaseclasses(type_class_info) ! getbaseclasses(RGB96_color) ! getbaseclasses(dash_style) ! getbaseclasses(scrap_styles) ! getbaseclasses(extended_real) ! getbaseclasses(long_rectangle) getbaseclasses(May) getbaseclasses(string) getbaseclasses(miles) getbaseclasses(number_or_date) ! getbaseclasses(October) getbaseclasses(event) getbaseclasses(Pascal_string) *************** *** 92,106 **** getbaseclasses(picture) getbaseclasses(list_or_string) ! getbaseclasses(integer) ! getbaseclasses(alias_or_string) ! getbaseclasses(writing_code_info) ! getbaseclasses(text_item) ! getbaseclasses(machine) ! getbaseclasses(type_class) ! getbaseclasses(preposition) getbaseclasses(Tuesday) - getbaseclasses(upper_case) getbaseclasses(version) - getbaseclasses(Wednesday) getbaseclasses(December) getbaseclasses(square_kilometres) --- 164,170 ---- getbaseclasses(picture) getbaseclasses(list_or_string) ! getbaseclasses(number) getbaseclasses(Tuesday) getbaseclasses(version) getbaseclasses(December) getbaseclasses(square_kilometres) *************** *** 108,262 **** getbaseclasses(vector) getbaseclasses(weekday) - getbaseclasses(RGB_color) getbaseclasses(Sunday) getbaseclasses(international_text) getbaseclasses(seconds) ! getbaseclasses(March) getbaseclasses(kilometres) ! getbaseclasses(square_feet) getbaseclasses(list) getbaseclasses(real) getbaseclasses(November) getbaseclasses(quarts) - getbaseclasses(degrees_Celsius) - getbaseclasses(missing_value) getbaseclasses(alias) getbaseclasses(January) - getbaseclasses(metres) getbaseclasses(month) - getbaseclasses(number_or_string) getbaseclasses(June) getbaseclasses(August) - getbaseclasses(linked_list) getbaseclasses(styled_Clipboard_text) - getbaseclasses(encoded_string) getbaseclasses(gallons) getbaseclasses(cubic_inches) getbaseclasses(Friday) - getbaseclasses(styled_Unicode_text) - getbaseclasses(list_or_record) - getbaseclasses(degrees_Kelvin) - getbaseclasses(Monday) getbaseclasses(sound) getbaseclasses(class_) getbaseclasses(kilograms) getbaseclasses(script) ! getbaseclasses(anything) ! getbaseclasses(property) ! getbaseclasses(record) getbaseclasses(boolean) - getbaseclasses(October) getbaseclasses(square_metres) getbaseclasses(inches) - getbaseclasses(reference_form) - getbaseclasses(item) - getbaseclasses(grams) getbaseclasses(character) getbaseclasses(April) ! getbaseclasses(empty_ae_name_) getbaseclasses(app) - getbaseclasses(constant) getbaseclasses(handler) - getbaseclasses(square_miles) - getbaseclasses(data) getbaseclasses(C_string) - getbaseclasses(Unicode_text) getbaseclasses(Thursday) getbaseclasses(square_yards) - getbaseclasses(yards) - getbaseclasses(cubic_yards) - getbaseclasses(ounces) - getbaseclasses(pounds) getbaseclasses(cubic_feet) - getbaseclasses(cubic_centimetres) getbaseclasses(Saturday) - getbaseclasses(September) getbaseclasses(file_specification) - getbaseclasses(text) - getbaseclasses(window) - getbaseclasses(file) - getbaseclasses(selection_2d_object) - getbaseclasses(alias) - getbaseclasses(application) - getbaseclasses(insertion_point) - getbaseclasses(document) - getbaseclasses(small_integer) - getbaseclasses(RGB16_color) - getbaseclasses(version) - getbaseclasses(system_dictionary) - getbaseclasses(color_table) - getbaseclasses(fixed_point) - getbaseclasses(plain_text) - getbaseclasses(type_element_info) - getbaseclasses(location_reference) - getbaseclasses(machine_location) - getbaseclasses(PostScript_picture) - getbaseclasses(point) - getbaseclasses(menu_item) - getbaseclasses(pixel_map_record) - getbaseclasses(application_dictionary) - getbaseclasses(unsigned_integer) - getbaseclasses(menu) - getbaseclasses(fixed_rectangle) - getbaseclasses(long_fixed_rectangle) - getbaseclasses(type_event_info) - getbaseclasses(small_real) - getbaseclasses(type_suite_info) - getbaseclasses(rotation) - getbaseclasses(type_parameter_info) - getbaseclasses(fixed) - getbaseclasses(scrap_styles) - getbaseclasses(long_point) - getbaseclasses(type_class_info) - getbaseclasses(TIFF_picture) - getbaseclasses(RGB96_color) - getbaseclasses(dash_style) - getbaseclasses(extended_real) - getbaseclasses(type_property_info) - getbaseclasses(long_fixed_point) - getbaseclasses(long_rectangle) - getbaseclasses(bounding_rectangle) - getbaseclasses(double_integer) - getbaseclasses(long_fixed) - getbaseclasses(null) - getbaseclasses(target_id) - getbaseclasses(graphic_group) - getbaseclasses(oval) - getbaseclasses(graphic_text) - getbaseclasses(graphic_shape) - getbaseclasses(graphic_line) - getbaseclasses(graphic_object) - getbaseclasses(drawing_area) - getbaseclasses(polygon) - getbaseclasses(pixel) - getbaseclasses(rounded_rectangle) - getbaseclasses(arc) - getbaseclasses(pixel_map) - getbaseclasses(rectangle) - getbaseclasses(paragraph) - getbaseclasses(character) - getbaseclasses(text_flow) - getbaseclasses(text_style_info) - getbaseclasses(line) - getbaseclasses(word) - getbaseclasses(text) - getbaseclasses(graphic_group) - getbaseclasses(drawing_area) - getbaseclasses(cell) - getbaseclasses(column) - getbaseclasses(table) - getbaseclasses(row) - getbaseclasses(AppleTalk_address) - getbaseclasses(address_specification) - getbaseclasses(Token_Ring_address) - getbaseclasses(FireWire_address) - getbaseclasses(bus_slot) - getbaseclasses(SCSI_address) - getbaseclasses(ADB_address) - getbaseclasses(USB_address) - getbaseclasses(device_specification) - getbaseclasses(LocalTalk_address) - getbaseclasses(IP_address) - getbaseclasses(Ethernet_address) # --- 172,262 ---- getbaseclasses(vector) getbaseclasses(weekday) getbaseclasses(Sunday) getbaseclasses(international_text) getbaseclasses(seconds) ! getbaseclasses(RGB_color) getbaseclasses(kilometres) ! getbaseclasses(styled_Unicode_text) ! getbaseclasses(missing_value) ! getbaseclasses(metres) ! getbaseclasses(number_or_string) getbaseclasses(list) + getbaseclasses(linked_list) getbaseclasses(real) + getbaseclasses(encoded_string) + getbaseclasses(list_or_record) + getbaseclasses(Monday) + getbaseclasses(September) + getbaseclasses(anything) + getbaseclasses(property) + getbaseclasses(reference_form) + getbaseclasses(item) + getbaseclasses(grams) + getbaseclasses(record) + getbaseclasses(empty_ae_name_) + getbaseclasses(constant) + getbaseclasses(square_miles) + getbaseclasses(data) + getbaseclasses(Unicode_text) + getbaseclasses(yards) + getbaseclasses(cubic_yards) + getbaseclasses(pounds) + getbaseclasses(cubic_centimetres) + getbaseclasses(text) + getbaseclasses(July) + getbaseclasses(cubic_metres) + getbaseclasses(styled_text) + getbaseclasses(number_2c__date_or_text) + getbaseclasses(feet) + getbaseclasses(February) + getbaseclasses(degrees_Celsius) + getbaseclasses(keystroke) + getbaseclasses(integer) + getbaseclasses(degrees_Fahrenheit) + getbaseclasses(list_2c__record_or_text) + getbaseclasses(date) + getbaseclasses(degrees_Kelvin) + getbaseclasses(centimetres) + getbaseclasses(writing_code) + getbaseclasses(alias_or_string) + getbaseclasses(writing_code_info) + getbaseclasses(text_item) + getbaseclasses(machine) + getbaseclasses(type_class) + getbaseclasses(preposition) + getbaseclasses(Wednesday) + getbaseclasses(upper_case) + getbaseclasses(March) + getbaseclasses(square_feet) getbaseclasses(November) getbaseclasses(quarts) getbaseclasses(alias) getbaseclasses(January) getbaseclasses(month) getbaseclasses(June) getbaseclasses(August) getbaseclasses(styled_Clipboard_text) getbaseclasses(gallons) getbaseclasses(cubic_inches) getbaseclasses(Friday) getbaseclasses(sound) getbaseclasses(class_) getbaseclasses(kilograms) getbaseclasses(script) ! getbaseclasses(litres) getbaseclasses(boolean) getbaseclasses(square_metres) getbaseclasses(inches) getbaseclasses(character) getbaseclasses(April) ! getbaseclasses(ounces) getbaseclasses(app) getbaseclasses(handler) getbaseclasses(C_string) getbaseclasses(Thursday) getbaseclasses(square_yards) getbaseclasses(cubic_feet) getbaseclasses(Saturday) getbaseclasses(file_specification) # *************** *** 264,285 **** # _classdeclarations = { ! 'jul ' : July, 'may ' : May, 'TEXT' : string, - 'cmet' : cubic_metres, - 'STXT' : styled_text, - 'nds ' : number_2c__date_or_text, - 'feet' : feet, - 'feb ' : February, - 'nmbr' : number, 'mile' : miles, - 'kprs' : keystroke, - 'psct' : writing_code, - 'degf' : degrees_Fahrenheit, - 'lrs ' : list_2c__record_or_text, - 'ldt ' : date, - 'litr' : litres, 'nd ' : number_or_date, ! 'cmtr' : centimetres, 'evnt' : event, 'pstr' : Pascal_string, --- 264,357 ---- # _classdeclarations = { ! 'cpic' : graphic_group, ! 'covl' : oval, ! 'cgtx' : graphic_text, ! 'cgsh' : graphic_shape, ! 'cdrw' : drawing_area, ! 'glin' : graphic_line, ! 'cpgn' : polygon, ! 'cpxl' : pixel, ! 'crrc' : rounded_rectangle, ! 'cgob' : graphic_object, ! 'carc' : arc, ! 'cpix' : pixel_map, ! 'crec' : rectangle, ! 'csel' : selection_2d_object, ! 'capp' : application, ! 'docu' : document, ! 'cwin' : window, ! 'file' : file, ! 'alis' : alias, ! 'cins' : insertion_point, ! 'cha ' : character, ! 'cpar' : paragraph, ! 'cwor' : word, ! 'cflo' : text_flow, ! 'tsty' : text_style_info, ! 'clin' : line, ! 'ctxt' : text, ! 'cat ' : AppleTalk_address, ! 'cadr' : address_specification, ! 'ctok' : Token_Ring_address, ! 'cfw ' : FireWire_address, ! 'cbus' : bus_slot, ! 'cscs' : SCSI_address, ! 'cadb' : ADB_address, ! 'cusb' : USB_address, ! 'cdev' : device_specification, ! 'clt ' : LocalTalk_address, ! 'cip ' : IP_address, ! 'cen ' : Ethernet_address, ! 'cpic' : graphic_group, ! 'cdrw' : drawing_area, ! 'ccel' : cell, ! 'ccol' : column, ! 'ctbl' : table, ! 'crow' : row, ! 'shor' : small_integer, ! 'aeut' : system_dictionary, ! 'clrt' : color_table, ! 'fpnt' : fixed_point, ! 'TEXT' : plain_text, ! 'elin' : type_element_info, ! 'mLoc' : machine_location, ! 'EPS ' : PostScript_picture, ! 'suin' : type_suite_info, ! 'cmen' : menu_item, ! 'tpmm' : pixel_map_record, ! 'sing' : small_real, ! 'null' : null, ! 'trot' : rotation, ! 'fixd' : fixed, ! 'lpnt' : long_point, ! 'targ' : target_id, ! 'pinf' : type_property_info, ! 'pmin' : type_parameter_info, ! 'lfpt' : long_fixed_point, ! 'qdrt' : bounding_rectangle, ! 'TIFF' : TIFF_picture, ! 'lfxd' : long_fixed, ! 'insl' : location_reference, ! 'vers' : version, ! 'tr16' : RGB16_color, ! 'comp' : double_integer, ! 'evin' : type_event_info, ! 'QDpt' : point, ! 'aete' : application_dictionary, ! 'magn' : unsigned_integer, ! 'cmnu' : menu, ! 'frct' : fixed_rectangle, ! 'lfrc' : long_fixed_rectangle, ! 'gcli' : type_class_info, ! 'tr96' : RGB96_color, ! 'tdas' : dash_style, ! 'styl' : scrap_styles, ! 'exte' : extended_real, ! 'lrct' : long_rectangle, 'may ' : May, 'TEXT' : string, 'mile' : miles, 'nd ' : number_or_date, ! 'oct ' : October, 'evnt' : event, 'pstr' : Pascal_string, *************** *** 287,301 **** 'PICT' : picture, 'ls ' : list_or_string, ! 'long' : integer, ! 'sf ' : alias_or_string, ! 'citl' : writing_code_info, ! 'citm' : text_item, ! 'mach' : machine, ! 'type' : type_class, ! 'prep' : preposition, 'tue ' : Tuesday, - 'case' : upper_case, 'vers' : version, - 'wed ' : Wednesday, 'dec ' : December, 'sqkm' : square_kilometres, --- 359,365 ---- 'PICT' : picture, 'ls ' : list_or_string, ! 'nmbr' : number, 'tue ' : Tuesday, 'vers' : version, 'dec ' : December, 'sqkm' : square_kilometres, *************** *** 303,457 **** 'vect' : vector, 'wkdy' : weekday, - 'cRGB' : RGB_color, 'sun ' : Sunday, 'itxt' : international_text, 'scnd' : seconds, ! 'mar ' : March, 'kmtr' : kilometres, ! 'sqft' : square_feet, 'list' : list, 'doub' : real, 'nov ' : November, 'qrts' : quarts, - 'degc' : degrees_Celsius, - 'msng' : missing_value, 'alis' : alias, 'jan ' : January, - 'metr' : metres, 'mnth' : month, - 'ns ' : number_or_string, 'jun ' : June, 'aug ' : August, - 'llst' : linked_list, 'styl' : styled_Clipboard_text, - 'encs' : encoded_string, 'galn' : gallons, 'cuin' : cubic_inches, 'fri ' : Friday, - 'sutx' : styled_Unicode_text, - 'lr ' : list_or_record, - 'degk' : degrees_Kelvin, - 'mon ' : Monday, 'snd ' : sound, 'pcls' : class_, 'kgrm' : kilograms, 'scpt' : script, ! '****' : anything, ! 'prop' : property, ! 'reco' : record, 'bool' : boolean, - 'oct ' : October, 'sqrm' : square_metres, 'inch' : inches, - 'kfrm' : reference_form, - 'cobj' : item, - 'gram' : grams, 'cha ' : character, 'apr ' : April, ! 'undf' : empty_ae_name_, 'capp' : app, - 'enum' : constant, 'hand' : handler, - 'sqmi' : square_miles, - 'rdat' : data, 'cstr' : C_string, - 'utxt' : Unicode_text, 'thu ' : Thursday, 'sqyd' : square_yards, - 'yard' : yards, - 'cyrd' : cubic_yards, - 'ozs ' : ounces, - 'lbs ' : pounds, 'cfet' : cubic_feet, - 'ccmt' : cubic_centimetres, 'sat ' : Saturday, - 'sep ' : September, 'fss ' : file_specification, - 'ctxt' : text, - 'cwin' : window, - 'file' : file, - 'csel' : selection_2d_object, - 'alis' : alias, - 'capp' : application, - 'cins' : insertion_point, - 'docu' : document, - 'shor' : small_integer, - 'tr16' : RGB16_color, - 'vers' : version, - 'aeut' : system_dictionary, - 'clrt' : color_table, - 'fpnt' : fixed_point, - 'TEXT' : plain_text, - 'elin' : type_element_info, - 'insl' : location_reference, - 'mLoc' : machine_location, - 'EPS ' : PostScript_picture, - 'QDpt' : point, - 'cmen' : menu_item, - 'tpmm' : pixel_map_record, - 'aete' : application_dictionary, - 'magn' : unsigned_integer, - 'cmnu' : menu, - 'frct' : fixed_rectangle, - 'lfrc' : long_fixed_rectangle, - 'evin' : type_event_info, - 'sing' : small_real, - 'suin' : type_suite_info, - 'trot' : rotation, - 'pmin' : type_parameter_info, - 'fixd' : fixed, - 'styl' : scrap_styles, - 'lpnt' : long_point, - 'gcli' : type_class_info, - 'TIFF' : TIFF_picture, - 'tr96' : RGB96_color, - 'tdas' : dash_style, - 'exte' : extended_real, - 'pinf' : type_property_info, - 'lfpt' : long_fixed_point, - 'lrct' : long_rectangle, - 'qdrt' : bounding_rectangle, - 'comp' : double_integer, - 'lfxd' : long_fixed, - 'null' : null, - 'targ' : target_id, - 'cpic' : graphic_group, - 'covl' : oval, - 'cgtx' : graphic_text, - 'cgsh' : graphic_shape, - 'glin' : graphic_line, - 'cgob' : graphic_object, - 'cdrw' : drawing_area, - 'cpgn' : polygon, - 'cpxl' : pixel, - 'crrc' : rounded_rectangle, - 'carc' : arc, - 'cpix' : pixel_map, - 'crec' : rectangle, - 'cpar' : paragraph, - 'cha ' : character, - 'cflo' : text_flow, - 'tsty' : text_style_info, - 'clin' : line, - 'cwor' : word, - 'ctxt' : text, - 'cpic' : graphic_group, - 'cdrw' : drawing_area, - 'ccel' : cell, - 'ccol' : column, - 'ctbl' : table, - 'crow' : row, - 'cat ' : AppleTalk_address, - 'cadr' : address_specification, - 'ctok' : Token_Ring_address, - 'cfw ' : FireWire_address, - 'cbus' : bus_slot, - 'cscs' : SCSI_address, - 'cadb' : ADB_address, - 'cusb' : USB_address, - 'cdev' : device_specification, - 'clt ' : LocalTalk_address, - 'cip ' : IP_address, - 'cen ' : Ethernet_address, } --- 367,457 ---- 'vect' : vector, 'wkdy' : weekday, 'sun ' : Sunday, 'itxt' : international_text, 'scnd' : seconds, ! 'cRGB' : RGB_color, 'kmtr' : kilometres, ! 'sutx' : styled_Unicode_text, ! 'msng' : missing_value, ! 'metr' : metres, ! 'ns ' : number_or_string, 'list' : list, + 'llst' : linked_list, 'doub' : real, + 'encs' : encoded_string, + 'lr ' : list_or_record, + 'mon ' : Monday, + 'sep ' : September, + '****' : anything, + 'prop' : property, + 'kfrm' : reference_form, + 'cobj' : item, + 'gram' : grams, + 'reco' : record, + 'undf' : empty_ae_name_, + 'enum' : constant, + 'sqmi' : square_miles, + 'rdat' : data, + 'utxt' : Unicode_text, + 'yard' : yards, + 'cyrd' : cubic_yards, + 'lbs ' : pounds, + 'ccmt' : cubic_centimetres, + 'ctxt' : text, + 'jul ' : July, + 'cmet' : cubic_metres, + 'STXT' : styled_text, + 'nds ' : number_2c__date_or_text, + 'feet' : feet, + 'feb ' : February, + 'degc' : degrees_Celsius, + 'kprs' : keystroke, + 'long' : integer, + 'degf' : degrees_Fahrenheit, + 'lrs ' : list_2c__record_or_text, + 'ldt ' : date, + 'degk' : degrees_Kelvin, + 'cmtr' : centimetres, + 'psct' : writing_code, + 'sf ' : alias_or_string, + 'citl' : writing_code_info, + 'citm' : text_item, + 'mach' : machine, + 'type' : type_class, + 'prep' : preposition, + 'wed ' : Wednesday, + 'case' : upper_case, + 'mar ' : March, + 'sqft' : square_feet, 'nov ' : November, 'qrts' : quarts, 'alis' : alias, 'jan ' : January, 'mnth' : month, 'jun ' : June, 'aug ' : August, 'styl' : styled_Clipboard_text, 'galn' : gallons, 'cuin' : cubic_inches, 'fri ' : Friday, 'snd ' : sound, 'pcls' : class_, 'kgrm' : kilograms, 'scpt' : script, ! 'litr' : litres, 'bool' : boolean, 'sqrm' : square_metres, 'inch' : inches, 'cha ' : character, 'apr ' : April, ! 'ozs ' : ounces, 'capp' : app, 'hand' : handler, 'cstr' : C_string, 'thu ' : Thursday, 'sqyd' : square_yards, 'cfet' : cubic_feet, 'sat ' : Saturday, 'fss ' : file_specification, } From jackjansen@users.sourceforge.net Fri Jun 13 15:31:23 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 13 Jun 2003 07:31:23 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents Disk_Folder_File_Suite.py,1.1,1.2 Folder_Actions_Suite.py,1.3,1.4 Power_Suite.py,1.3,1.4 Processes_Suite.py,1.3,1.4 Standard_Suite.py,1.3,1.4 System_Events_Suite.py,1.4,1.5 __init__.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents In directory sc8-pr-cvs1:/tmp/cvs-serv2770/lib-scriptpackages/SystemEvents Modified Files: Disk_Folder_File_Suite.py Folder_Actions_Suite.py Power_Suite.py Processes_Suite.py Standard_Suite.py System_Events_Suite.py __init__.py Log Message: Re-gegernated with the new gensuitemodule. Index: Disk_Folder_File_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Disk_Folder_File_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Disk_Folder_File_Suite.py 1 May 2003 22:06:14 -0000 1.1 --- Disk_Folder_File_Suite.py 13 Jun 2003 14:31:17 -0000 1.2 *************** *** 40,68 **** ! class alias(aetools.ComponentItem): ! """alias - An alias in the file system """ ! want = 'alis' class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' ! want = 'cobj' class _Prop_properties(aetools.NProperty): ! """properties - every property of the alias """ which = 'pALL' want = '****' ! class _Prop_version(aetools.NProperty): ! """version - the version of the application bundle referenced by the alias (visible at the bottom of the "Get Info" window) """ ! which = 'vers' ! want = 'utxt' ! # element 'alis' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] ! aliases = alias class disk(aetools.ComponentItem): """disk - A disk in the file system """ want = 'cdis' class _Prop_capacity(aetools.NProperty): """capacity - the total number of bytes (free or used) on the disk """ --- 40,82 ---- ! class application(aetools.ComponentItem): ! """application - The Disk-Folder-File Suite host program """ ! want = 'capp' class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' ! want = 'capp' ! _3c_Inheritance_3e_ = _Prop__3c_Inheritance_3e_() ! class _Prop_folder_actions_enabled(aetools.NProperty): ! """folder actions enabled - Are Folder Actions currently being processed? """ ! which = 'faen' ! want = 'bool' ! folder_actions_enabled = _Prop_folder_actions_enabled() class _Prop_properties(aetools.NProperty): ! """properties - every property of the Disk-Folder-File Suite host program """ which = 'pALL' want = '****' ! properties = _Prop_properties() ! # element 'cdis' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] + # element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'foac' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'logi' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'pcap' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'pcda' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'prcs' as ['name', 'indx', 'rele', 'rang', 'test'] ! applications = application class disk(aetools.ComponentItem): """disk - A disk in the file system """ want = 'cdis' + class _Prop_POSIX_path(aetools.NProperty): + """POSIX path - the POSIX file system path of the disk """ + which = 'posx' + want = 'utxt' class _Prop_capacity(aetools.NProperty): """capacity - the total number of bytes (free or used) on the disk """ *************** *** 86,97 **** want = 'bool' class _Prop_local_volume(aetools.NProperty): ! """local volume - Is the media a local volume (as opposed to a file server)? """ which = 'isrv' want = 'bool' class _Prop_startup(aetools.NProperty): """startup - Is this disk the boot disk? """ which = 'istd' want = 'bool' ! # element 'alis' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] --- 100,122 ---- want = 'bool' class _Prop_local_volume(aetools.NProperty): ! """local volume - Is the media a local volume (as opposed to a file server? """ which = 'isrv' want = 'bool' + class _Prop_name(aetools.NProperty): + """name - the name of the disk """ + which = 'pnam' + want = 'utxt' + class _Prop_path(aetools.NProperty): + """path - the file system path of the disk """ + which = 'ppth' + want = 'utxt' class _Prop_startup(aetools.NProperty): """startup - Is this disk the boot disk? """ which = 'istd' want = 'bool' ! class _Prop_volume(aetools.NProperty): ! """volume - the volume on which the folder resides """ ! which = 'volu' ! want = 'utxt' # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] *************** *** 103,110 **** """folder - A folder in the file system """ want = 'cfol' - # element 'alis' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] folders = folder --- 128,137 ---- """folder - A folder in the file system """ want = 'cfol' # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] folders = folder *************** *** 113,120 **** """item - An item in the file system """ want = 'cobj' - class _Prop_POSIX_path(aetools.NProperty): - """POSIX path - the POSIX file system path of the item """ - which = 'posx' - want = 'utxt' class _Prop_busy_status(aetools.NProperty): """busy status - Is the item busy? """ --- 140,143 ---- *************** *** 125,140 **** which = 'ascd' want = '****' - class _Prop_displayed_name(aetools.NProperty): - """displayed name - the name of the item as displayed in the User Interface """ - which = 'dnam' - want = 'utxt' class _Prop_modification_date(aetools.NProperty): """modification date - the date on which the item was last modified """ which = 'asmo' want = '****' - class _Prop_name(aetools.NProperty): - """name - the name of the item """ - which = 'pnam' - want = 'utxt' class _Prop_name_extension(aetools.NProperty): """name extension - the extension portion of the name """ --- 148,155 ---- *************** *** 145,152 **** which = 'pkgf' want = 'bool' - class _Prop_path(aetools.NProperty): - """path - the file system path of the item """ - which = 'ppth' - want = 'utxt' class _Prop_url(aetools.NProperty): """url - the url of the item """ --- 160,163 ---- *************** *** 155,164 **** class _Prop_visible(aetools.NProperty): """visible - Is the item visible? """ ! which = 'pvis' want = 'bool' ! class _Prop_volume(aetools.NProperty): ! """volume - the volume on which the item resides """ ! which = 'volu' ! want = 'utxt' items = item --- 166,174 ---- class _Prop_visible(aetools.NProperty): """visible - Is the item visible? """ ! which = 'visi' want = 'bool' ! # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] ! # element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] ! # element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] items = item *************** *** 168,176 **** want = 'file' class _Prop_creator_type(aetools.NProperty): ! """creator type - the OSType identifying the application that created the file """ which = 'fcrt' want = 'utxt' class _Prop_file_type(aetools.NProperty): ! """file type - the OSType identifying the type of data contained in the file """ which = 'asty' want = 'utxt' --- 178,186 ---- want = 'file' class _Prop_creator_type(aetools.NProperty): ! """creator type - the OSType identifying the application that created the item """ which = 'fcrt' want = 'utxt' class _Prop_file_type(aetools.NProperty): ! """file type - the OSType identifying the type of data contained in the item """ which = 'asty' want = 'utxt' *************** *** 178,184 **** """physical size - the actual space used by the file on disk """ which = 'phys' ! want = '****' class _Prop_product_version(aetools.NProperty): ! """product version - the version of the product (visible at the top of the "Get Info" window) """ which = 'ver2' want = 'utxt' --- 188,194 ---- """physical size - the actual space used by the file on disk """ which = 'phys' ! want = 'magn' class _Prop_product_version(aetools.NProperty): ! """product version - the version of the product (visible at the top of the ?et Info?window) """ which = 'ver2' want = 'utxt' *************** *** 186,210 **** """size - the logical size of the file """ which = 'ptsz' ! want = '****' class _Prop_stationery(aetools.NProperty): """stationery - Is the file a stationery pad? """ which = 'pspd' want = 'bool' files = file ! alias._superclassnames = ['item'] ! alias._privpropdict = { '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, 'properties' : _Prop_properties, - 'version' : _Prop_version, } ! alias._privelemdict = { ! 'alias' : alias, 'file' : file, 'folder' : folder, 'item' : item, } disk._superclassnames = ['item'] disk._privpropdict = { '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, 'capacity' : _Prop_capacity, --- 196,239 ---- """size - the logical size of the file """ which = 'ptsz' ! want = 'magn' class _Prop_stationery(aetools.NProperty): """stationery - Is the file a stationery pad? """ which = 'pspd' want = 'bool' + class _Prop_version(aetools.NProperty): + """version - the version of the file (visible at the bottom of the ?et Info?window) """ + which = 'vers' + want = 'utxt' + # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] files = file ! application._superclassnames = [] ! import Standard_Suite ! import Folder_Actions_Suite ! import Login_Items_Suite ! import Processes_Suite ! application._privpropdict = { '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, + 'folder_actions_enabled' : _Prop_folder_actions_enabled, 'properties' : _Prop_properties, } ! application._privelemdict = { ! 'application_process' : Processes_Suite.application_process, ! 'desk_accessory_process' : Processes_Suite.desk_accessory_process, ! 'disk' : disk, ! 'document' : Standard_Suite.document, 'file' : file, 'folder' : folder, + 'folder_action' : Folder_Actions_Suite.folder_action, 'item' : item, + 'login_item' : Login_Items_Suite.login_item, + 'process' : Processes_Suite.process, + 'window' : Standard_Suite.window, } disk._superclassnames = ['item'] disk._privpropdict = { + 'POSIX_path' : _Prop_POSIX_path, '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, 'capacity' : _Prop_capacity, *************** *** 214,222 **** 'ignore_privileges' : _Prop_ignore_privileges, 'local_volume' : _Prop_local_volume, 'properties' : _Prop_properties, 'startup' : _Prop_startup, } disk._privelemdict = { - 'alias' : alias, 'file' : file, 'folder' : folder, --- 243,253 ---- 'ignore_privileges' : _Prop_ignore_privileges, 'local_volume' : _Prop_local_volume, + 'name' : _Prop_name, + 'path' : _Prop_path, 'properties' : _Prop_properties, 'startup' : _Prop_startup, + 'volume' : _Prop_volume, } disk._privelemdict = { 'file' : file, 'folder' : folder, *************** *** 225,236 **** folder._superclassnames = ['item'] folder._privpropdict = { '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, 'properties' : _Prop_properties, } folder._privelemdict = { - 'alias' : alias, 'file' : file, 'folder' : folder, 'item' : item, } item._superclassnames = [] --- 256,273 ---- folder._superclassnames = ['item'] folder._privpropdict = { + 'POSIX_path' : _Prop_POSIX_path, '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, + 'name' : _Prop_name, + 'path' : _Prop_path, 'properties' : _Prop_properties, + 'volume' : _Prop_volume, } folder._privelemdict = { 'file' : file, + 'file' : file, + 'folder' : folder, 'folder' : folder, 'item' : item, + 'item' : item, } item._superclassnames = [] *************** *** 240,244 **** 'busy_status' : _Prop_busy_status, 'creation_date' : _Prop_creation_date, - 'displayed_name' : _Prop_displayed_name, 'modification_date' : _Prop_modification_date, 'name' : _Prop_name, --- 277,280 ---- *************** *** 252,261 **** --- 288,303 ---- } item._privelemdict = { + 'file' : file, + 'folder' : folder, + 'item' : item, } file._superclassnames = ['item'] file._privpropdict = { + 'POSIX_path' : _Prop_POSIX_path, '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, 'creator_type' : _Prop_creator_type, 'file_type' : _Prop_file_type, + 'name' : _Prop_name, + 'path' : _Prop_path, 'physical_size' : _Prop_physical_size, 'product_version' : _Prop_product_version, *************** *** 264,269 **** --- 306,315 ---- 'stationery' : _Prop_stationery, 'version' : _Prop_version, + 'volume' : _Prop_volume, } file._privelemdict = { + 'file' : file, + 'folder' : folder, + 'item' : item, } _Enum_edfm = { *************** *** 290,294 **** # _classdeclarations = { ! 'alis' : alias, 'cdis' : disk, 'cfol' : folder, --- 336,340 ---- # _classdeclarations = { ! 'capp' : application, 'cdis' : disk, 'cfol' : folder, *************** *** 305,310 **** 'capa' : _Prop_capacity, 'dfmt' : _Prop_format, - 'dnam' : _Prop_displayed_name, 'extn' : _Prop_name_extension, 'fcrt' : _Prop_creator_type, 'frsp' : _Prop_free_space, --- 351,356 ---- 'capa' : _Prop_capacity, 'dfmt' : _Prop_format, 'extn' : _Prop_name_extension, + 'faen' : _Prop_folder_actions_enabled, 'fcrt' : _Prop_creator_type, 'frsp' : _Prop_free_space, *************** *** 321,328 **** 'pspd' : _Prop_stationery, 'ptsz' : _Prop_size, - 'pvis' : _Prop_visible, 'url ' : _Prop_url, 'ver2' : _Prop_product_version, 'vers' : _Prop_version, 'volu' : _Prop_volume, } --- 367,374 ---- 'pspd' : _Prop_stationery, 'ptsz' : _Prop_size, 'url ' : _Prop_url, 'ver2' : _Prop_product_version, 'vers' : _Prop_version, + 'visi' : _Prop_visible, 'volu' : _Prop_volume, } Index: Folder_Actions_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Folder_Actions_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Folder_Actions_Suite.py 12 Apr 2003 22:27:10 -0000 1.3 --- Folder_Actions_Suite.py 13 Jun 2003 14:31:18 -0000 1.4 *************** *** 148,162 **** ! class folder_action(aetools.ComponentItem): ! """folder action - An action attached to a folder in the file system """ ! want = 'foac' class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' ! want = 'cobj' ! class _Prop_enabled(aetools.NProperty): ! """enabled - Is the folder action enabled? """ ! which = 'enaB' want = 'bool' class _Prop_name(aetools.NProperty): """name - the name of the folder action, which is also the name of the folder """ --- 148,186 ---- ! class application(aetools.ComponentItem): ! """application - The Folder Actions Suite host program """ ! want = 'capp' class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' ! want = 'capp' ! _3c_Inheritance_3e_ = _Prop__3c_Inheritance_3e_() ! class _Prop_folder_actions_enabled(aetools.NProperty): ! """folder actions enabled - Are Folder Actions currently being processed? """ ! which = 'faen' want = 'bool' + folder_actions_enabled = _Prop_folder_actions_enabled() + class _Prop_properties(aetools.NProperty): + """properties - every property of the Folder Actions Suite host program """ + which = 'pALL' + want = '****' + properties = _Prop_properties() + # element 'cdis' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] + # element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'foac' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'logi' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'pcap' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'pcda' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'prcs' as ['name', 'indx', 'rele', 'rang', 'test'] + + applications = application + + class folder_action(aetools.ComponentItem): + """folder action - An action attached to a folder in the file system """ + want = 'foac' class _Prop_name(aetools.NProperty): """name - the name of the folder action, which is also the name of the folder """ *************** *** 167,174 **** which = 'ppth' want = '****' - class _Prop_properties(aetools.NProperty): - """properties - every property of the folder action """ - which = 'pALL' - want = '****' class _Prop_volume(aetools.NProperty): """volume - the volume on which the folder action resides """ --- 191,194 ---- *************** *** 188,196 **** scripts = script import Standard_Suite folder_action._superclassnames = ['item'] folder_action._privpropdict = { '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, - 'enabled' : _Prop_enabled, 'name' : _Prop_name, 'path' : _Prop_path, --- 208,237 ---- scripts = script + application._superclassnames = [] + import Disk_Folder_File_Suite import Standard_Suite + import Login_Items_Suite + import Processes_Suite + application._privpropdict = { + '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, + 'folder_actions_enabled' : _Prop_folder_actions_enabled, + 'properties' : _Prop_properties, + } + application._privelemdict = { + 'application_process' : Processes_Suite.application_process, + 'desk_accessory_process' : Processes_Suite.desk_accessory_process, + 'disk' : Disk_Folder_File_Suite.disk, + 'document' : Standard_Suite.document, + 'file' : Disk_Folder_File_Suite.file, + 'folder' : Disk_Folder_File_Suite.folder, + 'folder_action' : folder_action, + 'item' : Disk_Folder_File_Suite.item, + 'login_item' : Login_Items_Suite.login_item, + 'process' : Processes_Suite.process, + 'window' : Standard_Suite.window, + } folder_action._superclassnames = ['item'] folder_action._privpropdict = { '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, 'name' : _Prop_name, 'path' : _Prop_path, *************** *** 224,227 **** --- 265,269 ---- # _classdeclarations = { + 'capp' : application, 'foac' : folder_action, 'scpt' : script, *************** *** 230,234 **** _propdeclarations = { 'c@#^' : _Prop__3c_Inheritance_3e_, ! 'enaB' : _Prop_enabled, 'pALL' : _Prop_properties, 'pnam' : _Prop_name, --- 272,276 ---- _propdeclarations = { 'c@#^' : _Prop__3c_Inheritance_3e_, ! 'faen' : _Prop_folder_actions_enabled, 'pALL' : _Prop_properties, 'pnam' : _Prop_name, Index: Power_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Power_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Power_Suite.py 12 Apr 2003 22:27:10 -0000 1.3 --- Power_Suite.py 13 Jun 2003 14:31:18 -0000 1.4 *************** *** 74,84 **** --- 74,144 ---- + class application(aetools.ComponentItem): + """application - The System Events application """ + want = 'capp' + class _Prop__3c_Inheritance_3e_(aetools.NProperty): + """ - All of the properties of the superclass. """ + which = 'c@#^' + want = 'capp' + _3c_Inheritance_3e_ = _Prop__3c_Inheritance_3e_() + class _Prop_folder_actions_enabled(aetools.NProperty): + """folder actions enabled - Are Folder Actions currently being processed? """ + which = 'faen' + want = 'bool' + folder_actions_enabled = _Prop_folder_actions_enabled() + class _Prop_properties(aetools.NProperty): + """properties - every property of the System Events application """ + which = 'pALL' + want = '****' + properties = _Prop_properties() + # element 'cdis' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] + # element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'foac' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'logi' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'pcap' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'pcda' as ['name', 'indx', 'rele', 'rang', 'test'] + # element 'prcs' as ['name', 'indx', 'rele', 'rang', 'test'] + + applications = application + application._superclassnames = [] + import Disk_Folder_File_Suite + import Standard_Suite + import Folder_Actions_Suite + import Login_Items_Suite + import Processes_Suite + application._privpropdict = { + '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, + 'folder_actions_enabled' : _Prop_folder_actions_enabled, + 'properties' : _Prop_properties, + } + application._privelemdict = { + 'application_process' : Processes_Suite.application_process, + 'desk_accessory_process' : Processes_Suite.desk_accessory_process, + 'disk' : Disk_Folder_File_Suite.disk, + 'document' : Standard_Suite.document, + 'file' : Disk_Folder_File_Suite.file, + 'folder' : Disk_Folder_File_Suite.folder, + 'folder_action' : Folder_Actions_Suite.folder_action, + 'item' : Disk_Folder_File_Suite.item, + 'login_item' : Login_Items_Suite.login_item, + 'process' : Processes_Suite.process, + 'window' : Standard_Suite.window, + } + # # Indices of types declared in this module # _classdeclarations = { + 'capp' : application, } _propdeclarations = { + 'c@#^' : _Prop__3c_Inheritance_3e_, + 'faen' : _Prop_folder_actions_enabled, + 'pALL' : _Prop_properties, } Index: Processes_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Processes_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Processes_Suite.py 12 Apr 2003 22:27:10 -0000 1.3 --- Processes_Suite.py 13 Jun 2003 14:31:18 -0000 1.4 *************** *** 13,1207 **** class Processes_Suite_Events: ! def cancel(self, _object, _attributes={}, **_arguments): ! """cancel: cause the target process to behave as if the UI element were cancelled ! Required argument: the object for the command ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'prcs' ! _subcode = 'cncl' ! [...4763 lines suppressed...] 'fcrt' : _Prop_creator_type, 'file' : _Prop_file, 'hscr' : _Prop_has_scripting_terminology, 'isab' : _Prop_accepts_high_level_events, 'pALL' : _Prop_properties, 'pisf' : _Prop_frontmost, 'pnam' : _Prop_name, 'pusd' : _Prop_partition_space_used, 'pvis' : _Prop_visible, 'revt' : _Prop_accepts_remote_events, } *************** *** 4717,4721 **** _enumdeclarations = { - 'eMds' : _Enum_eMds, - 'eMky' : _Enum_eMky, } --- 212,214 ---- Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/Standard_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Standard_Suite.py 12 Apr 2003 22:27:10 -0000 1.3 --- Standard_Suite.py 13 Jun 2003 14:31:18 -0000 1.4 *************** *** 338,354 **** which = 'c@#^' want = 'cobj' class _Prop_frontmost(aetools.NProperty): """frontmost - Is this the frontmost (active) application? """ which = 'pisf' want = 'bool' class _Prop_name(aetools.NProperty): """name - The name of the application. """ which = 'pnam' want = 'utxt' class _Prop_version(aetools.NProperty): """version - The version of the application. """ which = 'vers' want = 'utxt' ! # element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] --- 338,358 ---- which = 'c@#^' want = 'cobj' + _3c_Inheritance_3e_ = _Prop__3c_Inheritance_3e_() class _Prop_frontmost(aetools.NProperty): """frontmost - Is this the frontmost (active) application? """ which = 'pisf' want = 'bool' + frontmost = _Prop_frontmost() class _Prop_name(aetools.NProperty): """name - The name of the application. """ which = 'pnam' want = 'utxt' + name = _Prop_name() class _Prop_version(aetools.NProperty): """version - The version of the application. """ which = 'vers' want = 'utxt' ! version = _Prop_version() ! # element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] # element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] Index: System_Events_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/System_Events_Suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** System_Events_Suite.py 1 May 2003 22:06:15 -0000 1.4 --- System_Events_Suite.py 13 Jun 2003 14:31:18 -0000 1.5 *************** *** 13,17 **** class System_Events_Suite_Events: ! pass --- 13,35 ---- class System_Events_Suite_Events: ! def do_script(self, _object, _attributes={}, **_arguments): ! """do script: Execute an OSA script. ! Required argument: the object for the command ! Keyword argument _attributes: AppleEvent attribute dictionary ! """ ! _code = 'misc' ! _subcode = 'dosc' ! ! if _arguments: raise TypeError, 'No optional args expected' ! _arguments['----'] = _object ! ! ! _reply, _arguments, _attributes = self.send(_code, _subcode, ! _arguments, _attributes) ! if _arguments.get('errn', 0): ! raise aetools.Error, aetools.decodeerror(_arguments) ! # XXXX Optionally decode result ! if _arguments.has_key('----'): ! return _arguments['----'] *************** *** 23,43 **** which = 'c@#^' want = 'capp' class _Prop_folder_actions_enabled(aetools.NProperty): """folder actions enabled - Are Folder Actions currently being processed? """ which = 'faen' want = 'bool' class _Prop_properties(aetools.NProperty): """properties - every property of the System Events application """ which = 'pALL' want = '****' ! class _Prop_system_wide_UI_element(aetools.NProperty): ! """system wide UI element - the UI element for the entire system """ ! which = 'swui' ! want = 'uiel' ! # element 'alis' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cdis' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] ! # element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] --- 41,59 ---- which = 'c@#^' want = 'capp' + _3c_Inheritance_3e_ = _Prop__3c_Inheritance_3e_() class _Prop_folder_actions_enabled(aetools.NProperty): """folder actions enabled - Are Folder Actions currently being processed? """ which = 'faen' want = 'bool' + folder_actions_enabled = _Prop_folder_actions_enabled() class _Prop_properties(aetools.NProperty): """properties - every property of the System Events application """ which = 'pALL' want = '****' ! properties = _Prop_properties() # element 'cdis' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] ! # element 'cwin' as ['name', 'indx', 'rele', 'rang', 'test', 'ID '] # element 'docu' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] *************** *** 47,51 **** # element 'pcda' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'prcs' as ['name', 'indx', 'rele', 'rang', 'test'] - # element 'uiel' as ['name', 'indx', 'rele', 'rang', 'test'] applications = application --- 63,66 ---- *************** *** 60,68 **** 'folder_actions_enabled' : _Prop_folder_actions_enabled, 'properties' : _Prop_properties, - 'system_wide_UI_element' : _Prop_system_wide_UI_element, } application._privelemdict = { - 'UI_element' : Processes_Suite.UI_element, - 'alias' : Disk_Folder_File_Suite.alias, 'application_process' : Processes_Suite.application_process, 'desk_accessory_process' : Processes_Suite.desk_accessory_process, --- 75,80 ---- *************** *** 89,93 **** 'faen' : _Prop_folder_actions_enabled, 'pALL' : _Prop_properties, - 'swui' : _Prop_system_wide_UI_element, } --- 101,104 ---- Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/__init__.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** __init__.py 1 May 2003 22:06:15 -0000 1.4 --- __init__.py 13 Jun 2003 14:31:18 -0000 1.5 *************** *** 12,16 **** import Processes_Suite import System_Events_Suite - import Hidden_Suite --- 12,15 ---- *************** *** 24,28 **** 'prcs' : Processes_Suite, 'sevs' : System_Events_Suite, - 'tpnm' : Hidden_Suite, } --- 23,26 ---- *************** *** 38,42 **** 'prcs' : ('SystemEvents.Processes_Suite', 'Processes_Suite'), 'sevs' : ('SystemEvents.System_Events_Suite', 'System_Events_Suite'), - 'tpnm' : ('SystemEvents.Hidden_Suite', 'Hidden_Suite'), } --- 36,39 ---- *************** *** 49,53 **** from Processes_Suite import * from System_Events_Suite import * - from Hidden_Suite import * def getbaseclasses(v): --- 46,49 ---- *************** *** 68,71 **** --- 64,73 ---- # Set property and element dictionaries now that all classes have been defined # + getbaseclasses(login_item) + getbaseclasses(color) + getbaseclasses(window) + getbaseclasses(application) + getbaseclasses(item) + getbaseclasses(document) getbaseclasses(character) getbaseclasses(attachment) *************** *** 74,175 **** getbaseclasses(attribute_run) getbaseclasses(text) - getbaseclasses(color) - getbaseclasses(window) - getbaseclasses(application) - getbaseclasses(item) - getbaseclasses(document) - getbaseclasses(application) - getbaseclasses(login_item) getbaseclasses(file) ! getbaseclasses(alias) getbaseclasses(item) getbaseclasses(folder) getbaseclasses(disk) getbaseclasses(script) getbaseclasses(folder_action) ! getbaseclasses(StdSuites.Type_Names_Suite.double_integer) ! getbaseclasses(StdSuites.Type_Names_Suite.version) ! getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) ! getbaseclasses(StdSuites.Type_Names_Suite.system_dictionary) ! getbaseclasses(StdSuites.Type_Names_Suite.color_table) ! getbaseclasses(StdSuites.Type_Names_Suite.fixed_point) ! getbaseclasses(StdSuites.Type_Names_Suite.TIFF_picture) ! getbaseclasses(StdSuites.Type_Names_Suite.type_element_info) ! getbaseclasses(StdSuites.Type_Names_Suite.type_event_info) ! getbaseclasses(StdSuites.Type_Names_Suite.machine_location) ! getbaseclasses(StdSuites.Type_Names_Suite.PostScript_picture) ! getbaseclasses(StdSuites.Type_Names_Suite.point) ! getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_point) ! getbaseclasses(StdSuites.Type_Names_Suite.menu_item) ! getbaseclasses(StdSuites.Type_Names_Suite.scrap_styles) ! getbaseclasses(StdSuites.Type_Names_Suite.application_dictionary) ! getbaseclasses(StdSuites.Type_Names_Suite.unsigned_integer) ! getbaseclasses(StdSuites.Type_Names_Suite.menu) ! getbaseclasses(StdSuites.Type_Names_Suite.fixed_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.type_property_info) ! getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.long_fixed) ! getbaseclasses(StdSuites.Type_Names_Suite.type_suite_info) ! getbaseclasses(StdSuites.Type_Names_Suite.rotation) ! getbaseclasses(StdSuites.Type_Names_Suite.small_integer) ! getbaseclasses(StdSuites.Type_Names_Suite.fixed) ! getbaseclasses(StdSuites.Type_Names_Suite.long_point) ! getbaseclasses(StdSuites.Type_Names_Suite.type_class_info) ! getbaseclasses(StdSuites.Type_Names_Suite.RGB96_color) ! getbaseclasses(StdSuites.Type_Names_Suite.target_id) ! getbaseclasses(StdSuites.Type_Names_Suite.pixel_map_record) ! getbaseclasses(StdSuites.Type_Names_Suite.type_parameter_info) ! getbaseclasses(StdSuites.Type_Names_Suite.extended_real) ! getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.dash_style) ! getbaseclasses(StdSuites.Type_Names_Suite.string) ! getbaseclasses(StdSuites.Type_Names_Suite.small_real) ! getbaseclasses(StdSuites.Type_Names_Suite.null) ! getbaseclasses(StdSuites.Type_Names_Suite.location_reference) ! getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) ! getbaseclasses(window) ! getbaseclasses(radio_button) ! getbaseclasses(list) ! getbaseclasses(desk_accessory_process) ! getbaseclasses(menu_item) ! getbaseclasses(progress_indicator) ! getbaseclasses(menu) ! getbaseclasses(menu_button) ! getbaseclasses(pop_up_button) ! getbaseclasses(incrementor) ! getbaseclasses(sheet) ! getbaseclasses(tool_bar) ! getbaseclasses(application_process) ! getbaseclasses(text_field) ! getbaseclasses(text_area) ! getbaseclasses(slider) ! getbaseclasses(scroll_area) ! getbaseclasses(relevance_indicator) ! getbaseclasses(busy_indicator) ! getbaseclasses(row) getbaseclasses(process) ! getbaseclasses(table) ! getbaseclasses(outline) ! getbaseclasses(UI_element) ! getbaseclasses(value_indicator) ! getbaseclasses(system_wide_UI_element) ! getbaseclasses(button) getbaseclasses(application) - getbaseclasses(radio_group) - getbaseclasses(image) - getbaseclasses(tab_group) - getbaseclasses(menu_bar) - getbaseclasses(grow_area) - getbaseclasses(check_box) - getbaseclasses(column) - getbaseclasses(static_text) - getbaseclasses(splitter_group) - getbaseclasses(group) - getbaseclasses(splitter) - getbaseclasses(drawer) - getbaseclasses(color_well) - getbaseclasses(scroll_bar) - getbaseclasses(combo_box) - getbaseclasses(browser) # --- 76,93 ---- getbaseclasses(attribute_run) getbaseclasses(text) getbaseclasses(file) ! getbaseclasses(application) getbaseclasses(item) getbaseclasses(folder) getbaseclasses(disk) getbaseclasses(script) + getbaseclasses(application) getbaseclasses(folder_action) ! getbaseclasses(application) ! getbaseclasses(application) getbaseclasses(process) ! getbaseclasses(application_process) ! getbaseclasses(desk_accessory_process) getbaseclasses(application) # *************** *** 177,180 **** --- 95,104 ---- # _classdeclarations = { + 'logi' : login_item, + 'colr' : color, + 'cwin' : window, + 'capp' : application, + 'cobj' : item, + 'docu' : document, 'cha ' : character, 'atts' : attachment, *************** *** 183,284 **** 'catr' : attribute_run, 'ctxt' : text, - 'colr' : color, - 'cwin' : window, - 'capp' : application, - 'cobj' : item, - 'docu' : document, - 'capp' : application, - 'logi' : login_item, 'file' : file, ! 'alis' : alias, 'cobj' : item, 'cfol' : folder, 'cdis' : disk, 'scpt' : script, 'foac' : folder_action, ! 'comp' : StdSuites.Type_Names_Suite.double_integer, ! 'vers' : StdSuites.Type_Names_Suite.version, ! 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, ! 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, ! 'clrt' : StdSuites.Type_Names_Suite.color_table, ! 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, ! 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, ! 'elin' : StdSuites.Type_Names_Suite.type_element_info, ! 'evin' : StdSuites.Type_Names_Suite.type_event_info, ! 'mLoc' : StdSuites.Type_Names_Suite.machine_location, ! 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, ! 'QDpt' : StdSuites.Type_Names_Suite.point, ! 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, ! 'cmen' : StdSuites.Type_Names_Suite.menu_item, ! 'styl' : StdSuites.Type_Names_Suite.scrap_styles, ! 'aete' : StdSuites.Type_Names_Suite.application_dictionary, ! 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, ! 'cmnu' : StdSuites.Type_Names_Suite.menu, ! 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, ! 'pinf' : StdSuites.Type_Names_Suite.type_property_info, ! 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, ! 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, ! 'suin' : StdSuites.Type_Names_Suite.type_suite_info, ! 'trot' : StdSuites.Type_Names_Suite.rotation, ! 'shor' : StdSuites.Type_Names_Suite.small_integer, ! 'fixd' : StdSuites.Type_Names_Suite.fixed, ! 'lpnt' : StdSuites.Type_Names_Suite.long_point, ! 'gcli' : StdSuites.Type_Names_Suite.type_class_info, ! 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, ! 'targ' : StdSuites.Type_Names_Suite.target_id, ! 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, ! 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, ! 'exte' : StdSuites.Type_Names_Suite.extended_real, ! 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, ! 'tdas' : StdSuites.Type_Names_Suite.dash_style, ! 'TEXT' : StdSuites.Type_Names_Suite.string, ! 'sing' : StdSuites.Type_Names_Suite.small_real, ! 'null' : StdSuites.Type_Names_Suite.null, ! 'insl' : StdSuites.Type_Names_Suite.location_reference, ! 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, ! 'cwin' : window, ! 'radB' : radio_button, ! 'list' : list, ! 'pcda' : desk_accessory_process, ! 'menI' : menu_item, ! 'proI' : progress_indicator, ! 'menE' : menu, ! 'menB' : menu_button, ! 'popB' : pop_up_button, ! 'incr' : incrementor, ! 'sheE' : sheet, ! 'tbar' : tool_bar, ! 'pcap' : application_process, ! 'txtf' : text_field, ! 'txta' : text_area, ! 'sliI' : slider, ! 'scra' : scroll_area, ! 'reli' : relevance_indicator, ! 'busi' : busy_indicator, ! 'crow' : row, 'prcs' : process, ! 'tabB' : table, ! 'outl' : outline, ! 'uiel' : UI_element, ! 'vali' : value_indicator, ! 'sysw' : system_wide_UI_element, ! 'butT' : button, 'capp' : application, - 'rgrp' : radio_group, - 'imaA' : image, - 'tab ' : tab_group, - 'mbar' : menu_bar, - 'grow' : grow_area, - 'chbx' : check_box, - 'ccol' : column, - 'sttx' : static_text, - 'splg' : splitter_group, - 'sgrp' : group, - 'splr' : splitter, - 'draA' : drawer, - 'colW' : color_well, - 'scrb' : scroll_bar, - 'comB' : combo_box, - 'broW' : browser, } --- 107,124 ---- 'catr' : attribute_run, 'ctxt' : text, 'file' : file, ! 'capp' : application, 'cobj' : item, 'cfol' : folder, 'cdis' : disk, 'scpt' : script, + 'capp' : application, 'foac' : folder_action, ! 'capp' : application, ! 'capp' : application, 'prcs' : process, ! 'pcap' : application_process, ! 'pcda' : desk_accessory_process, 'capp' : application, } *************** *** 292,296 **** Processes_Suite_Events, System_Events_Suite_Events, - Hidden_Suite_Events, aetools.TalkTo): _signature = 'sevs' --- 132,135 ---- *************** *** 298,299 **** --- 137,140 ---- _moduleName = 'SystemEvents' + _elemdict = application._elemdict + _propdict = application._propdict From jackjansen@users.sourceforge.net Fri Jun 13 15:31:44 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 13 Jun 2003 07:31:44 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer Standard_Suite.py,1.5,1.6 __init__.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer In directory sc8-pr-cvs1:/tmp/cvs-serv2770/lib-scriptpackages/Explorer Modified Files: Standard_Suite.py __init__.py Log Message: Re-gegernated with the new gensuitemodule. Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/Standard_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Standard_Suite.py 12 Apr 2003 22:27:06 -0000 1.5 --- Standard_Suite.py 13 Jun 2003 14:31:11 -0000 1.6 *************** *** 47,50 **** --- 47,51 ---- which = 'stxt' want = 'TEXT' + selected_text = _Prop_selected_text() application._superclassnames = [] application._privpropdict = { Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Explorer/__init__.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** __init__.py 12 Apr 2003 22:27:07 -0000 1.5 --- __init__.py 13 Jun 2003 14:31:11 -0000 1.6 *************** *** 77,78 **** --- 77,80 ---- _moduleName = 'Explorer' + _elemdict = application._elemdict + _propdict = application._propdict From jackjansen@users.sourceforge.net Fri Jun 13 15:31:44 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 13 Jun 2003 07:31:44 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior CodeWarrior_suite.py,1.7,1.8 Metrowerks_Shell_Suite.py,1.7,1.8 Required.py,1.4,1.5 Standard_Suite.py,1.6,1.7 __init__.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior In directory sc8-pr-cvs1:/tmp/cvs-serv2770/lib-scriptpackages/CodeWarrior Modified Files: CodeWarrior_suite.py Metrowerks_Shell_Suite.py Required.py Standard_Suite.py __init__.py Log Message: Re-gegernated with the new gensuitemodule. Index: CodeWarrior_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CodeWarrior_suite.py 12 Apr 2003 22:27:05 -0000 1.7 --- CodeWarrior_suite.py 13 Jun 2003 14:31:07 -0000 1.8 *************** *** 2,6 **** Level 0, version 0 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.6 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5 AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Metrowerks_Shell_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Metrowerks_Shell_Suite.py 12 Apr 2003 22:27:05 -0000 1.7 --- Metrowerks_Shell_Suite.py 13 Jun 2003 14:31:09 -0000 1.8 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.6 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5 AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Required.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Required.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Required.py 12 Apr 2003 22:27:06 -0000 1.4 --- Required.py 13 Jun 2003 14:31:10 -0000 1.5 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.6 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5 AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/Standard_Suite.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Standard_Suite.py 12 Apr 2003 22:27:06 -0000 1.6 --- Standard_Suite.py 13 Jun 2003 14:31:10 -0000 1.7 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.6 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5 AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 180,183 **** --- 180,184 ---- which = 'inte' want = 'Inte' + user_interaction = _Prop_user_interaction() # element 'cwin' as ['indx', 'name', 'rang'] # element 'docu' as ['indx', 'name', 'rang'] Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/__init__.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** __init__.py 1 May 2003 22:06:11 -0000 1.9 --- __init__.py 13 Jun 2003 14:31:10 -0000 1.10 *************** *** 1,4 **** """ ! Package generated from /Volumes/Moes/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.6 """ import aetools --- 1,4 ---- """ ! Package generated from /Volumes/Sap/Applications (Mac OS 9)/Metrowerks CodeWarrior 7.0/Metrowerks CodeWarrior/CodeWarrior IDE 4.2.5 """ import aetools *************** *** 49,60 **** # getbaseclasses(character) getbaseclasses(text) getbaseclasses(window) getbaseclasses(file) getbaseclasses(line) - getbaseclasses(selection_2d_object) - getbaseclasses(application) getbaseclasses(insertion_point) - getbaseclasses(document) getbaseclasses(single_class_browser) getbaseclasses(project_document) --- 49,60 ---- # getbaseclasses(character) + getbaseclasses(selection_2d_object) + getbaseclasses(application) + getbaseclasses(document) getbaseclasses(text) getbaseclasses(window) getbaseclasses(file) getbaseclasses(line) getbaseclasses(insertion_point) getbaseclasses(single_class_browser) getbaseclasses(project_document) *************** *** 78,113 **** getbaseclasses(Build_Settings) getbaseclasses(ProjectFile) - getbaseclasses(Browser_Coloring) - getbaseclasses(Error_Information) getbaseclasses(VCS_Setup) ! getbaseclasses(Editor) ! getbaseclasses(Shielded_Folders) getbaseclasses(Shielded_Folder) getbaseclasses(Custom_Keywords) getbaseclasses(Path_Information) - getbaseclasses(File_Mappings) getbaseclasses(Segment) ! getbaseclasses(Debugger_Target) ! getbaseclasses(Function_Information) getbaseclasses(Access_Paths) - getbaseclasses(Extras) getbaseclasses(Debugger_Windowing) - getbaseclasses(Global_Source_Trees) - getbaseclasses(Syntax_Coloring) - getbaseclasses(base_class) getbaseclasses(Relative_Path) - getbaseclasses(Target_Settings) getbaseclasses(Environment_Variable) ! getbaseclasses(Source_Tree) getbaseclasses(Debugger_Global) getbaseclasses(member_function) getbaseclasses(Runtime_Settings) getbaseclasses(Plugin_Settings) ! getbaseclasses(data_member) ! getbaseclasses(Build_Extras) getbaseclasses(Font) getbaseclasses(Target_Source_Trees) - getbaseclasses(Debugger_Display) - getbaseclasses(class_) # --- 78,113 ---- getbaseclasses(Build_Settings) getbaseclasses(ProjectFile) getbaseclasses(VCS_Setup) ! getbaseclasses(data_member) getbaseclasses(Shielded_Folder) getbaseclasses(Custom_Keywords) getbaseclasses(Path_Information) getbaseclasses(Segment) ! getbaseclasses(Source_Tree) getbaseclasses(Access_Paths) getbaseclasses(Debugger_Windowing) getbaseclasses(Relative_Path) getbaseclasses(Environment_Variable) ! getbaseclasses(base_class) ! getbaseclasses(Debugger_Display) ! getbaseclasses(Build_Extras) ! getbaseclasses(Error_Information) ! getbaseclasses(Editor) ! getbaseclasses(Shielded_Folders) ! getbaseclasses(Extras) ! getbaseclasses(File_Mappings) ! getbaseclasses(Function_Information) ! getbaseclasses(Debugger_Target) ! getbaseclasses(Syntax_Coloring) ! getbaseclasses(class_) ! getbaseclasses(Global_Source_Trees) ! getbaseclasses(Target_Settings) getbaseclasses(Debugger_Global) getbaseclasses(member_function) getbaseclasses(Runtime_Settings) getbaseclasses(Plugin_Settings) ! getbaseclasses(Browser_Coloring) getbaseclasses(Font) getbaseclasses(Target_Source_Trees) # *************** *** 116,127 **** _classdeclarations = { 'cha ' : character, 'ctxt' : text, 'cwin' : window, 'file' : file, 'clin' : line, - 'csel' : selection_2d_object, - 'capp' : application, 'cins' : insertion_point, - 'docu' : document, '1BRW' : single_class_browser, 'PRJD' : project_document, --- 116,127 ---- _classdeclarations = { 'cha ' : character, + 'csel' : selection_2d_object, + 'capp' : application, + 'docu' : document, 'ctxt' : text, 'cwin' : window, 'file' : file, 'clin' : line, 'cins' : insertion_point, '1BRW' : single_class_browser, 'PRJD' : project_document, *************** *** 145,180 **** 'BSTG' : Build_Settings, 'SrcF' : ProjectFile, - 'BRKW' : Browser_Coloring, - 'ErrM' : Error_Information, 'VCSs' : VCS_Setup, ! 'EDTR' : Editor, ! 'SHFL' : Shielded_Folders, 'SFit' : Shielded_Folder, 'CUKW' : Custom_Keywords, 'PInf' : Path_Information, - 'FLMP' : File_Mappings, 'Seg ' : Segment, ! 'DbTG' : Debugger_Target, ! 'FDef' : Function_Information, 'PATH' : Access_Paths, - 'GXTR' : Extras, 'DbWN' : Debugger_Windowing, - 'GSTs' : Global_Source_Trees, - 'SNTX' : Syntax_Coloring, - 'BsCl' : base_class, 'RlPt' : Relative_Path, - 'TARG' : Target_Settings, 'EnvV' : Environment_Variable, ! 'SrcT' : Source_Tree, 'DbGL' : Debugger_Global, 'MbFn' : member_function, 'RSTG' : Runtime_Settings, 'PSTG' : Plugin_Settings, ! 'DtMb' : data_member, ! 'LXTR' : Build_Extras, 'mFNT' : Font, 'TSTs' : Target_Source_Trees, - 'DbDS' : Debugger_Display, - 'Clas' : class_, } --- 145,180 ---- 'BSTG' : Build_Settings, 'SrcF' : ProjectFile, 'VCSs' : VCS_Setup, ! 'DtMb' : data_member, 'SFit' : Shielded_Folder, 'CUKW' : Custom_Keywords, 'PInf' : Path_Information, 'Seg ' : Segment, ! 'SrcT' : Source_Tree, 'PATH' : Access_Paths, 'DbWN' : Debugger_Windowing, 'RlPt' : Relative_Path, 'EnvV' : Environment_Variable, ! 'BsCl' : base_class, ! 'DbDS' : Debugger_Display, ! 'LXTR' : Build_Extras, ! 'ErrM' : Error_Information, ! 'EDTR' : Editor, ! 'SHFL' : Shielded_Folders, ! 'GXTR' : Extras, ! 'FLMP' : File_Mappings, ! 'FDef' : Function_Information, ! 'DbTG' : Debugger_Target, ! 'SNTX' : Syntax_Coloring, ! 'Clas' : class_, ! 'GSTs' : Global_Source_Trees, ! 'TARG' : Target_Settings, 'DbGL' : Debugger_Global, 'MbFn' : member_function, 'RSTG' : Runtime_Settings, 'PSTG' : Plugin_Settings, ! 'BRKW' : Browser_Coloring, 'mFNT' : Font, 'TSTs' : Target_Source_Trees, } From jackjansen@users.sourceforge.net Fri Jun 13 15:31:48 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 13 Jun 2003 07:31:48 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder Finder_Basics.py,1.6,1.7 Legacy_suite.py,1.3,1.4 __init__.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder In directory sc8-pr-cvs1:/tmp/cvs-serv2770/lib-scriptpackages/Finder Modified Files: Finder_Basics.py Legacy_suite.py __init__.py Log Message: Re-gegernated with the new gensuitemodule. Index: Finder_Basics.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Finder_Basics.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Finder_Basics.py 12 Apr 2003 22:27:09 -0000 1.6 --- Finder_Basics.py 13 Jun 2003 14:31:11 -0000 1.7 *************** *** 66,117 **** --- 66,130 ---- which = 'pfrp' want = 'cprf' + Finder_preferences = _Prop_Finder_preferences() class _Prop_clipboard(aetools.NProperty): """clipboard - (NOT AVAILABLE YET) the Finder\xd5s clipboard window """ which = 'pcli' want = 'obj ' + clipboard = _Prop_clipboard() class _Prop_desktop(aetools.NProperty): """desktop - the desktop """ which = 'desk' want = 'cdsk' + desktop = _Prop_desktop() class _Prop_frontmost(aetools.NProperty): """frontmost - Is the Finder the frontmost process? """ which = 'pisf' want = 'bool' + frontmost = _Prop_frontmost() class _Prop_home(aetools.NProperty): """home - the home directory """ which = 'home' want = 'cfol' + home = _Prop_home() class _Prop_insertion_location(aetools.NProperty): """insertion location - the container in which a new folder would appear if \xd2New Folder\xd3 was selected """ which = 'pins' want = 'obj ' + insertion_location = _Prop_insertion_location() class _Prop_name(aetools.NProperty): """name - the Finder\xd5s name """ which = 'pnam' want = 'itxt' + name = _Prop_name() class _Prop_product_version(aetools.NProperty): """product version - the version of the System software running on this computer """ which = 'ver2' want = 'utxt' + product_version = _Prop_product_version() class _Prop_selection(aetools.NProperty): """selection - the selection in the frontmost Finder window """ which = 'sele' want = 'obj ' + selection = _Prop_selection() class _Prop_startup_disk(aetools.NProperty): """startup disk - the startup disk """ which = 'sdsk' want = 'cdis' + startup_disk = _Prop_startup_disk() class _Prop_trash(aetools.NProperty): """trash - the trash """ which = 'trsh' want = 'ctrs' + trash = _Prop_trash() class _Prop_version(aetools.NProperty): """version - the version of the Finder """ which = 'vers' want = 'utxt' + version = _Prop_version() class _Prop_visible(aetools.NProperty): """visible - Is the Finder\xd5s layer visible? """ which = 'pvis' want = 'bool' + visible = _Prop_visible() # element 'alia' as ['indx', 'name'] # element 'appf' as ['indx', 'name', 'ID '] Index: Legacy_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/Legacy_suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Legacy_suite.py 12 Apr 2003 22:27:09 -0000 1.3 --- Legacy_suite.py 13 Jun 2003 14:31:13 -0000 1.4 *************** *** 78,81 **** --- 78,82 ---- which = 'dpic' want = 'file' + desktop_picture = _Prop_desktop_picture() class application_process(aetools.ComponentItem): Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/__init__.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** __init__.py 1 May 2003 22:06:12 -0000 1.9 --- __init__.py 13 Jun 2003 14:31:13 -0000 1.10 *************** *** 68,141 **** # Set property and element dictionaries now that all classes have been defined # ! getbaseclasses(icon_view_options) ! getbaseclasses(label) ! getbaseclasses(column) ! getbaseclasses(preferences) ! getbaseclasses(alias_list) ! getbaseclasses(icon_family) ! getbaseclasses(list_view_options) ! getbaseclasses(item) ! getbaseclasses(package) ! getbaseclasses(file) ! getbaseclasses(application_file) ! getbaseclasses(alias_file) ! getbaseclasses(internet_location_file) ! getbaseclasses(document_file) ! getbaseclasses(clipping) ! getbaseclasses(preferences_window) ! getbaseclasses(Finder_window) ! getbaseclasses(window) ! getbaseclasses(clipping_window) ! getbaseclasses(information_window) ! getbaseclasses(application) ! getbaseclasses(process) ! getbaseclasses(application_process) ! getbaseclasses(desk_accessory_process) ! getbaseclasses(application) ! getbaseclasses(trash_2d_object) ! getbaseclasses(desktop_2d_object) ! getbaseclasses(container) ! getbaseclasses(folder) ! getbaseclasses(disk) ! getbaseclasses(StdSuites.Type_Names_Suite.double_integer) ! getbaseclasses(StdSuites.Type_Names_Suite.version) ! getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) getbaseclasses(StdSuites.Type_Names_Suite.system_dictionary) getbaseclasses(StdSuites.Type_Names_Suite.color_table) getbaseclasses(StdSuites.Type_Names_Suite.fixed_point) ! getbaseclasses(StdSuites.Type_Names_Suite.TIFF_picture) getbaseclasses(StdSuites.Type_Names_Suite.type_element_info) - getbaseclasses(StdSuites.Type_Names_Suite.type_event_info) getbaseclasses(StdSuites.Type_Names_Suite.machine_location) getbaseclasses(StdSuites.Type_Names_Suite.PostScript_picture) ! getbaseclasses(StdSuites.Type_Names_Suite.point) ! getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_point) getbaseclasses(StdSuites.Type_Names_Suite.menu_item) getbaseclasses(StdSuites.Type_Names_Suite.scrap_styles) - getbaseclasses(StdSuites.Type_Names_Suite.application_dictionary) - getbaseclasses(StdSuites.Type_Names_Suite.unsigned_integer) - getbaseclasses(StdSuites.Type_Names_Suite.menu) getbaseclasses(StdSuites.Type_Names_Suite.fixed_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.type_property_info) getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.long_fixed) getbaseclasses(StdSuites.Type_Names_Suite.type_suite_info) ! getbaseclasses(StdSuites.Type_Names_Suite.rotation) ! getbaseclasses(StdSuites.Type_Names_Suite.small_integer) getbaseclasses(StdSuites.Type_Names_Suite.fixed) - getbaseclasses(StdSuites.Type_Names_Suite.long_point) getbaseclasses(StdSuites.Type_Names_Suite.type_class_info) getbaseclasses(StdSuites.Type_Names_Suite.RGB96_color) ! getbaseclasses(StdSuites.Type_Names_Suite.target_id) getbaseclasses(StdSuites.Type_Names_Suite.pixel_map_record) - getbaseclasses(StdSuites.Type_Names_Suite.type_parameter_info) getbaseclasses(StdSuites.Type_Names_Suite.extended_real) getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.dash_style) ! getbaseclasses(StdSuites.Type_Names_Suite.string) ! getbaseclasses(StdSuites.Type_Names_Suite.small_real) ! getbaseclasses(StdSuites.Type_Names_Suite.null) ! getbaseclasses(StdSuites.Type_Names_Suite.location_reference) ! getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) # --- 68,141 ---- # Set property and element dictionaries now that all classes have been defined # ! getbaseclasses(StdSuites.Type_Names_Suite.small_integer) getbaseclasses(StdSuites.Type_Names_Suite.system_dictionary) getbaseclasses(StdSuites.Type_Names_Suite.color_table) getbaseclasses(StdSuites.Type_Names_Suite.fixed_point) ! getbaseclasses(StdSuites.Type_Names_Suite.string) getbaseclasses(StdSuites.Type_Names_Suite.type_element_info) getbaseclasses(StdSuites.Type_Names_Suite.machine_location) getbaseclasses(StdSuites.Type_Names_Suite.PostScript_picture) ! getbaseclasses(StdSuites.Type_Names_Suite.type_property_info) getbaseclasses(StdSuites.Type_Names_Suite.menu_item) getbaseclasses(StdSuites.Type_Names_Suite.scrap_styles) getbaseclasses(StdSuites.Type_Names_Suite.fixed_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.null) ! getbaseclasses(StdSuites.Type_Names_Suite.type_event_info) ! getbaseclasses(StdSuites.Type_Names_Suite.rotation) getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.long_point) ! getbaseclasses(StdSuites.Type_Names_Suite.target_id) getbaseclasses(StdSuites.Type_Names_Suite.type_suite_info) ! getbaseclasses(StdSuites.Type_Names_Suite.type_parameter_info) ! getbaseclasses(StdSuites.Type_Names_Suite.long_fixed_point) ! getbaseclasses(StdSuites.Type_Names_Suite.bounding_rectangle) ! getbaseclasses(StdSuites.Type_Names_Suite.TIFF_picture) ! getbaseclasses(StdSuites.Type_Names_Suite.long_fixed) ! getbaseclasses(StdSuites.Type_Names_Suite.version) ! getbaseclasses(StdSuites.Type_Names_Suite.RGB16_color) ! getbaseclasses(StdSuites.Type_Names_Suite.double_integer) ! getbaseclasses(StdSuites.Type_Names_Suite.location_reference) ! getbaseclasses(StdSuites.Type_Names_Suite.point) ! getbaseclasses(StdSuites.Type_Names_Suite.application_dictionary) ! getbaseclasses(StdSuites.Type_Names_Suite.unsigned_integer) ! getbaseclasses(StdSuites.Type_Names_Suite.menu) ! getbaseclasses(StdSuites.Type_Names_Suite.small_real) getbaseclasses(StdSuites.Type_Names_Suite.fixed) getbaseclasses(StdSuites.Type_Names_Suite.type_class_info) getbaseclasses(StdSuites.Type_Names_Suite.RGB96_color) ! getbaseclasses(StdSuites.Type_Names_Suite.dash_style) getbaseclasses(StdSuites.Type_Names_Suite.pixel_map_record) getbaseclasses(StdSuites.Type_Names_Suite.extended_real) getbaseclasses(StdSuites.Type_Names_Suite.long_rectangle) ! getbaseclasses(process) ! getbaseclasses(application_process) ! getbaseclasses(desk_accessory_process) ! getbaseclasses(application) ! getbaseclasses(trash_2d_object) ! getbaseclasses(desktop_2d_object) ! getbaseclasses(container) ! getbaseclasses(folder) ! getbaseclasses(disk) ! getbaseclasses(application) ! getbaseclasses(alias_file) ! getbaseclasses(package) ! getbaseclasses(file) ! getbaseclasses(application_file) ! getbaseclasses(internet_location_file) ! getbaseclasses(document_file) ! getbaseclasses(clipping) ! getbaseclasses(preferences_window) ! getbaseclasses(Finder_window) ! getbaseclasses(window) ! getbaseclasses(clipping_window) ! getbaseclasses(information_window) ! getbaseclasses(item) ! getbaseclasses(icon_view_options) ! getbaseclasses(preferences) ! getbaseclasses(alias_list) ! getbaseclasses(icon_family) ! getbaseclasses(label) ! getbaseclasses(column) ! getbaseclasses(list_view_options) # *************** *** 143,216 **** # _classdeclarations = { ! 'icop' : icon_view_options, ! 'clbl' : label, ! 'lvcl' : column, ! 'cprf' : preferences, ! 'alst' : alias_list, ! 'ifam' : icon_family, ! 'lvop' : list_view_options, ! 'cobj' : item, ! 'pack' : package, ! 'file' : file, ! 'appf' : application_file, ! 'alia' : alias_file, ! 'inlf' : internet_location_file, ! 'docf' : document_file, ! 'clpf' : clipping, ! 'pwnd' : preferences_window, ! 'brow' : Finder_window, ! 'cwin' : window, ! 'lwnd' : clipping_window, ! 'iwnd' : information_window, ! 'capp' : application, ! 'prcs' : process, ! 'pcap' : application_process, ! 'pcda' : desk_accessory_process, ! 'capp' : application, ! 'ctrs' : trash_2d_object, ! 'cdsk' : desktop_2d_object, ! 'ctnr' : container, ! 'cfol' : folder, ! 'cdis' : disk, ! 'comp' : StdSuites.Type_Names_Suite.double_integer, ! 'vers' : StdSuites.Type_Names_Suite.version, ! 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, 'clrt' : StdSuites.Type_Names_Suite.color_table, 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, ! 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, 'elin' : StdSuites.Type_Names_Suite.type_element_info, - 'evin' : StdSuites.Type_Names_Suite.type_event_info, 'mLoc' : StdSuites.Type_Names_Suite.machine_location, 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, ! 'QDpt' : StdSuites.Type_Names_Suite.point, ! 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, 'cmen' : StdSuites.Type_Names_Suite.menu_item, 'styl' : StdSuites.Type_Names_Suite.scrap_styles, - 'aete' : StdSuites.Type_Names_Suite.application_dictionary, - 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, - 'cmnu' : StdSuites.Type_Names_Suite.menu, 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, ! 'pinf' : StdSuites.Type_Names_Suite.type_property_info, 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, ! 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, 'suin' : StdSuites.Type_Names_Suite.type_suite_info, ! 'trot' : StdSuites.Type_Names_Suite.rotation, ! 'shor' : StdSuites.Type_Names_Suite.small_integer, 'fixd' : StdSuites.Type_Names_Suite.fixed, - 'lpnt' : StdSuites.Type_Names_Suite.long_point, 'gcli' : StdSuites.Type_Names_Suite.type_class_info, 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, ! 'targ' : StdSuites.Type_Names_Suite.target_id, 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, - 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, 'exte' : StdSuites.Type_Names_Suite.extended_real, 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, ! 'tdas' : StdSuites.Type_Names_Suite.dash_style, ! 'TEXT' : StdSuites.Type_Names_Suite.string, ! 'sing' : StdSuites.Type_Names_Suite.small_real, ! 'null' : StdSuites.Type_Names_Suite.null, ! 'insl' : StdSuites.Type_Names_Suite.location_reference, ! 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, } --- 143,216 ---- # _classdeclarations = { ! 'shor' : StdSuites.Type_Names_Suite.small_integer, 'aeut' : StdSuites.Type_Names_Suite.system_dictionary, 'clrt' : StdSuites.Type_Names_Suite.color_table, 'fpnt' : StdSuites.Type_Names_Suite.fixed_point, ! 'TEXT' : StdSuites.Type_Names_Suite.string, 'elin' : StdSuites.Type_Names_Suite.type_element_info, 'mLoc' : StdSuites.Type_Names_Suite.machine_location, 'EPS ' : StdSuites.Type_Names_Suite.PostScript_picture, ! 'pinf' : StdSuites.Type_Names_Suite.type_property_info, 'cmen' : StdSuites.Type_Names_Suite.menu_item, 'styl' : StdSuites.Type_Names_Suite.scrap_styles, 'frct' : StdSuites.Type_Names_Suite.fixed_rectangle, ! 'null' : StdSuites.Type_Names_Suite.null, ! 'evin' : StdSuites.Type_Names_Suite.type_event_info, ! 'trot' : StdSuites.Type_Names_Suite.rotation, 'lfrc' : StdSuites.Type_Names_Suite.long_fixed_rectangle, ! 'lpnt' : StdSuites.Type_Names_Suite.long_point, ! 'targ' : StdSuites.Type_Names_Suite.target_id, 'suin' : StdSuites.Type_Names_Suite.type_suite_info, ! 'pmin' : StdSuites.Type_Names_Suite.type_parameter_info, ! 'lfpt' : StdSuites.Type_Names_Suite.long_fixed_point, ! 'qdrt' : StdSuites.Type_Names_Suite.bounding_rectangle, ! 'TIFF' : StdSuites.Type_Names_Suite.TIFF_picture, ! 'lfxd' : StdSuites.Type_Names_Suite.long_fixed, ! 'vers' : StdSuites.Type_Names_Suite.version, ! 'tr16' : StdSuites.Type_Names_Suite.RGB16_color, ! 'comp' : StdSuites.Type_Names_Suite.double_integer, ! 'insl' : StdSuites.Type_Names_Suite.location_reference, ! 'QDpt' : StdSuites.Type_Names_Suite.point, ! 'aete' : StdSuites.Type_Names_Suite.application_dictionary, ! 'magn' : StdSuites.Type_Names_Suite.unsigned_integer, ! 'cmnu' : StdSuites.Type_Names_Suite.menu, ! 'sing' : StdSuites.Type_Names_Suite.small_real, 'fixd' : StdSuites.Type_Names_Suite.fixed, 'gcli' : StdSuites.Type_Names_Suite.type_class_info, 'tr96' : StdSuites.Type_Names_Suite.RGB96_color, ! 'tdas' : StdSuites.Type_Names_Suite.dash_style, 'tpmm' : StdSuites.Type_Names_Suite.pixel_map_record, 'exte' : StdSuites.Type_Names_Suite.extended_real, 'lrct' : StdSuites.Type_Names_Suite.long_rectangle, ! 'prcs' : process, ! 'pcap' : application_process, ! 'pcda' : desk_accessory_process, ! 'capp' : application, ! 'ctrs' : trash_2d_object, ! 'cdsk' : desktop_2d_object, ! 'ctnr' : container, ! 'cfol' : folder, ! 'cdis' : disk, ! 'capp' : application, ! 'alia' : alias_file, ! 'pack' : package, ! 'file' : file, ! 'appf' : application_file, ! 'inlf' : internet_location_file, ! 'docf' : document_file, ! 'clpf' : clipping, ! 'pwnd' : preferences_window, ! 'brow' : Finder_window, ! 'cwin' : window, ! 'lwnd' : clipping_window, ! 'iwnd' : information_window, ! 'cobj' : item, ! 'icop' : icon_view_options, ! 'cprf' : preferences, ! 'alst' : alias_list, ! 'ifam' : icon_family, ! 'clbl' : label, ! 'lvcl' : column, ! 'lvop' : list_view_options, } *************** *** 230,231 **** --- 230,233 ---- _moduleName = 'Finder' + _elemdict = application._elemdict + _propdict = application._propdict From jackjansen@users.sourceforge.net Fri Jun 13 15:31:49 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 13 Jun 2003 07:31:49 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape Mozilla_suite.py,1.6,1.7 PowerPlant.py,1.5,1.6 Required_suite.py,1.4,1.5 Standard_Suite.py,1.5,1.6 Standard_URL_suite.py,1.4,1.5 Text.py,1.7,1.8 WorldWideWeb_suite.py,1.5,1.6 __init__.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape In directory sc8-pr-cvs1:/tmp/cvs-serv2770/lib-scriptpackages/Netscape Modified Files: Mozilla_suite.py PowerPlant.py Required_suite.py Standard_Suite.py Standard_URL_suite.py Text.py WorldWideWeb_suite.py __init__.py Log Message: Re-gegernated with the new gensuitemodule. Index: Mozilla_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Mozilla_suite.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Mozilla_suite.py 12 Apr 2003 22:27:09 -0000 1.6 --- Mozilla_suite.py 13 Jun 2003 14:31:13 -0000 1.7 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ Index: PowerPlant.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/PowerPlant.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PowerPlant.py 12 Apr 2003 22:27:09 -0000 1.5 --- PowerPlant.py 13 Jun 2003 14:31:13 -0000 1.6 *************** *** 2,6 **** Level 0, version 0 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Required_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Required_suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Required_suite.py 12 Apr 2003 22:27:09 -0000 1.4 --- Required_suite.py 13 Jun 2003 14:31:13 -0000 1.5 *************** *** 2,6 **** Level 0, version 0 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Standard_Suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Standard_Suite.py 12 Apr 2003 22:27:09 -0000 1.5 --- Standard_Suite.py 13 Jun 2003 14:31:13 -0000 1.6 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 109,116 **** --- 109,118 ---- which = 'ALAP' want = 'type' + alert_application = _Prop_alert_application() class _Prop_kiosk_mode(aetools.NProperty): """kiosk mode - Kiosk mode leaves very few menus enabled """ which = 'KOSK' want = 'long' + kiosk_mode = _Prop_kiosk_mode() # element 'cwin' as ['indx', 'name', 'ID '] Index: Standard_URL_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Standard_URL_suite.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Standard_URL_suite.py 12 Apr 2003 22:27:09 -0000 1.4 --- Standard_URL_suite.py 13 Jun 2003 14:31:13 -0000 1.5 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ Index: Text.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/Text.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Text.py 12 Apr 2003 22:27:09 -0000 1.7 --- Text.py 13 Jun 2003 14:31:14 -0000 1.8 *************** *** 2,6 **** Level 0, version 0 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ Index: WorldWideWeb_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/WorldWideWeb_suite.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** WorldWideWeb_suite.py 12 Apr 2003 22:27:09 -0000 1.5 --- WorldWideWeb_suite.py 13 Jun 2003 14:31:14 -0000 1.6 *************** *** 2,6 **** Level 1, version 1 ! Generated from /Volumes/Moes/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 AETE/AEUT resource version 1/0, language 0, script 0 """ Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/__init__.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** __init__.py 1 May 2003 22:06:12 -0000 1.8 --- __init__.py 13 Jun 2003 14:31:14 -0000 1.9 *************** *** 1,4 **** """ ! Package generated from /Volumes/Moes/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 """ import aetools --- 1,4 ---- """ ! Package generated from /Volumes/Sap/Applications (Mac OS 9)/Netscape Communicator\xe2\x84\xa2 Folder/Netscape Communicator\xe2\x84\xa2 """ import aetools *************** *** 60,74 **** # Set property and element dictionaries now that all classes have been defined # ! getbaseclasses(window) ! getbaseclasses(application) ! getbaseclasses(StdSuites.Text_Suite.text_flow) getbaseclasses(StdSuites.Text_Suite.character) ! getbaseclasses(StdSuites.Text_Suite.text_style_info) ! getbaseclasses(StdSuites.Text_Suite.line) getbaseclasses(StdSuites.Text_Suite.word) getbaseclasses(StdSuites.Text_Suite.paragraph) getbaseclasses(StdSuites.Text_Suite.text) ! getbaseclasses(text) ! getbaseclasses(styleset) # --- 60,74 ---- # Set property and element dictionaries now that all classes have been defined # ! getbaseclasses(text) ! getbaseclasses(styleset) getbaseclasses(StdSuites.Text_Suite.character) ! getbaseclasses(StdSuites.Text_Suite.text_flow) getbaseclasses(StdSuites.Text_Suite.word) getbaseclasses(StdSuites.Text_Suite.paragraph) + getbaseclasses(StdSuites.Text_Suite.text_style_info) + getbaseclasses(StdSuites.Text_Suite.line) getbaseclasses(StdSuites.Text_Suite.text) ! getbaseclasses(window) ! getbaseclasses(application) # *************** *** 76,90 **** # _classdeclarations = { ! 'cwin' : window, ! 'capp' : application, ! 'cflo' : StdSuites.Text_Suite.text_flow, 'cha ' : StdSuites.Text_Suite.character, ! 'tsty' : StdSuites.Text_Suite.text_style_info, ! 'clin' : StdSuites.Text_Suite.line, 'cwor' : StdSuites.Text_Suite.word, 'cpar' : StdSuites.Text_Suite.paragraph, 'ctxt' : StdSuites.Text_Suite.text, ! 'ctxt' : text, ! 'stys' : styleset, } --- 76,90 ---- # _classdeclarations = { ! 'ctxt' : text, ! 'stys' : styleset, 'cha ' : StdSuites.Text_Suite.character, ! 'cflo' : StdSuites.Text_Suite.text_flow, 'cwor' : StdSuites.Text_Suite.word, 'cpar' : StdSuites.Text_Suite.paragraph, + 'tsty' : StdSuites.Text_Suite.text_style_info, + 'clin' : StdSuites.Text_Suite.line, 'ctxt' : StdSuites.Text_Suite.text, ! 'cwin' : window, ! 'capp' : application, } *************** *** 102,103 **** --- 102,105 ---- _moduleName = 'Netscape' + _elemdict = application._elemdict + _propdict = application._propdict From jackjansen@users.sourceforge.net Fri Jun 13 15:32:53 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 13 Jun 2003 07:32:53 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation scripting.html,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation In directory sc8-pr-cvs1:/tmp/cvs-serv3613 Modified Files: scripting.html Log Message: Use the new, now preferred, form of referring to object specifiers (through the object, not the module). Index: scripting.html =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/scripting.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** scripting.html 1 Apr 2003 22:30:23 -0000 1.2 --- scripting.html 13 Jun 2003 14:32:49 -0000 1.3 *************** *** 22,26 **** f = Finder.Finder() ! print f.get(Finder.window(1).name) --- 22,26 ---- f = Finder.Finder() ! print f.get(f.window(1).name) From jackjansen@users.sourceforge.net Fri Jun 13 15:59:31 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 13 Jun 2003 07:59:31 -0700 Subject: [Python-checkins] python/dist/src/Doc/mac scripting.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory sc8-pr-cvs1:/tmp/cvs-serv16325 Modified Files: scripting.tex Log Message: Documented the fact that the main class now mimicks the OSA "application" class. Index: scripting.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/scripting.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** scripting.tex 11 Apr 2003 15:35:27 -0000 1.1 --- scripting.tex 13 Jun 2003 14:59:26 -0000 1.2 *************** *** 32,36 **** f = Finder.Finder() ! print f.get(Finder.window(1).name) \end{verbatim} --- 32,36 ---- f = Finder.Finder() ! print f.get(f.window(1).name) \end{verbatim} *************** *** 65,72 **** classes, as are comparisons and all the other thingies. ! Note that in the current release there is no coupling between the main ! Python class implementing the verbs and the Python classes implementing ! the AppleScript classes. Hence, in the example above we need to use ! \code{f.get(Finder.window(1).name)} in stead of the more Pythonic \code{f.window(1).name.get()}. --- 65,74 ---- classes, as are comparisons and all the other thingies. ! The main ! Python class implementing the verbs also allows access to the properties ! and elements declared in the AppleScript class "application". In the ! current release that is as far as the object orientation goes, so ! in the example above we need to use ! \code{f.get(f.window(1).name)} in stead of the more Pythonic \code{f.window(1).name.get()}. From gvanrossum@users.sourceforge.net Fri Jun 13 20:26:31 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 13 Jun 2003 12:26:31 -0700 Subject: [Python-checkins] python/dist/src/Lib copy.py,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv4844 Modified Files: copy.py Log Message: SF patch 707900, fixing bug 702858, by Steven Taschuk. Copying a new-style class that had a reference to itself didn't work. (The same thing worked fine for old-style classes.) Index: copy.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/copy.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** copy.py 27 Feb 2003 20:14:33 -0000 1.40 --- copy.py 13 Jun 2003 19:26:29 -0000 1.41 *************** *** 335,338 **** --- 335,339 ---- args = deepcopy(args, memo) y = callable(*args) + memo[id(x)] = y if listiter is not None: for item in listiter: From gvanrossum@users.sourceforge.net Fri Jun 13 20:26:32 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 13 Jun 2003 12:26:32 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_copy.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv4844/test Modified Files: test_copy.py Log Message: SF patch 707900, fixing bug 702858, by Steven Taschuk. Copying a new-style class that had a reference to itself didn't work. (The same thing worked fine for old-style classes.) Index: test_copy.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_copy.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_copy.py 8 Jun 2003 13:19:58 -0000 1.9 --- test_copy.py 13 Jun 2003 19:26:29 -0000 1.10 *************** *** 175,185 **** def test_deepcopy_memo(self): x = [] ! x.append(x) y = copy.deepcopy(x) self.assertEqual(y, x) self.assert_(y is not x) self.assert_(y[0] is not x[0]) ! self.assert_(y is y[0]) def test_deepcopy_issubclass(self): --- 175,187 ---- def test_deepcopy_memo(self): + # Tests of reflexive objects are under type-specific sections below. + # This tests only repetitions of objects. x = [] ! x = [x, x] y = copy.deepcopy(x) self.assertEqual(y, x) self.assert_(y is not x) self.assert_(y[0] is not x[0]) ! self.assert_(y[0] is y[1]) def test_deepcopy_issubclass(self): *************** *** 267,270 **** --- 269,281 ---- self.assert_(x[0] is not y[0]) + def test_deepcopy_reflexive_list(self): + x = [] + x.append(x) + y = copy.deepcopy(x) + self.assertEqual(y, x) + self.assert_(y is not x) + self.assert_(y[0] is not x[0]) + self.assert_(y is y[0]) + def test_deepcopy_tuple(self): x = ([1, 2], 3) *************** *** 274,277 **** --- 285,297 ---- self.assert_(x[0] is not y[0]) + def test_deepcopy_reflexive_tuple(self): + x = ([],) + x[0].append(x) + y = copy.deepcopy(x) + self.assertEqual(y, x) + self.assert_(y is not x) + self.assert_(y[0] is not x[0]) + self.assert_(y[0][0] is y) + def test_deepcopy_dict(self): x = {"foo": [1, 2], "bar": 3} *************** *** 281,284 **** --- 301,313 ---- self.assert_(x["foo"] is not y["foo"]) + def test_deepcopy_reflexive_dict(self): + x = {} + x['foo'] = x + y = copy.deepcopy(x) + self.assertEqual(y, x) + self.assert_(y is not x) + self.assert_(y['foo'] is y) + self.assertEqual(y, {'foo': y}) + def test_deepcopy_keepalive(self): memo = {} *************** *** 370,373 **** --- 399,411 ---- self.assert_(y.foo is not x.foo) + def test_deepcopy_reflexive_inst(self): + class C: + pass + x = C() + x.foo = x + y = copy.deepcopy(x) + self.assert_(y is not x) + self.assert_(y.foo is y) + # _reconstruct() *************** *** 422,425 **** --- 460,472 ---- self.assertEqual(y, x) self.assert_(y.foo is not x.foo) + + def test_reconstruct_reflexive(self): + class C(object): + pass + x = C() + x.foo = x + y = copy.deepcopy(x) + self.assert_(y is not x) + self.assert_(y.foo is y) # Additions for Python 2.3 and pickle protocol 2 From gvanrossum@users.sourceforge.net Fri Jun 13 20:28:50 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 13 Jun 2003 12:28:50 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.778,1.779 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv5361 Modified Files: NEWS Log Message: SF patch 707900, fixing bug 702858, by Steven Taschuk. Copying a new-style class that had a reference to itself didn't work. (The same thing worked fine for old-style classes.) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.778 retrieving revision 1.779 diff -C2 -d -r1.778 -r1.779 *** NEWS 9 Jun 2003 18:42:19 -0000 1.778 --- NEWS 13 Jun 2003 19:28:47 -0000 1.779 *************** *** 71,74 **** --- 71,78 ---- ------- + - copy.py: applied SF patch 707900, fixing bug 702858, by Steven + Taschuk. Copying a new-style class that had a reference to itself + didn't work. (The same thing worked fine for old-style classes.) + - difflib.py has two new functions: context_diff() and unified_diff(). From bwarsaw@users.sourceforge.net Fri Jun 13 20:30:56 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 13 Jun 2003 12:30:56 -0700 Subject: [Python-checkins] python/dist/src/Misc/RPM python-2.2.spec,1.1.2.4,1.1.2.5 Message-ID: Update of /cvsroot/python/python/dist/src/Misc/RPM In directory sc8-pr-cvs1:/tmp/cvs-serv5700 Modified Files: Tag: release22-maint python-2.2.spec Log Message: Install Sean's updated spec Index: python-2.2.spec =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/RPM/Attic/python-2.2.spec,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** python-2.2.spec 27 May 2003 14:36:02 -0000 1.1.2.4 --- python-2.2.spec 13 Jun 2003 19:30:53 -0000 1.1.2.5 *************** *** 316,319 **** --- 316,321 ---- %{__prefix}/lib/python%{libvers}/email %{__prefix}/lib/python%{libvers}/compiler + %{__prefix}/lib/python%{libvers}/lib-old + %{__prefix}/lib/python%{libvers}/hotshot %files devel From gvanrossum@users.sourceforge.net Fri Jun 13 21:34:29 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 13 Jun 2003 13:34:29 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts idle,NONE,1.1 README,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv19003 Modified Files: README Added Files: idle Log Message: Put the main script for the new IDLE here. --- NEW FILE: idle --- #! /usr/bin/env python from idlelib.PyShell import main main() Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/README,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** README 8 Jun 2003 23:04:16 -0000 1.13 --- README 13 Jun 2003 20:34:27 -0000 1.14 *************** *** 31,34 **** --- 31,35 ---- gprof2html.py Transform gprof(1) output into useful HTML. h2py.py Translate #define's into Python assignments + idle Main program to start IDLE ifdef.py Remove #if(n)def groups from C sources lfcr.py Change LF line endings to CRLF (Unix to Windows) From gvanrossum@users.sourceforge.net Fri Jun 13 21:35:43 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 13 Jun 2003 13:35:43 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.128,1.129 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv19304a Modified Files: Makefile.pre.in Log Message: Don't install Tools/idle any more. We now install Tools/scripts/idle from setup.py. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.128 retrieving revision 1.129 diff -C2 -d -r1.128 -r1.129 *** Makefile.pre.in 25 May 2003 22:01:31 -0000 1.128 --- Makefile.pre.in 13 Jun 2003 20:35:41 -0000 1.129 *************** *** 551,555 **** # Install everything ! install: altinstall bininstall maninstall idleinstall # Install almost everything without disturbing previous versions --- 551,555 ---- # Install everything ! install: altinstall bininstall maninstall # Install almost everything without disturbing previous versions *************** *** 870,885 **** DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \ srcdir=$(srcdir) builddir=. DESTDIR=$(DESTDIR) - - # This installs IDLE - idleinstall: - SRCDIR=$(srcdir) $(RUNSHARED) \ - ./$(BUILDPYTHON) $(srcdir)/Tools/idle/setup.py install \ - --check-tkinter \ - --prefix=$(prefix) \ - --install-purelib=$(LIBDEST) \ - --install-scripts=$(BINDIR) \ - --install-platlib=$(DESTSHARED) \ - --optimize=2 \ - --root=/$(DESTDIR) # This installs a few of the useful scripts in Tools/scripts --- 870,873 ---- From gvanrossum@users.sourceforge.net Fri Jun 13 21:35:13 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 13 Jun 2003 13:35:13 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.167,1.168 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv19151 Modified Files: setup.py Log Message: Install the main script for the new IDLE here. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.167 retrieving revision 1.168 diff -C2 -d -r1.167 -r1.168 *** setup.py 24 May 2003 20:21:50 -0000 1.167 --- setup.py 13 Jun 2003 20:35:11 -0000 1.168 *************** *** 1135,1139 **** # Scripts to install ! scripts = ['Tools/scripts/pydoc'] ) --- 1135,1139 ---- # Scripts to install ! scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle'] ) From gvanrossum@users.sourceforge.net Fri Jun 13 21:37:25 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 13 Jun 2003 13:37:25 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.779,1.780 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv19688 Modified Files: NEWS Log Message: News about the new IDLE (is more needed?). News about SF patch 751998. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.779 retrieving revision 1.780 diff -C2 -d -r1.779 -r1.780 *** NEWS 13 Jun 2003 19:28:47 -0000 1.779 --- NEWS 13 Jun 2003 20:37:23 -0000 1.780 *************** *** 13,16 **** --- 13,19 ---- ----------------- + - SF patch 751998 fixes an unwanted side effect of the previous fix + for SF bug 742860 (the next item). + - SF bug 742860: "WeakKeyDictionary __delitem__ uses iterkeys". This wasn't threadsafe, was very inefficient (expected time O(len(dict)) *************** *** 71,74 **** --- 74,81 ---- ------- + - A brand new version of IDLE (from the IDLEfork project at + SourceForge) is now included as Lib/idlelib. The old Tools/idle is + no more. + - copy.py: applied SF patch 707900, fixing bug 702858, by Steven Taschuk. Copying a new-style class that had a reference to itself *************** *** 100,103 **** --- 107,112 ---- Tools/Demos ----------- + + - Tools/idle is gone; long live Lib/idlelib. - diff.py is a new script for print file diffs in context, unified, or ndiff From gvanrossum@users.sourceforge.net Fri Jun 13 21:49:57 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 13 Jun 2003 13:49:57 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.129,1.130 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv21364 Modified Files: Makefile.pre.in Log Message: Install idlelib and idlelib/Icons as well. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.129 retrieving revision 1.130 diff -C2 -d -r1.129 -r1.130 *** Makefile.pre.in 13 Jun 2003 20:35:41 -0000 1.129 --- Makefile.pre.in 13 Jun 2003 20:49:55 -0000 1.130 *************** *** 645,649 **** LIBSUBDIRS= lib-old lib-tk site-packages test test/output test/data \ encodings email email/test email/test/data compiler hotshot \ ! logging bsddb bsddb/test csv \ distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS) libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR) --- 645,649 ---- LIBSUBDIRS= lib-old lib-tk site-packages test test/output test/data \ encodings email email/test email/test/data compiler hotshot \ ! logging bsddb bsddb/test csv idlelib idlelib/Icons \ distutils distutils/command $(XMLLIBSUBDIRS) curses $(MACHDEPS) libinstall: $(BUILDPYTHON) $(srcdir)/Lib/$(PLATDIR) From gvanrossum@users.sourceforge.net Fri Jun 13 21:54:42 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 13 Jun 2003 13:54:42 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.236,2.237 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv21979 Modified Files: typeobject.c Log Message: - SF patch 751998 fixes an unwanted side effect of the previous fix for SF bug 742860 (the next item). Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.236 retrieving revision 2.237 diff -C2 -d -r2.236 -r2.237 *** typeobject.c 11 Jun 2003 20:50:33 -0000 2.236 --- typeobject.c 13 Jun 2003 20:54:40 -0000 2.237 *************** *** 639,648 **** _PyObject_GC_TRACK(self); /* We'll untrack for real later */ ! /* Find the nearest base with a different tp_dealloc ! and clear slots while we're at it */ base = type; while ((basedealloc = base->tp_dealloc) == subtype_dealloc) { - if (base->ob_size) - clear_slots(base, self); base = base->tp_base; assert(base); --- 639,645 ---- _PyObject_GC_TRACK(self); /* We'll untrack for real later */ ! /* Find the nearest base with a different tp_dealloc */ base = type; while ((basedealloc = base->tp_dealloc) == subtype_dealloc) { base = base->tp_base; assert(base); *************** *** 650,654 **** /* If we added a weaklist, we clear it. Do this *before* calling ! the finalizer (__del__) or clearing the instance dict. */ if (type->tp_weaklistoffset && !base->tp_weaklistoffset) PyObject_ClearWeakRefs(self); --- 647,653 ---- /* If we added a weaklist, we clear it. Do this *before* calling ! the finalizer (__del__), clearing slots, or clearing the instance ! dict. */ ! if (type->tp_weaklistoffset && !base->tp_weaklistoffset) PyObject_ClearWeakRefs(self); *************** *** 659,662 **** --- 658,670 ---- if (self->ob_refcnt > 0) goto endlabel; + } + + /* Clear slots up to the nearest base with a different tp_dealloc */ + base = type; + while ((basedealloc = base->tp_dealloc) == subtype_dealloc) { + if (base->ob_size) + clear_slots(base, self); + base = base->tp_base; + assert(base); } From bwarsaw@users.sourceforge.net Fri Jun 13 22:16:08 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 13 Jun 2003 14:16:08 -0700 Subject: [Python-checkins] python/dist/src/Lib/email _parseaddr.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv25421 Modified Files: _parseaddr.py Log Message: AddressList.__str__(): Get rid of useless, and broken method. Closes SF #753617. Back port candidate (but low priority). Index: _parseaddr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/_parseaddr.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** _parseaddr.py 8 May 2003 03:33:15 -0000 1.6 --- _parseaddr.py 13 Jun 2003 21:16:06 -0000 1.7 *************** *** 442,448 **** return len(self.addresslist) - def __str__(self): - return COMMASPACE.join(map(dump_address_pair, self.addresslist)) - def __add__(self, other): # Set union --- 442,445 ---- From kbk@users.sourceforge.net Fri Jun 13 22:59:47 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Fri, 13 Jun 2003 14:59:47 -0700 Subject: [Python-checkins] python/dist/src/Modules threadmodule.c,2.54,2.55 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv31620 Modified Files: threadmodule.c Log Message: Add interrupt_main() to thread module. Index: threadmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/threadmodule.c,v retrieving revision 2.54 retrieving revision 2.55 diff -C2 -d -r2.54 -r2.55 *** threadmodule.c 29 Apr 2003 19:44:05 -0000 2.54 --- threadmodule.c 13 Jun 2003 21:59:45 -0000 2.55 *************** *** 279,282 **** --- 279,297 ---- thread to exit silently unless the exception is caught."); + static PyObject * + sys_interrupt_main(PyObject * self, PyObject * args) + { + PyErr_SetInterrupt(); + Py_INCREF(Py_None); + return Py_None; + } + + PyDoc_STRVAR(interrupt_doc, + "interrupt_main()\n\ + \n\ + Raise a KeyboardInterrupt in the main thread.\n\ + A subthread can use this method to interrupt the main thread." + ); + #ifndef NO_EXIT_PROG static PyObject * *************** *** 341,344 **** --- 356,361 ---- {"exit", (PyCFunction)thread_PyThread_exit_thread, METH_NOARGS, exit_doc}, + {"interrupt_main", (PyCFunction)sys_interrupt_main, + METH_NOARGS, interrupt_doc}, {"get_ident", (PyCFunction)thread_get_ident, METH_NOARGS, get_ident_doc}, From kbk@users.sourceforge.net Fri Jun 13 23:03:45 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Fri, 13 Jun 2003 15:03:45 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib run.py,1.22,1.23 interruptmodule.c,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv32053 Modified Files: run.py Removed Files: interruptmodule.c Log Message: Interrupt module has been folded into the thread module Modified Files: run.py Removed Files: interruptmodule.c Index: run.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/run.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** run.py 5 Jun 2003 23:51:29 -0000 1.22 --- run.py 13 Jun 2003 22:03:43 -0000 1.23 *************** *** 4,7 **** --- 4,8 ---- import socket import traceback + import thread import threading import Queue *************** *** 14,18 **** import StackViewer import rpc - import interrupt import __main__ --- 15,18 ---- *************** *** 190,194 **** global exit_now exit_now = True ! interrupt.interrupt_main() except: erf = sys.__stderr__ --- 190,194 ---- global exit_now exit_now = True ! thread.interrupt_main() except: erf = sys.__stderr__ *************** *** 224,228 **** global quitting quitting = True ! interrupt.interrupt_main() def decode_interrupthook(self): --- 224,228 ---- global quitting quitting = True ! thread.interrupt_main() def decode_interrupthook(self): *************** *** 230,234 **** global quitting quitting = True ! interrupt.interrupt_main() --- 230,234 ---- global quitting quitting = True ! thread.interrupt_main() *************** *** 257,261 **** def interrupt_the_server(self): ! interrupt.interrupt_main() def start_the_debugger(self, gui_adap_oid): --- 257,261 ---- def interrupt_the_server(self): ! thread.interrupt_main() def start_the_debugger(self, gui_adap_oid): --- interruptmodule.c DELETED --- From eprice@users.sourceforge.net Fri Jun 13 23:47:20 2003 From: eprice@users.sourceforge.net (eprice@users.sourceforge.net) Date: Fri, 13 Jun 2003 15:47:20 -0700 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1:/tmp/cvs-serv6523 Modified Files: Decimal.py Log Message: Update of the Decimal class for the new tests. Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Decimal.py 27 May 2003 22:46:40 -0000 1.8 --- Decimal.py 13 Jun 2003 22:47:18 -0000 1.9 *************** *** 813,817 **** if exp < other._exp - context.prec-1: exp = other._exp - context.prec-1 ! ans = other.rescale(Decimal(exp), watchexp=0, context=context) if shouldround: ans = ans.fix(context=context) --- 813,817 ---- if exp < other._exp - context.prec-1: exp = other._exp - context.prec-1 ! ans = other.rescale(exp, watchexp=0, context=context) if shouldround: ans = ans.fix(context=context) *************** *** 820,824 **** if exp < self._exp - context.prec-1: exp = self._exp - context.prec-1 ! ans = self.rescale(Decimal(exp), watchexp=0, context=context) if shouldround: ans = ans.fix(context=context) --- 820,824 ---- if exp < self._exp - context.prec-1: exp = self._exp - context.prec-1 ! ans = self.rescale(exp, watchexp=0, context=context) if shouldround: ans = ans.fix(context=context) *************** *** 1145,1149 **** exp = min(self._exp, other._exp) ! otherside = otherside.rescale(Decimal(exp), context=context, watchexp=0) context.regard_flags(*frozen) --- 1145,1149 ---- exp = min(self._exp, other._exp) ! otherside = otherside.rescale(exp, context=context, watchexp=0) context.regard_flags(*frozen) *************** *** 1184,1188 **** exp = min(self._exp, other._exp) ! otherside = otherside.rescale(Decimal(exp), context=context) context.regard_flags(*frozen) --- 1184,1188 ---- exp = min(self._exp, other._exp) ! otherside = otherside.rescale(exp, context=context) context.regard_flags(*frozen) *************** *** 1390,1394 **** context.raise_error(Clamped) return ans ! ans = ans.rescale(Decimal(Etiny), context=context) #It isn't zero, and exp < Emin => subnormal context.raise_error(Subnormal) --- 1390,1394 ---- context.raise_error(Clamped) return ans ! ans = ans.rescale(Etiny, context=context) #It isn't zero, and exp < Emin => subnormal context.raise_error(Subnormal) *************** *** 1401,1405 **** elif folddown and ans._exp > Etop: context.raise_error(Clamped) ! ans = ans.rescale(Decimal(Etop), context=context) elif ans.adjusted() > Emax: if not ans: --- 1401,1405 ---- elif folddown and ans._exp > Etop: context.raise_error(Clamped) ! ans = ans.rescale(Etop, context=context) elif ans.adjusted() > Emax: if not ans: *************** *** 1728,1735 **** return Decimal( (copy._sign, copy._int[:end], exp) ) def rescale(self, exp, rounding = None, context=None, watchexp = 1): """Rescales so that the exponent is exp. ! exp = exp to scale to rounding = rounding version watchexp: if set (default) an error is returned if exp is greater --- 1728,1747 ---- return Decimal( (copy._sign, copy._int[:end], exp) ) + + def quantize(self, exp, rounding = None, context=None, watchexp = 1): + """ + """ + ans = self._check_nans(exp, context) + if ans: + return ans + if exp._isinfinity(): + return context.raise_error(InvalidOperation, 'quantize with an INF') + return self.rescale(exp._exp, rounding, context, watchexp) + + def rescale(self, exp, rounding = None, context=None, watchexp = 1): """Rescales so that the exponent is exp. ! exp = exp to scale to (an integer) rounding = rounding version watchexp: if set (default) an error is returned if exp is greater *************** *** 1739,1746 **** context = getcontext() ! if self._isinfinity() or exp._isinfinity(): return context.raise_error(InvalidOperation, 'rescale with an INF') ! ans = self._check_nans(exp, context) if ans: return ans --- 1751,1758 ---- context = getcontext() ! if self._isinfinity(): return context.raise_error(InvalidOperation, 'rescale with an INF') ! ans = self._check_nans(context=context) if ans: return ans *************** *** 1748,1756 **** out = 0 ! if not exp.isinteger(): ! return context.raise_error(InvalidOperation, 'rescale(a, non-int)') ! ! exp = long(exp) ! if watchexp and (context.Emax < exp or context.Etiny() > exp): return context.raise_error(InvalidOperation, 'rescale(a, INF)') --- 1760,1764 ---- out = 0 ! if watchexp and (context.Emax < exp or context.Etiny() > exp): return context.raise_error(InvalidOperation, 'rescale(a, INF)') *************** *** 1786,1794 **** if context.flags[Inexact] or prevexact: context.raise_error(Underflow) return tmp def round_to_integer(self, rounding = None, context=None): """Rounds to the nearest integer.""" ! return self.rescale(Decimal(0), rounding, context=context) def sqrt(self, context=None): --- 1794,1804 ---- if context.flags[Inexact] or prevexact: context.raise_error(Underflow) + elif tmp and tmp.adjusted() > context.Emax: + return context.raise_error(InvalidOperation, 'rescale(a, INF)') return tmp def round_to_integer(self, rounding = None, context=None): """Rounds to the nearest integer.""" ! return self.rescale(0, rounding, context=context) def sqrt(self, context=None): *************** *** 1807,1814 **** if not self: #exponent = self._exp / 2, using round_down. ! if self._exp < 0: ! exp = (self._exp+1) // 2 ! else: ! exp = (self._exp) // 2 if self._sign == 1: #sqrt(-0) = -0 --- 1817,1824 ---- if not self: #exponent = self._exp / 2, using round_down. ! #if self._exp < 0: ! # exp = (self._exp+1) // 2 ! #else: ! exp = (self._exp) // 2 if self._sign == 1: #sqrt(-0) = -0 *************** *** 1900,1909 **** else: #Exact answer, so let's set the exponent right. ! if self._exp < 0: ! exp = (self._exp + 1)// 2 ! else: ! exp = self._exp // 2 context.prec += ans._exp - exp ! ans = ans.rescale(Decimal(exp), context=context) context.prec = firstprec context.regard_flags(flags) --- 1910,1919 ---- else: #Exact answer, so let's set the exponent right. ! #if self._exp < 0: ! # exp = (self._exp +1)// 2 ! #else: ! exp = self._exp // 2 context.prec += ans._exp - exp ! ans = ans.rescale(exp, context=context) context.prec = firstprec context.regard_flags(flags) *************** *** 2186,2189 **** --- 2196,2201 ---- def remaindernear(self, a, b): return a.remainder_near(b, context=self) + def quantize(self, a, b): + return a.rescale(b, context=self) def rescale(self, a, b): return a.rescale(b, context=self) *************** *** 2192,2198 **** def subtract(self, a, b): return a.__sub__(b, context=self) ! def toEng(self, a): return a.eng(context=self) ! def toSci(self, a): return a.sci(context=self) def trim(self, a): --- 2204,2210 ---- def subtract(self, a, b): return a.__sub__(b, context=self) ! def toeng(self, a): return a.eng(context=self) ! def tosci(self, a): return a.sci(context=self) def trim(self, a): From bcannon@users.sourceforge.net Sat Jun 14 00:44:37 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Fri, 13 Jun 2003 16:44:37 -0700 Subject: [Python-checkins] python/dist/src/Lib dummy_thread.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv14872/Lib Modified Files: dummy_thread.py Log Message: dummy_thread modified to have interrupt_main and to behave appropriately when called. Added announcement in Misc/NEWS for thread.interrupt_main and mention of dummy_thread's change. Index: dummy_thread.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/dummy_thread.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dummy_thread.py 29 Jan 2003 03:49:43 -0000 1.2 --- dummy_thread.py 13 Jun 2003 23:44:35 -0000 1.3 *************** *** 18,22 **** # (skipping obsolete synonyms allocate(), start_new(), exit_thread()) __all__ = ['error', 'start_new_thread', 'exit', 'get_ident', 'allocate_lock', ! 'LockType'] import traceback as _traceback --- 18,22 ---- # (skipping obsolete synonyms allocate(), start_new(), exit_thread()) __all__ = ['error', 'start_new_thread', 'exit', 'get_ident', 'allocate_lock', ! 'interrupt_main', 'LockType'] import traceback as _traceback *************** *** 37,40 **** --- 37,43 ---- by using traceback.print_exc(). + If the executed function calls interrupt_main the KeyboardInterrupt will be + raised when the function returns. + """ if type(args) != type(tuple()): *************** *** 48,51 **** --- 51,58 ---- except: _traceback.print_exc() + if _interrupt: + global _interrupt + _interrupt = False + raise KeyboardInterrupt def exit(): *************** *** 115,116 **** --- 122,132 ---- def locked(self): return self.locked_status + + + _interrupt = False + + def interrupt_main(): + """Set _interrupt flag to True to have start_new_thread raise + KeyboardInterrupt upon exiting.""" + global _interrupt + _interrupt = True From bcannon@users.sourceforge.net Sat Jun 14 00:44:37 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Fri, 13 Jun 2003 16:44:37 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_dummy_thread.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14872/Lib/test Modified Files: test_dummy_thread.py Log Message: dummy_thread modified to have interrupt_main and to behave appropriately when called. Added announcement in Misc/NEWS for thread.interrupt_main and mention of dummy_thread's change. Index: test_dummy_thread.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_dummy_thread.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_dummy_thread.py 1 May 2003 17:45:36 -0000 1.4 --- test_dummy_thread.py 13 Jun 2003 23:44:35 -0000 1.5 *************** *** 103,106 **** --- 103,114 ---- "returned by _thread.allocate_lock()") + def test_interrupt_main(self): + #Calling start_new_thread with a function that executes interrupt_main + # should raise KeyboardInterrupt upon completion. + def call_interrupt(): + _thread.interrupt_main() + self.failUnlessRaises(KeyboardInterrupt, _thread.start_new_thread, + call_interrupt, tuple()) + class ThreadTests(unittest.TestCase): """Test thread creation.""" From bcannon@users.sourceforge.net Sat Jun 14 00:44:38 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Fri, 13 Jun 2003 16:44:38 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.780,1.781 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv14872/Misc Modified Files: NEWS Log Message: dummy_thread modified to have interrupt_main and to behave appropriately when called. Added announcement in Misc/NEWS for thread.interrupt_main and mention of dummy_thread's change. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.780 retrieving revision 1.781 diff -C2 -d -r1.780 -r1.781 *** NEWS 13 Jun 2003 20:37:23 -0000 1.780 --- NEWS 13 Jun 2003 23:44:35 -0000 1.781 *************** *** 56,59 **** --- 56,62 ---- ----------------- + - thread.interrupt_main() raises KeyboardInterrupt in the main thread. + dummy_thread has also been modified to try to simulate the behavior. + - array.array.insert() now treats negative indices as being relative to the end of the array, just like list.insert() does. (SF bug #739313) From bcannon@users.sourceforge.net Sat Jun 14 00:56:34 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Fri, 13 Jun 2003 16:56:34 -0700 Subject: [Python-checkins] python/dist/src/Lib dummy_thread.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv17013/Lib Modified Files: dummy_thread.py Log Message: Cause calling interrupt_main in main thread raise KeyboardInterrupt instantly. Index: dummy_thread.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/dummy_thread.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dummy_thread.py 13 Jun 2003 23:44:35 -0000 1.3 --- dummy_thread.py 13 Jun 2003 23:56:32 -0000 1.4 *************** *** 45,48 **** --- 45,50 ---- if type(kwargs) != type(dict()): raise TypeError("3rd arg must be a dict") + global _main + _main = False try: function(*args, **kwargs) *************** *** 51,56 **** except: _traceback.print_exc() if _interrupt: - global _interrupt _interrupt = False raise KeyboardInterrupt --- 53,59 ---- except: _traceback.print_exc() + _main = True + global _interrupt if _interrupt: _interrupt = False raise KeyboardInterrupt *************** *** 123,132 **** return self.locked_status ! _interrupt = False def interrupt_main(): """Set _interrupt flag to True to have start_new_thread raise KeyboardInterrupt upon exiting.""" ! global _interrupt ! _interrupt = True --- 126,140 ---- return self.locked_status ! # Used to signal that interrupt_main was called in a "thread" _interrupt = False + # True when not executing in a "thread" + _main = True def interrupt_main(): """Set _interrupt flag to True to have start_new_thread raise KeyboardInterrupt upon exiting.""" ! if _main: ! raise KeyboardInterrupt ! else: ! global _interrupt ! _interrupt = True From bcannon@users.sourceforge.net Sat Jun 14 00:56:34 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Fri, 13 Jun 2003 16:56:34 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_dummy_thread.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv17013/Lib/test Modified Files: test_dummy_thread.py Log Message: Cause calling interrupt_main in main thread raise KeyboardInterrupt instantly. Index: test_dummy_thread.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_dummy_thread.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_dummy_thread.py 13 Jun 2003 23:44:35 -0000 1.5 --- test_dummy_thread.py 13 Jun 2003 23:56:32 -0000 1.6 *************** *** 110,113 **** --- 110,118 ---- self.failUnlessRaises(KeyboardInterrupt, _thread.start_new_thread, call_interrupt, tuple()) + + def test_interrupt_in_main(self): + # Make sure that if interrupt_main is called in main threat that + # KeyboardInterrupt is raised instantly. + self.failUnlessRaises(KeyboardInterrupt, _thread.interrupt_main) class ThreadTests(unittest.TestCase): From gvanrossum@users.sourceforge.net Sat Jun 14 01:08:38 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 13 Jun 2003 17:08:38 -0700 Subject: [Python-checkins] python/dist/src/Tools README,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Tools In directory sc8-pr-cvs1:/tmp/cvs-serv18575 Modified Files: README Log Message: Get rid of old IDLE. Lib/idlelib rules! Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/README,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** README 20 Sep 2001 15:27:30 -0000 1.10 --- README 14 Jun 2003 00:08:36 -0000 1.11 *************** *** 25,30 **** from a catalog in text format. - idle A Tkinter-based Python IDE. - modulator Interactively generate boiler plate for an extension module. Works easiest if you have Tk. --- 25,28 ---- From gvanrossum@users.sourceforge.net Sat Jun 14 01:08:39 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 13 Jun 2003 17:08:39 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle/Icons folder.gif,1.1,NONE minusnode.gif,1.3,NONE openfolder.gif,1.1,NONE plusnode.gif,1.1,NONE python.gif,1.2,NONE tk.gif,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle/Icons In directory sc8-pr-cvs1:/tmp/cvs-serv18575/idle/Icons Removed Files: folder.gif minusnode.gif openfolder.gif plusnode.gif python.gif tk.gif Log Message: Get rid of old IDLE. Lib/idlelib rules! --- folder.gif DELETED --- --- minusnode.gif DELETED --- --- openfolder.gif DELETED --- --- plusnode.gif DELETED --- --- python.gif DELETED --- --- tk.gif DELETED --- From gvanrossum@users.sourceforge.net Sat Jun 14 01:08:39 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 13 Jun 2003 17:08:39 -0700 Subject: [Python-checkins] python/dist/src/Tools/idle AutoExpand.py,1.5,NONE AutoIndent.py,1.22,NONE Bindings.py,1.16,NONE CallTipWindow.py,1.5,NONE CallTips.py,1.13,NONE ChangeLog,1.5,NONE ClassBrowser.py,1.16,NONE ColorDelegator.py,1.13,NONE Debugger.py,1.17,NONE Delegator.py,1.3,NONE EditorWindow.py,1.45,NONE FileList.py,1.9,NONE FormatParagraph.py,1.10,NONE FrameViewer.py,1.4,NONE GrepDialog.py,1.5,NONE IOBinding.py,1.11,NONE IdleConf.py,1.9,NONE IdleHistory.py,1.5,NONE MANIFEST.in,1.1,NONE MultiScrolledLists.py,1.5,NONE MultiStatusBar.py,1.2,NONE NEWS.txt,1.7,NONE ObjectBrowser.py,1.4,NONE OldStackViewer.py,1.4,NONE OutputWindow.py,1.7,NONE ParenMatch.py,1.6,NONE PathBrowser.py,1.6,NONE Percolator.py,1.3,NONE PyParse.py,1.10,NONE PyShell.py,1.41,NONE README.txt,1.9,NONE RemoteInterp.py,1.5,NONE ReplaceDialog.py,1.9,NONE ScriptBinding.py,1.13,NONE ScrolledList.py,1.5,NONE SearchBinding.py,1.9,NONE SearchDialog.py,1.3,NONE SearchDialogBase.py,1.3,NONE SearchEngine.py,1.3,NONE Separator.py,1.5,NONE StackViewer.py,1.17,NONE TODO.txt,1.15,NONE ToolTip.py,1.3,NONE TreeWidget.py,1.8,NONE UndoDelegator.py,1.5,NONE WidgetRedirector.py,1.3,NONE WindowList.py,1.8,NONE ZoomHeight.py,1.6,NONE __init__.py,1.1,NONE config-mac.txt,1.3,NONE config-unix.txt,1.5,NONE config-win.txt,1.4,NONE config.txt,1.5,NONE eventparse.py,1.5,NONE extend.txt,1.4,NONE help.txt,1.10,NONE idle,1.3,NONE idle.bat,1.3,NONE idle.py,1.4,NONE idle.pyw,1.3,NONE idlever.py,1.6,NONE keydefs.py,1.7,NONE setup.py,1.5,NONE testcode.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory sc8-pr-cvs1:/tmp/cvs-serv18575/idle Removed Files: AutoExpand.py AutoIndent.py Bindings.py CallTipWindow.py CallTips.py ChangeLog ClassBrowser.py ColorDelegator.py Debugger.py Delegator.py EditorWindow.py FileList.py FormatParagraph.py FrameViewer.py GrepDialog.py IOBinding.py IdleConf.py IdleHistory.py MANIFEST.in MultiScrolledLists.py MultiStatusBar.py NEWS.txt ObjectBrowser.py OldStackViewer.py OutputWindow.py ParenMatch.py PathBrowser.py Percolator.py PyParse.py PyShell.py README.txt RemoteInterp.py ReplaceDialog.py ScriptBinding.py ScrolledList.py SearchBinding.py SearchDialog.py SearchDialogBase.py SearchEngine.py Separator.py StackViewer.py TODO.txt ToolTip.py TreeWidget.py UndoDelegator.py WidgetRedirector.py WindowList.py ZoomHeight.py __init__.py config-mac.txt config-unix.txt config-win.txt config.txt eventparse.py extend.txt help.txt idle idle.bat idle.py idle.pyw idlever.py keydefs.py setup.py testcode.py Log Message: Get rid of old IDLE. Lib/idlelib rules! --- AutoExpand.py DELETED --- --- AutoIndent.py DELETED --- --- Bindings.py DELETED --- --- CallTipWindow.py DELETED --- --- CallTips.py DELETED --- --- ChangeLog DELETED --- --- ClassBrowser.py DELETED --- --- ColorDelegator.py DELETED --- --- Debugger.py DELETED --- --- Delegator.py DELETED --- --- EditorWindow.py DELETED --- --- FileList.py DELETED --- --- FormatParagraph.py DELETED --- --- FrameViewer.py DELETED --- --- GrepDialog.py DELETED --- --- IOBinding.py DELETED --- --- IdleConf.py DELETED --- --- IdleHistory.py DELETED --- --- MANIFEST.in DELETED --- --- MultiScrolledLists.py DELETED --- --- MultiStatusBar.py DELETED --- --- NEWS.txt DELETED --- --- ObjectBrowser.py DELETED --- --- OldStackViewer.py DELETED --- --- OutputWindow.py DELETED --- --- ParenMatch.py DELETED --- --- PathBrowser.py DELETED --- --- Percolator.py DELETED --- --- PyParse.py DELETED --- --- PyShell.py DELETED --- --- README.txt DELETED --- --- RemoteInterp.py DELETED --- --- ReplaceDialog.py DELETED --- --- ScriptBinding.py DELETED --- --- ScrolledList.py DELETED --- --- SearchBinding.py DELETED --- --- SearchDialog.py DELETED --- --- SearchDialogBase.py DELETED --- --- SearchEngine.py DELETED --- --- Separator.py DELETED --- --- StackViewer.py DELETED --- --- TODO.txt DELETED --- --- ToolTip.py DELETED --- --- TreeWidget.py DELETED --- --- UndoDelegator.py DELETED --- --- WidgetRedirector.py DELETED --- --- WindowList.py DELETED --- --- ZoomHeight.py DELETED --- --- __init__.py DELETED --- --- config-mac.txt DELETED --- --- config-unix.txt DELETED --- --- config-win.txt DELETED --- --- config.txt DELETED --- --- eventparse.py DELETED --- --- extend.txt DELETED --- --- help.txt DELETED --- --- idle DELETED --- --- idle.bat DELETED --- --- idle.py DELETED --- --- idle.pyw DELETED --- --- idlever.py DELETED --- --- keydefs.py DELETED --- --- setup.py DELETED --- --- testcode.py DELETED --- From gward@users.sourceforge.net Sat Jun 14 01:26:42 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Fri, 13 Jun 2003 17:26:42 -0700 Subject: [Python-checkins] python/dist/src/Lib textwrap.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv20402 Modified Files: textwrap.py Log Message: Remove comment about Unicode: SF #622831 was fixed loooong ago! Index: textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** textwrap.py 12 May 2003 20:19:36 -0000 1.30 --- textwrap.py 14 Jun 2003 00:26:39 -0000 1.31 *************** *** 6,12 **** # Written by Greg Ward - # XXX currently this module does not work very well with Unicode - # strings. See http://www.python.org/sf/622831 for updates. - __revision__ = "$Id$" --- 6,9 ---- From hitwc3d6c3@yahoo.com Sat Jun 14 03:36:43 2003 From: hitwc3d6c3@yahoo.com (Willa Wang) Date: Sat, 14 Jun 03 02:36:43 GMT Subject: [Python-checkins] Protect yourself_ and your loved ones from Drunk Driving kzu Message-ID: This is a multi-part message in MIME format. --.FB4.6.9DAD_D Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Mini-Keychain BREATHALYZER! A Must Have! A Fast, Reusable, Pocket-sized Alcohol Detection Device for Use Anywhere, Anytime Alcohol Consumption or Intoxication is a Concern. Don't Be a Victim of Drunk Driving! Makes a great personal item & gift. Almost everyone can use one, even if your a casual drinker. It even has a flashlight built in for added safety. These retail for $99 in stores. Our exclusive internet-offer allows us to sell the Mini-Breathalyzer for ONLY 39.95 !!! ***FREE*** Order Now and get a FREE Cable Descrambler ($70 Value) FREE PayPerViews, Porno, Special Events & More...DONT MISS THIS AMAZING LI= MITED TIME DEAL!! http://www.1ajdfhcy.com/cart/customer/product.php?productid=3D16153&partne= r=3Daffil21&r=3D9876 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D If you no longer wish to receive our offers and updates click below and we will promptly honor your request. http://www.1ajdfhcy.com/1/ lncenwaxequ --.FB4.6.9DAD_D-- From kbk@users.sourceforge.net Sat Jun 14 03:51:08 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Fri, 13 Jun 2003 19:51:08 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib NEWS.txt,1.19,1.20 HISTORY.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv3357 Modified Files: NEWS.txt HISTORY.txt Log Message: Update NEWS.txt and move info on release 0.8.1 and earlier to HISTORY.txt M HISTORY.txt M NEWS.txt Index: NEWS.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/NEWS.txt,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** NEWS.txt 1 Jun 2003 01:11:13 -0000 1.19 --- NEWS.txt 14 Jun 2003 02:51:05 -0000 1.20 *************** *** 1,10 **** ! +++++++++++++ ! IDLEfork NEWS ! +++++++++++++ What's New in IDLEfork 0.9b1? =================================== ! *Release date: XX-XXX-2003* - The current working directory of the execution environment (and shell --- 1,37 ---- ! What's New in IDLE 0.9b1+? ! =================================== ! ! *Release date: XX-XXX-2003* ! ! - (Created the .../Lib/idlelib directory in the Python CVS, which is a clone of ! IDLEfork modified to install in the Python environment. The code in the ! interrupt module has been moved to thread.interrupt_main(). ) ! ! - Printing the Shell window was failing if it was not saved first SF 748975 ! ! - When using the Search in Files dialog, if the user had a selection ! highlighted in his Editor window, insert it into the dialog search field. ! ! - The Python Shell entry was disappearing from the Windows menu. ! ! - Update the Windows file list when a file name change occurs ! ! - Change to File / Open Module: always pop up the dialog, using the current ! selection as the default value. This is easier to use habitually. ! ! - Avoided a problem with starting the subprocess when 'localhost' doesn't ! resolve to the user's loopback interface. SF 747772 ! ! - Fixed an issue with highlighted errors never de-colorizing. SF 747677. Also ! improved notification of Tabnanny Token Error. ! ! - File / New will by default save in the directory of the Edit window from ! which it was initiated. SF 748973 Guido van Rossum patch. ! What's New in IDLEfork 0.9b1? =================================== ! *Release date: 02-Jun-2003* - The current working directory of the execution environment (and shell *************** *** 238,358 **** to inspect the environment of code Run from an Edit window. Files removed: ExecBinding.py, loader.py, protocol.py, Remote.py, spawn.py - - - - What's New in IDLEfork 0.8.1? - ============================= - - *Release date: 22-Jul-2001* - - - New tarball released as a result of the 'revitalisation' of the IDLEfork - project. - - - This release requires python 2.1 or better. Compatability with earlier - versions of python (especially ancient ones like 1.5x) is no longer a - priority in IDLEfork development. - - - This release is based on a merging of the earlier IDLE fork work with current - cvs IDLE (post IDLE version 0.8), with some minor additional coding by Kurt - B. Kaiser and Stephen M. Gava. - - - This release is basically functional but also contains some known breakages, - particularly with running things from the shell window. Also the debugger is - not working, but I believe this was the case with the previous IDLE fork - release (0.7.1) as well. - - - This release is being made now to mark the point at which IDLEfork is - launching into a new stage of development. - - - IDLEfork CVS will now be branched to enable further development and - exploration of the two "execution in a remote process" patches submitted by - David Scherer (David's is currently in IDLEfork) and GvR, while stabilisation - and development of less heavyweight improvements (like user customisation) - can continue on the trunk. - - - What's New in IDLE fork 0.7.1? - ============================== - - *Release date: 15-Aug-2000* - - - First project tarball released. - - - This was the first release of IDLE fork, which at this stage was a - combination of IDLE 0.5 and the VPython idle fork, with additional changes - coded by David Scherer, Peter Schneider-Kamp and Nicholas Riley. - - - - IDLE fork 0.7.1 - 29 May 2000 - ----------------------------- - - David Scherer - - - This is a modification of the CVS version of IDLE 0.5, updated as of - 2000-03-09. It is alpha software and might be unstable. If it breaks, you - get to keep both pieces. - - - If you have problems or suggestions, you should either contact me or post to - the list at http://www.python.org/mailman/listinfo/idle-dev (making it clear - that you are using this modified version of IDLE). - - - Changes: - - - The ExecBinding module, a replacement for ScriptBinding, executes programs - in a separate process, piping standard I/O through an RPC mechanism to an - OnDemandOutputWindow in IDLE. It supports executing unnamed programs - (through a temporary file). It does not yet support debugging. - - - When running programs with ExecBinding, tracebacks will be clipped to - exclude system modules. If, however, a system module calls back into the - user program, that part of the traceback will be shown. - - - The OnDemandOutputWindow class has been improved. In particular, it now - supports a readline() function used to implement user input, and a - scroll_clear() operation which is used to hide the output of a previous run - by scrolling it out of the window. - - - Startup behavior has been changed. By default IDLE starts up with just a - blank editor window, rather than an interactive window. Opening a file in - such a blank window replaces the (nonexistent) contents of that window - instead of creating another window. Because of the need to have a - well-known port for the ExecBinding protocol, only one copy of IDLE can be - running. Additional invocations use the RPC mechanism to report their - command line arguments to the copy already running. - - - The menus have been reorganized. In particular, the excessively large - 'edit' menu has been split up into 'edit', 'format', and 'run'. - - - 'Python Documentation' now works on Windows, if the win32api module is - present. - - - A few key bindings have been changed: F1 now loads Python Documentation - instead of the IDLE help; shift-TAB is now a synonym for unindent. - - - New modules: - - ExecBinding.py Executes program through loader - loader.py Bootstraps user program - protocol.py RPC protocol - Remote.py User-process interpreter - spawn.py OS-specific code to start programs - - - Files modified: - - autoindent.py ( bindings tweaked ) - bindings.py ( menus reorganized ) - config.txt ( execbinding enabled ) - editorwindow.py ( new menus, fixed 'Python Documentation' ) - filelist.py ( hook for "open in same window" ) - formatparagraph.py ( bindings tweaked ) - idle.bat ( removed absolute pathname ) - idle.pyw ( weird bug due to import with same name? ) - iobinding.py ( open in same window, EOL convention ) - keydefs.py ( bindings tweaked ) - outputwindow.py ( readline, scroll_clear, etc ) - pyshell.py ( changed startup behavior ) - readme.txt ( ) - -------------------------------------------------------------------- --- 265,268 ---- Index: HISTORY.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/HISTORY.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** HISTORY.txt 10 Jan 2003 21:27:22 -0000 1.2 --- HISTORY.txt 14 Jun 2003 02:51:06 -0000 1.3 *************** *** 6,9 **** --- 6,125 ---- + What's New in IDLEfork 0.8.1? + ============================= + + *Release date: 22-Jul-2001* + + - New tarball released as a result of the 'revitalisation' of the IDLEfork + project. + + - This release requires python 2.1 or better. Compatability with earlier + versions of python (especially ancient ones like 1.5x) is no longer a + priority in IDLEfork development. + + - This release is based on a merging of the earlier IDLE fork work with current + cvs IDLE (post IDLE version 0.8), with some minor additional coding by Kurt + B. Kaiser and Stephen M. Gava. + + - This release is basically functional but also contains some known breakages, + particularly with running things from the shell window. Also the debugger is + not working, but I believe this was the case with the previous IDLE fork + release (0.7.1) as well. + + - This release is being made now to mark the point at which IDLEfork is + launching into a new stage of development. + + - IDLEfork CVS will now be branched to enable further development and + exploration of the two "execution in a remote process" patches submitted by + David Scherer (David's is currently in IDLEfork) and GvR, while stabilisation + and development of less heavyweight improvements (like user customisation) + can continue on the trunk. + + + What's New in IDLEfork 0.7.1? + ============================== + + *Release date: 15-Aug-2000* + + - First project tarball released. + + - This was the first release of IDLE fork, which at this stage was a + combination of IDLE 0.5 and the VPython idle fork, with additional changes + coded by David Scherer, Peter Schneider-Kamp and Nicholas Riley. + + + + IDLEfork 0.7.1 - 29 May 2000 + ----------------------------- + + David Scherer + + - This is a modification of the CVS version of IDLE 0.5, updated as of + 2000-03-09. It is alpha software and might be unstable. If it breaks, you + get to keep both pieces. + + - If you have problems or suggestions, you should either contact me or post to + the list at http://www.python.org/mailman/listinfo/idle-dev (making it clear + that you are using this modified version of IDLE). + + - Changes: + + - The ExecBinding module, a replacement for ScriptBinding, executes programs + in a separate process, piping standard I/O through an RPC mechanism to an + OnDemandOutputWindow in IDLE. It supports executing unnamed programs + (through a temporary file). It does not yet support debugging. + + - When running programs with ExecBinding, tracebacks will be clipped to + exclude system modules. If, however, a system module calls back into the + user program, that part of the traceback will be shown. + + - The OnDemandOutputWindow class has been improved. In particular, it now + supports a readline() function used to implement user input, and a + scroll_clear() operation which is used to hide the output of a previous run + by scrolling it out of the window. + + - Startup behavior has been changed. By default IDLE starts up with just a + blank editor window, rather than an interactive window. Opening a file in + such a blank window replaces the (nonexistent) contents of that window + instead of creating another window. Because of the need to have a + well-known port for the ExecBinding protocol, only one copy of IDLE can be + running. Additional invocations use the RPC mechanism to report their + command line arguments to the copy already running. + + - The menus have been reorganized. In particular, the excessively large + 'edit' menu has been split up into 'edit', 'format', and 'run'. + + - 'Python Documentation' now works on Windows, if the win32api module is + present. + + - A few key bindings have been changed: F1 now loads Python Documentation + instead of the IDLE help; shift-TAB is now a synonym for unindent. + + - New modules: + + ExecBinding.py Executes program through loader + loader.py Bootstraps user program + protocol.py RPC protocol + Remote.py User-process interpreter + spawn.py OS-specific code to start programs + + - Files modified: + + autoindent.py ( bindings tweaked ) + bindings.py ( menus reorganized ) + config.txt ( execbinding enabled ) + editorwindow.py ( new menus, fixed 'Python Documentation' ) + filelist.py ( hook for "open in same window" ) + formatparagraph.py ( bindings tweaked ) + idle.bat ( removed absolute pathname ) + idle.pyw ( weird bug due to import with same name? ) + iobinding.py ( open in same window, EOL convention ) + keydefs.py ( bindings tweaked ) + outputwindow.py ( readline, scroll_clear, etc ) + pyshell.py ( changed startup behavior ) + readme.txt ( ) + + + IDLE 0.5 - February 2000 - Release Notes ---------------------------------------- From kbk@users.sourceforge.net Sat Jun 14 04:23:58 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Fri, 13 Jun 2003 20:23:58 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib PyShell.py,1.74,1.75 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv6520 Modified Files: PyShell.py Log Message: Remove reference to IDLEfork Index: PyShell.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/PyShell.py,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** PyShell.py 5 Jun 2003 23:51:28 -0000 1.74 --- PyShell.py 14 Jun 2003 03:23:56 -0000 1.75 *************** *** 871,875 **** else: nosub = "==== No Subprocess ====" ! self.write("Python %s on %s\n%s\nIDLEfork %s %s\n" % (sys.version, sys.platform, self.COPYRIGHT, idlever.IDLE_VERSION, nosub)) --- 871,875 ---- else: nosub = "==== No Subprocess ====" ! self.write("Python %s on %s\n%s\nIDLE %s %s\n" % (sys.version, sys.platform, self.COPYRIGHT, idlever.IDLE_VERSION, nosub)) From kbk@users.sourceforge.net Sat Jun 14 04:33:22 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Fri, 13 Jun 2003 20:33:22 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib PyShell.py,1.75,1.76 run.py,1.23,1.24 boolcheck.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv7264 Modified Files: PyShell.py run.py Removed Files: boolcheck.py Log Message: Remove the 2.2 compatibility module boolcheck.py and related code M PyShell.py R boolcheck.py M run.py Index: PyShell.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/PyShell.py,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** PyShell.py 14 Jun 2003 03:23:56 -0000 1.75 --- PyShell.py 14 Jun 2003 03:33:20 -0000 1.76 *************** *** 20,26 **** import tkMessageBox - # Preserve 2.2 compatibility for Mac OS X: - import boolcheck - from EditorWindow import EditorWindow, fixwordbreaks from FileList import FileList --- 20,23 ---- Index: run.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/run.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** run.py 13 Jun 2003 22:03:43 -0000 1.23 --- run.py 14 Jun 2003 03:33:20 -0000 1.24 *************** *** 8,13 **** import Queue - import boolcheck - import CallTips import RemoteDebugger --- 8,11 ---- --- boolcheck.py DELETED --- From loewis@users.sourceforge.net Sat Jun 14 06:29:29 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 13 Jun 2003 22:29:29 -0700 Subject: [Python-checkins] python/dist/src README,1.173,1.174 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv17915 Modified Files: README Log Message: Patch #753845: Update README for Redhat 9 Tkinter compile with USC-4. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.173 retrieving revision 1.174 diff -C2 -d -r1.173 -r1.174 *** README 12 Jun 2003 14:04:33 -0000 1.173 --- README 14 Jun 2003 05:29:27 -0000 1.174 *************** *** 319,324 **** takes care of this automatically. ! Red Hat Linux: There's an executable /usr/bin/python which is Python ! 1.5.2 on most Red Hat installations; several key Red Hat tools require this version. Python 2.1.x may be installed as /usr/bin/python2. The Makefile installs Python as --- 319,328 ---- takes care of this automatically. ! Red Hat Linux: Red Hat 9 built Python2.2 in UCS-4 mode and hacked ! Tcl to support it. To compile Python2.3 with Tkinter, you will ! need to pass --enable-unicode=ucs4 flag to ./configure. ! ! There's an executable /usr/bin/python which is Python ! 1.5.2 on most older Red Hat installations; several key Red Hat tools require this version. Python 2.1.x may be installed as /usr/bin/python2. The Makefile installs Python as From loewis@users.sourceforge.net Sat Jun 14 06:32:16 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 13 Jun 2003 22:32:16 -0700 Subject: [Python-checkins] python/nondist/peps pep-0251.txt,1.11,1.12 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv18405 Modified Files: pep-0251.txt Log Message: Patch #754004: Fix release year for 2.2a3. Index: pep-0251.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0251.txt,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pep-0251.txt 18 Apr 2002 20:08:17 -0000 1.11 --- pep-0251.txt 14 Jun 2003 05:32:14 -0000 1.12 *************** *** 31,35 **** 19-Oct-2001: 2.2b1 [Released] 28-Sep-2001: 2.2a4 [Released] ! 7-Sep-1001: 2.2a3 [Released] 22-Aug-2001: 2.2a2 [Released] 18-Jul-2001: 2.2a1 [Released] --- 31,35 ---- 19-Oct-2001: 2.2b1 [Released] 28-Sep-2001: 2.2a4 [Released] ! 7-Sep-2001: 2.2a3 [Released] 22-Aug-2001: 2.2a2 [Released] 18-Jul-2001: 2.2a1 [Released] From loewis@users.sourceforge.net Sat Jun 14 06:51:28 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 13 Jun 2003 22:51:28 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.48,1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv19830 Modified Files: urllib2.py Log Message: Patch #754340: Fix typo in redirect_request. Will backport to 2.2. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** urllib2.py 7 Jun 2003 17:53:07 -0000 1.48 --- urllib2.py 14 Jun 2003 05:51:25 -0000 1.49 *************** *** 439,443 **** return Request(newurl, headers=req.headers) else: ! raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) # Implementation note: To avoid the server sending us into an --- 439,443 ---- return Request(newurl, headers=req.headers) else: ! raise HTTPError(req.get_full_url(), code, msg, headers, fp) # Implementation note: To avoid the server sending us into an From loewis@users.sourceforge.net Sat Jun 14 06:52:29 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 13 Jun 2003 22:52:29 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.24.8.7,1.24.8.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv19931 Modified Files: Tag: release22-maint urllib2.py Log Message: Patch #754340: Fix typo in redirect_request. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.24.8.7 retrieving revision 1.24.8.8 diff -C2 -d -r1.24.8.7 -r1.24.8.8 *** urllib2.py 22 May 2003 17:30:48 -0000 1.24.8.7 --- urllib2.py 14 Jun 2003 05:52:27 -0000 1.24.8.8 *************** *** 427,431 **** return Request(newurl, headers=req.headers) else: ! raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) # Implementation note: To avoid the server sending us into an --- 427,431 ---- return Request(newurl, headers=req.headers) else: ! raise HTTPError(req.get_full_url(), code, msg, headers, fp) # Implementation note: To avoid the server sending us into an From loewis@users.sourceforge.net Sat Jun 14 07:58:34 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 13 Jun 2003 23:58:34 -0700 Subject: [Python-checkins] python/dist/src install-sh,2.4,2.5 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv25729 Modified Files: install-sh Log Message: Patch #746366: Update to current automake install-sh. Will backport to 2.2. Index: install-sh =================================================================== RCS file: /cvsroot/python/python/dist/src/install-sh,v retrieving revision 2.4 retrieving revision 2.5 diff -C2 -d -r2.4 -r2.5 *** install-sh 10 Feb 2001 20:04:53 -0000 2.4 --- install-sh 14 Jun 2003 06:58:32 -0000 2.5 *************** *** 2,18 **** # # install - install a program, script, or datafile - # This comes from X11R5 (mit/util/scripts/install.sh). # ! # Copyright 1991 by the Massachusetts Institute of Technology # ! # Permission to use, copy, modify, distribute, and sell this software and its ! # documentation for any purpose is hereby granted without fee, provided that ! # the above copyright notice appear in all copies and that both that ! # copyright notice and this permission notice appear in supporting ! # documentation, and that the name of M.I.T. not be used in advertising or ! # publicity pertaining to distribution of the software without specific, ! # written prior permission. M.I.T. makes no representations about the ! # suitability of this software for any purpose. It is provided "as is" ! # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent --- 2,36 ---- # # install - install a program, script, or datafile # ! # This originates from X11R5 (mit/util/scripts/install.sh), which was ! # later released in X11R6 (xc/config/util/install.sh) with the ! # following copyright and license. # ! # Copyright (C) 1994 X Consortium ! # ! # Permission is hereby granted, free of charge, to any person obtaining a copy ! # of this software and associated documentation files (the "Software"), to ! # deal in the Software without restriction, including without limitation the ! # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or ! # sell copies of the Software, and to permit persons to whom the Software is ! # furnished to do so, subject to the following conditions: ! # ! # The above copyright notice and this permission notice shall be included in ! # all copies or substantial portions of the Software. ! # ! # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ! # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ! # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ! # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN ! # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- ! # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ! # ! # Except as contained in this notice, the name of the X Consortium shall not ! # be used in advertising or otherwise to promote the sale, use or other deal- ! # ings in this Software without prior written authorization from the X Consor- ! # tium. ! # ! # ! # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent *************** *** 57,61 **** while [ x"$1" != x ]; do case $1 in ! -c) instcmd="$cpprog" shift continue;; --- 75,79 ---- while [ x"$1" != x ]; do case $1 in ! -c) instcmd=$cpprog shift continue;; *************** *** 80,84 **** continue;; ! -s) stripcmd="$stripprog" shift continue;; --- 98,102 ---- continue;; ! -s) stripcmd=$stripprog shift continue;; *************** *** 107,114 **** if [ x"$src" = x ] then ! echo "install: no input file specified" exit 1 else ! true fi --- 125,132 ---- if [ x"$src" = x ] then ! echo "$0: no input file specified" >&2 exit 1 else ! : fi *************** *** 116,146 **** dst=$src src="" ! ! if [ -d $dst ]; then instcmd=: chmodcmd="" else ! instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command ! # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. ! if [ -f $src -o -d $src ] then ! true else ! echo "install: $src does not exist" exit 1 fi ! if [ x"$dst" = x ] then ! echo "install: no destination specified" exit 1 else ! true fi --- 134,164 ---- dst=$src src="" ! ! if [ -d "$dst" ]; then instcmd=: chmodcmd="" else ! instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command ! # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. ! if [ -f "$src" ] || [ -d "$src" ] then ! : else ! echo "$0: $src does not exist" >&2 exit 1 fi ! if [ x"$dst" = x ] then ! echo "$0: no destination specified" >&2 exit 1 else ! : fi *************** *** 148,161 **** # does not like double slashes in filenames, you may need to add some logic ! if [ -d $dst ] then ! dst="$dst"/`basename $src` else ! true fi fi ## this sed command emulates the dirname command ! dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. --- 166,179 ---- # does not like double slashes in filenames, you may need to add some logic ! if [ -d "$dst" ] then ! dst=$dst/`basename "$src"` else ! : fi fi ## this sed command emulates the dirname command ! dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. *************** *** 164,191 **** # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then ! defaultIFS=' ! ' ! IFS="${IFS-${defaultIFS}}" ! oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' ! set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` ! IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do ! pathcomp="${pathcomp}${1}" shift ! if [ ! -d "${pathcomp}" ] ; then ! $mkdirprog "${pathcomp}" else ! true fi ! pathcomp="${pathcomp}/" done fi --- 182,209 ---- # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then ! defaultIFS=' ! ' ! IFS="${IFS-$defaultIFS}" ! oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' ! set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` ! IFS=$oIFS pathcomp='' while [ $# -ne 0 ] ; do ! pathcomp=$pathcomp$1 shift ! if [ ! -d "$pathcomp" ] ; then ! $mkdirprog "$pathcomp" else ! : fi ! pathcomp=$pathcomp/ done fi *************** *** 193,211 **** if [ x"$dir_arg" != x ] then ! $doit $instcmd $dst && ! if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && ! if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && ! if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && ! if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. ! if [ x"$transformarg" = x ] then ! dstfile=`basename $dst` else ! dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi --- 211,229 ---- if [ x"$dir_arg" != x ] then ! $doit $instcmd "$dst" && ! if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && ! if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && ! if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && ! if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi else # If we're going to rename the final executable, determine the name now. ! if [ x"$transformarg" = x ] then ! dstfile=`basename "$dst"` else ! dstfile=`basename "$dst" $transformbasename | sed $transformarg`$transformbasename fi *************** *** 213,232 **** # don't allow the sed command to completely eliminate the filename ! if [ x"$dstfile" = x ] then ! dstfile=`basename $dst` else ! true fi ! # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# ! # Move or copy the file name to the temp name ! $doit $instcmd $src $dsttmp && ! trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits --- 231,254 ---- # don't allow the sed command to completely eliminate the filename ! if [ x"$dstfile" = x ] then ! dstfile=`basename "$dst"` else ! : fi ! # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/#inst.$$# + rmtmp=$dstdir/#rm.$$# ! # Trap to clean up temp files at exit. ! trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 ! trap '(exit $?); exit' 1 2 13 15 ! # Move or copy the file name to the temp name ! ! $doit $instcmd "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits *************** *** 236,251 **** # errors from the above "$doit $instcmd $src $dsttmp" command. ! if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && ! if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && ! if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && ! if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. ! $doit $rmcmd -f $dstdir/$dstfile && ! $doit $mvcmd $dsttmp $dstdir/$dstfile fi && ! exit 0 --- 258,294 ---- # errors from the above "$doit $instcmd $src $dsttmp" command. ! if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && ! if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && ! if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && ! if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && ! ! # Now remove or move aside any old file at destination location. We try this ! # two ways since rm can't unlink itself on some systems and the destination ! # file might be busy for other reasons. In this case, the final cleanup ! # might fail but the new file should still install successfully. ! ! { ! if [ -f "$dstdir/$dstfile" ] ! then ! $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || ! $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || ! { ! echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 ! (exit 1); exit ! } ! else ! : ! fi ! } && # Now rename the file to the real destination. ! $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" fi && + # The final little trick to "correctly" pass the exit status to the exit trap. ! { ! (exit 0); exit ! } From loewis@users.sourceforge.net Sat Jun 14 07:59:05 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 13 Jun 2003 23:59:05 -0700 Subject: [Python-checkins] python/dist/src install-sh,2.4,2.4.24.1 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv25828 Modified Files: Tag: release22-maint install-sh Log Message: Patch #746366: Update to current automake install-sh. Index: install-sh =================================================================== RCS file: /cvsroot/python/python/dist/src/install-sh,v retrieving revision 2.4 retrieving revision 2.4.24.1 diff -C2 -d -r2.4 -r2.4.24.1 *** install-sh 10 Feb 2001 20:04:53 -0000 2.4 --- install-sh 14 Jun 2003 06:59:02 -0000 2.4.24.1 *************** *** 2,18 **** # # install - install a program, script, or datafile - # This comes from X11R5 (mit/util/scripts/install.sh). # ! # Copyright 1991 by the Massachusetts Institute of Technology # ! # Permission to use, copy, modify, distribute, and sell this software and its ! # documentation for any purpose is hereby granted without fee, provided that ! # the above copyright notice appear in all copies and that both that ! # copyright notice and this permission notice appear in supporting ! # documentation, and that the name of M.I.T. not be used in advertising or ! # publicity pertaining to distribution of the software without specific, ! # written prior permission. M.I.T. makes no representations about the ! # suitability of this software for any purpose. It is provided "as is" ! # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent --- 2,36 ---- # # install - install a program, script, or datafile # ! # This originates from X11R5 (mit/util/scripts/install.sh), which was ! # later released in X11R6 (xc/config/util/install.sh) with the ! # following copyright and license. # ! # Copyright (C) 1994 X Consortium ! # ! # Permission is hereby granted, free of charge, to any person obtaining a copy ! # of this software and associated documentation files (the "Software"), to ! # deal in the Software without restriction, including without limitation the ! # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or ! # sell copies of the Software, and to permit persons to whom the Software is ! # furnished to do so, subject to the following conditions: ! # ! # The above copyright notice and this permission notice shall be included in ! # all copies or substantial portions of the Software. ! # ! # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ! # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ! # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ! # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN ! # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- ! # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ! # ! # Except as contained in this notice, the name of the X Consortium shall not ! # be used in advertising or otherwise to promote the sale, use or other deal- ! # ings in this Software without prior written authorization from the X Consor- ! # tium. ! # ! # ! # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent *************** *** 57,61 **** while [ x"$1" != x ]; do case $1 in ! -c) instcmd="$cpprog" shift continue;; --- 75,79 ---- while [ x"$1" != x ]; do case $1 in ! -c) instcmd=$cpprog shift continue;; *************** *** 80,84 **** continue;; ! -s) stripcmd="$stripprog" shift continue;; --- 98,102 ---- continue;; ! -s) stripcmd=$stripprog shift continue;; *************** *** 107,114 **** if [ x"$src" = x ] then ! echo "install: no input file specified" exit 1 else ! true fi --- 125,132 ---- if [ x"$src" = x ] then ! echo "$0: no input file specified" >&2 exit 1 else ! : fi *************** *** 116,146 **** dst=$src src="" ! ! if [ -d $dst ]; then instcmd=: chmodcmd="" else ! instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command ! # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. ! if [ -f $src -o -d $src ] then ! true else ! echo "install: $src does not exist" exit 1 fi ! if [ x"$dst" = x ] then ! echo "install: no destination specified" exit 1 else ! true fi --- 134,164 ---- dst=$src src="" ! ! if [ -d "$dst" ]; then instcmd=: chmodcmd="" else ! instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command ! # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. ! if [ -f "$src" ] || [ -d "$src" ] then ! : else ! echo "$0: $src does not exist" >&2 exit 1 fi ! if [ x"$dst" = x ] then ! echo "$0: no destination specified" >&2 exit 1 else ! : fi *************** *** 148,161 **** # does not like double slashes in filenames, you may need to add some logic ! if [ -d $dst ] then ! dst="$dst"/`basename $src` else ! true fi fi ## this sed command emulates the dirname command ! dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. --- 166,179 ---- # does not like double slashes in filenames, you may need to add some logic ! if [ -d "$dst" ] then ! dst=$dst/`basename "$src"` else ! : fi fi ## this sed command emulates the dirname command ! dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. *************** *** 164,191 **** # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then ! defaultIFS=' ! ' ! IFS="${IFS-${defaultIFS}}" ! oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' ! set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` ! IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do ! pathcomp="${pathcomp}${1}" shift ! if [ ! -d "${pathcomp}" ] ; then ! $mkdirprog "${pathcomp}" else ! true fi ! pathcomp="${pathcomp}/" done fi --- 182,209 ---- # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then ! defaultIFS=' ! ' ! IFS="${IFS-$defaultIFS}" ! oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' ! set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` ! IFS=$oIFS pathcomp='' while [ $# -ne 0 ] ; do ! pathcomp=$pathcomp$1 shift ! if [ ! -d "$pathcomp" ] ; then ! $mkdirprog "$pathcomp" else ! : fi ! pathcomp=$pathcomp/ done fi *************** *** 193,211 **** if [ x"$dir_arg" != x ] then ! $doit $instcmd $dst && ! if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && ! if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && ! if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && ! if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. ! if [ x"$transformarg" = x ] then ! dstfile=`basename $dst` else ! dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi --- 211,229 ---- if [ x"$dir_arg" != x ] then ! $doit $instcmd "$dst" && ! if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && ! if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && ! if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && ! if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi else # If we're going to rename the final executable, determine the name now. ! if [ x"$transformarg" = x ] then ! dstfile=`basename "$dst"` else ! dstfile=`basename "$dst" $transformbasename | sed $transformarg`$transformbasename fi *************** *** 213,232 **** # don't allow the sed command to completely eliminate the filename ! if [ x"$dstfile" = x ] then ! dstfile=`basename $dst` else ! true fi ! # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# ! # Move or copy the file name to the temp name ! $doit $instcmd $src $dsttmp && ! trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits --- 231,254 ---- # don't allow the sed command to completely eliminate the filename ! if [ x"$dstfile" = x ] then ! dstfile=`basename "$dst"` else ! : fi ! # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/#inst.$$# + rmtmp=$dstdir/#rm.$$# ! # Trap to clean up temp files at exit. ! trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 ! trap '(exit $?); exit' 1 2 13 15 ! # Move or copy the file name to the temp name ! ! $doit $instcmd "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits *************** *** 236,251 **** # errors from the above "$doit $instcmd $src $dsttmp" command. ! if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && ! if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && ! if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && ! if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. ! $doit $rmcmd -f $dstdir/$dstfile && ! $doit $mvcmd $dsttmp $dstdir/$dstfile fi && ! exit 0 --- 258,294 ---- # errors from the above "$doit $instcmd $src $dsttmp" command. ! if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && ! if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && ! if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && ! if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && ! ! # Now remove or move aside any old file at destination location. We try this ! # two ways since rm can't unlink itself on some systems and the destination ! # file might be busy for other reasons. In this case, the final cleanup ! # might fail but the new file should still install successfully. ! ! { ! if [ -f "$dstdir/$dstfile" ] ! then ! $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || ! $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || ! { ! echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 ! (exit 1); exit ! } ! else ! : ! fi ! } && # Now rename the file to the real destination. ! $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" fi && + # The final little trick to "correctly" pass the exit status to the exit trap. ! { ! (exit 0); exit ! } From loewis@users.sourceforge.net Sat Jun 14 08:10:08 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 00:10:08 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_copy.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv26989/Lib/test Modified Files: test_copy.py Log Message: Copy builtin functions as atomic. Fixes #746304. Will backport to 2.2. Index: test_copy.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_copy.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_copy.py 13 Jun 2003 19:26:29 -0000 1.10 --- test_copy.py 14 Jun 2003 07:10:06 -0000 1.11 *************** *** 85,89 **** tests = [None, 42, 2L**100, 3.14, True, False, 1j, "hello", u"hello\u1234", f.func_code, ! NewStyle, xrange(10), Classic] for x in tests: self.assert_(copy.copy(x) is x, `x`) --- 85,89 ---- tests = [None, 42, 2L**100, 3.14, True, False, 1j, "hello", u"hello\u1234", f.func_code, ! NewStyle, xrange(10), Classic, max] for x in tests: self.assert_(copy.copy(x) is x, `x`) *************** *** 258,262 **** tests = [None, 42, 2L**100, 3.14, True, False, 1j, "hello", u"hello\u1234", f.func_code, ! NewStyle, xrange(10), Classic] for x in tests: self.assert_(copy.deepcopy(x) is x, `x`) --- 258,262 ---- tests = [None, 42, 2L**100, 3.14, True, False, 1j, "hello", u"hello\u1234", f.func_code, ! NewStyle, xrange(10), Classic, max] for x in tests: self.assert_(copy.deepcopy(x) is x, `x`) From loewis@users.sourceforge.net Sat Jun 14 08:10:08 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 00:10:08 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.781,1.782 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv26989/Misc Modified Files: NEWS Log Message: Copy builtin functions as atomic. Fixes #746304. Will backport to 2.2. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.781 retrieving revision 1.782 diff -C2 -d -r1.781 -r1.782 *** NEWS 13 Jun 2003 23:44:35 -0000 1.781 --- NEWS 14 Jun 2003 07:10:06 -0000 1.782 *************** *** 84,87 **** --- 84,88 ---- Taschuk. Copying a new-style class that had a reference to itself didn't work. (The same thing worked fine for old-style classes.) + Builtin functions are now treated as atomic, fixing bug #746304. - difflib.py has two new functions: context_diff() and unified_diff(). From loewis@users.sourceforge.net Sat Jun 14 08:10:08 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 00:10:08 -0700 Subject: [Python-checkins] python/dist/src/Lib copy.py,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv26989/Lib Modified Files: copy.py Log Message: Copy builtin functions as atomic. Fixes #746304. Will backport to 2.2. Index: copy.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/copy.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** copy.py 13 Jun 2003 19:26:29 -0000 1.41 --- copy.py 14 Jun 2003 07:10:06 -0000 1.42 *************** *** 121,124 **** --- 121,125 ---- d[types.XRangeType] = _copy_atomic d[types.ClassType] = _copy_atomic + d[types.BuiltinFunctionType] = _copy_atomic def _copy_list(x): *************** *** 234,237 **** --- 235,239 ---- d[types.XRangeType] = _deepcopy_atomic d[types.ClassType] = _deepcopy_atomic + d[types.BuiltinFunctionType] = _deepcopy_atomic def _deepcopy_list(x, memo): From loewis@users.sourceforge.net Sat Jun 14 08:20:07 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 00:20:07 -0700 Subject: [Python-checkins] python/dist/src/Lib copy.py,1.22.10.5,1.22.10.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv27938/Lib Modified Files: Tag: release22-maint copy.py Log Message: copy and deepcopy builtin functions atomically. Fixes #746304. Also backport 2.36 (deepcopy classes atomically). Index: copy.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/copy.py,v retrieving revision 1.22.10.5 retrieving revision 1.22.10.6 diff -C2 -d -r1.22.10.5 -r1.22.10.6 *** copy.py 12 Aug 2002 20:21:43 -0000 1.22.10.5 --- copy.py 14 Jun 2003 07:20:04 -0000 1.22.10.6 *************** *** 113,116 **** --- 113,117 ---- d[types.XRangeType] = _copy_atomic d[types.ClassType] = _copy_atomic + d[types.BuiltinFunctionType] = _copy_atomic def _copy_list(x): *************** *** 212,215 **** --- 213,218 ---- d[types.TypeType] = _deepcopy_atomic d[types.XRangeType] = _deepcopy_atomic + d[types.ClassType] = _deepcopy_atomic + d[types.BuiltinFunctionType] = _deepcopy_atomic def _deepcopy_list(x, memo): From loewis@users.sourceforge.net Sat Jun 14 08:20:08 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 00:20:08 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.87,1.337.2.4.2.88 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv27938/Misc Modified Files: Tag: release22-maint NEWS Log Message: copy and deepcopy builtin functions atomically. Fixes #746304. Also backport 2.36 (deepcopy classes atomically). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.87 retrieving revision 1.337.2.4.2.88 diff -C2 -d -r1.337.2.4.2.87 -r1.337.2.4.2.88 *** NEWS 30 May 2003 20:57:36 -0000 1.337.2.4.2.87 --- NEWS 14 Jun 2003 07:20:04 -0000 1.337.2.4.2.88 *************** *** 1,2 **** --- 1,7 ---- + What's New in Python 2.2.4? + + - SF #746304: Builtin functions are now copy.[deep]copyable. + Classes are now also deepcopyable. + What's New in Python 2.2.3 (final) ? Release date: 30-May-2003 From loewis@users.sourceforge.net Sat Jun 14 08:48:12 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 00:48:12 -0700 Subject: [Python-checkins] python/dist/src configure.in,1.414,1.415 configure,1.403,1.404 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv31086 Modified Files: configure.in configure Log Message: Explicitly undefine PACKAGE_ variables. Fixes #746012. Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.414 retrieving revision 1.415 diff -C2 -d -r1.414 -r1.415 *** configure.in 31 May 2003 07:58:45 -0000 1.414 --- configure.in 14 Jun 2003 07:48:05 -0000 1.415 *************** *** 10,15 **** AC_CONFIG_HEADER(pyconfig.h) ! # This is for stuff that absolutely must end up in pyconfig.h. ! # Please use pyport.h instead, if possible. AH_TOP([ #ifndef Py_PYCONFIG_H --- 10,15 ---- AC_CONFIG_HEADER(pyconfig.h) ! dnl This is for stuff that absolutely must end up in pyconfig.h. ! dnl Please use pyport.h instead, if possible. AH_TOP([ #ifndef Py_PYCONFIG_H *************** *** 24,27 **** --- 24,33 ---- #endif /*Py_PYCONFIG_H*/ ]) + + # We don't use PACKAGE_ variables, and they cause conflicts + # with other autoconf-based packages that include Python.h + grep -v 'define PACKAGE_' confdefs.h.new + rm confdefs.h + mv confdefs.h.new confdefs.h AC_SUBST(VERSION) Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.403 retrieving revision 1.404 diff -C2 -d -r1.403 -r1.404 *** configure 31 May 2003 07:58:41 -0000 1.403 --- configure 14 Jun 2003 07:48:07 -0000 1.404 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.413 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.414 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 1232,1241 **** - # This is for stuff that absolutely must end up in pyconfig.h. - # Please use pyport.h instead, if possible. --- 1232,1245 ---- + + # We don't use PACKAGE_ variables, and they cause conflicts + # with other autoconf-based packages that include Python.h + grep -v 'define PACKAGE_' confdefs.h.new + rm confdefs.h + mv confdefs.h.new confdefs.h From loewis@users.sourceforge.net Sat Jun 14 09:16:36 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 01:16:36 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_whichdb.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv1650/Lib/test Modified Files: test_whichdb.py Log Message: Treat empty dat/dir pairs as dumbdbm. Fixes #744687. Index: test_whichdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_whichdb.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_whichdb.py 22 Aug 2002 20:22:16 -0000 1.4 --- test_whichdb.py 14 Jun 2003 08:16:34 -0000 1.5 *************** *** 46,50 **** --- 46,55 ---- # Check whether whichdb correctly guesses module name # for databases opened with module mod. + # Try with empty files first f = mod.open(_fname, 'c') + f.close() + self.assertEqual(name, whichdb.whichdb(_fname)) + # Now add a key + f = mod.open(_fname, 'w') f["1"] = "1" f.close() From loewis@users.sourceforge.net Sat Jun 14 09:16:36 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 01:16:36 -0700 Subject: [Python-checkins] python/dist/src/Lib whichdb.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv1650/Lib Modified Files: whichdb.py Log Message: Treat empty dat/dir pairs as dumbdbm. Fixes #744687. Index: whichdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/whichdb.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** whichdb.py 6 May 2003 20:42:10 -0000 1.14 --- whichdb.py 14 Jun 2003 08:16:33 -0000 1.15 *************** *** 51,56 **** # Check for dumbdbm next -- this has a .dir and and a .dat file try: ! f = open(filename + os.extsep + "dat", "rb") ! f.close() f = open(filename + os.extsep + "dir", "rb") try: --- 51,60 ---- # Check for dumbdbm next -- this has a .dir and and a .dat file try: ! # First check for presence of files ! sizes = os.stat(filename + os.extsep + "dat").st_size, \ ! os.stat(filename + os.extsep + "dir").st_size ! # dumbdbm files with no keys are empty ! if sizes == (0, 0): ! return "dumbdbm" f = open(filename + os.extsep + "dir", "rb") try: *************** *** 59,63 **** finally: f.close() ! except IOError: pass --- 63,67 ---- finally: f.close() ! except (OSError, IOError): pass From loewis@users.sourceforge.net Sat Jun 14 09:17:30 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 01:17:30 -0700 Subject: [Python-checkins] python/dist/src/Lib whichdb.py,1.12,1.12.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv1748/Lib Modified Files: Tag: release22-maint whichdb.py Log Message: Treat empty dat/dir files as dumbdbm. Fixes #744687. Index: whichdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/whichdb.py,v retrieving revision 1.12 retrieving revision 1.12.8.1 diff -C2 -d -r1.12 -r1.12.8.1 *** whichdb.py 24 Oct 2001 20:33:34 -0000 1.12 --- whichdb.py 14 Jun 2003 08:17:28 -0000 1.12.8.1 *************** *** 30,35 **** # Check for dumbdbm next -- this has a .dir and and a .dat file try: ! f = open(filename + os.extsep + "dat", "rb") ! f.close() f = open(filename + os.extsep + "dir", "rb") try: --- 30,39 ---- # Check for dumbdbm next -- this has a .dir and and a .dat file try: ! # First check for presence of files ! sizes = os.stat(filename + os.extsep + "dat").st_size, \ ! os.stat(filename + os.extsep + "dir").st_size ! # dumbdbm files with no keys are empty ! if sizes == (0, 0): ! return "dumbdbm" f = open(filename + os.extsep + "dir", "rb") try: *************** *** 38,42 **** finally: f.close() ! except IOError: pass --- 42,46 ---- finally: f.close() ! except (OSError, IOError): pass From loewis@users.sourceforge.net Sat Jun 14 10:03:48 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 02:03:48 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.782,1.783 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv5966/Misc Modified Files: NEWS Log Message: Support keyword and topics help in cli(). Fixes #715782. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.782 retrieving revision 1.783 diff -C2 -d -r1.782 -r1.783 *** NEWS 14 Jun 2003 07:10:06 -0000 1.782 --- NEWS 14 Jun 2003 09:03:46 -0000 1.783 *************** *** 112,115 **** --- 112,117 ---- ----------- + - pydoc now offers help on keywords and topics. + - Tools/idle is gone; long live Lib/idlelib. From loewis@users.sourceforge.net Sat Jun 14 10:03:48 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 02:03:48 -0700 Subject: [Python-checkins] python/dist/src/Lib pydoc.py,1.84,1.85 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv5966/Lib Modified Files: pydoc.py Log Message: Support keyword and topics help in cli(). Fixes #715782. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** pydoc.py 11 Jun 2003 23:38:55 -0000 1.84 --- pydoc.py 14 Jun 2003 09:03:46 -0000 1.85 *************** *** 2117,2121 **** writedoc(arg) else: ! doc(arg) except ErrorDuringImport, value: print value --- 2117,2121 ---- writedoc(arg) else: ! help.help(arg) except ErrorDuringImport, value: print value *************** *** 2127,2133 **** %s ... Show text documentation on something. may be the name of a ! function, module, or package, or a dotted reference to a class or ! function within a module or module in a package. If contains ! a '%s', it is used as the path to a Python source file to document. %s -k --- 2127,2135 ---- %s ... Show text documentation on something. may be the name of a ! Python keyword, topic, function, module, or package, or a dotted ! reference to a class or function within a module or module in a ! package. If contains a '%s', it is used as the path to a ! Python source file to document. If name is 'keywords', 'topics', ! or 'modules', a listing of these things is displayed. %s -k From loewis@users.sourceforge.net Sat Jun 14 14:11:26 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 06:11:26 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.130,1.131 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv29503 Modified Files: Makefile.pre.in Log Message: Properly bracket variables. Fixes part of #749911. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.130 retrieving revision 1.131 diff -C2 -d -r1.130 -r1.131 *** Makefile.pre.in 13 Jun 2003 20:49:55 -0000 1.130 --- Makefile.pre.in 14 Jun 2003 13:11:24 -0000 1.131 *************** *** 345,349 **** libpython$(VERSION).so: $(LIBRARY_OBJS) ! if test $INSTSONAME != $LDLIBRARY; then \ $(LDSHARED) -Wl,-soname=$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \ $(LN) -f $(INSTSONAME) $@; \ --- 345,349 ---- libpython$(VERSION).so: $(LIBRARY_OBJS) ! if test $(INSTSONAME) != $(LDLIBRARY); then \ $(LDSHARED) -Wl,-soname=$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM); \ $(LN) -f $(INSTSONAME) $@; \ From loewis@users.sourceforge.net Sat Jun 14 14:30:56 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 06:30:56 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.76,1.77 socket.py,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv31613 Modified Files: httplib.py socket.py Log Message: Always unwrap _socketobj in socket.ssl. Revert httplib.py 1.25. Fixes #754447. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** httplib.py 12 May 2003 20:19:36 -0000 1.76 --- httplib.py 14 Jun 2003 13:30:53 -0000 1.77 *************** *** 957,964 **** sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((self.host, self.port)) ! realsock = sock ! if hasattr(sock, "_sock"): ! realsock = sock._sock ! ssl = socket.ssl(realsock, self.key_file, self.cert_file) self.sock = FakeSocket(sock, ssl) --- 957,961 ---- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((self.host, self.port)) ! ssl = socket.ssl(sock, self.key_file, self.cert_file) self.sock = FakeSocket(sock, ssl) Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** socket.py 29 May 2003 14:36:57 -0000 1.41 --- socket.py 14 Jun 2003 13:30:53 -0000 1.42 *************** *** 66,79 **** _realsocket = socket ! if (sys.platform.lower().startswith("win") ! or (hasattr(os, 'uname') and os.uname()[0] == "BeOS") ! or sys.platform=="riscos"): ! ! if _have_ssl: ! _realssl = ssl ! def ssl(sock, keyfile=None, certfile=None): ! if hasattr(sock, "_sock"): ! sock = sock._sock ! return _realssl(sock, keyfile, certfile) # WSA error codes --- 66,75 ---- _realsocket = socket ! if _have_ssl: ! _realssl = ssl ! def ssl(sock, keyfile=None, certfile=None): ! if hasattr(sock, "_sock"): ! sock = sock._sock ! return _realssl(sock, keyfile, certfile) # WSA error codes From loewis@users.sourceforge.net Sat Jun 14 15:46:40 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 07:46:40 -0700 Subject: [Python-checkins] python/dist/src configure.in,1.415,1.416 configure,1.404,1.405 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv9202 Modified Files: configure.in configure Log Message: Give a warning if SO is set. Fixes #610332. Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.415 retrieving revision 1.416 diff -C2 -d -r1.415 -r1.416 *** configure.in 14 Jun 2003 07:48:05 -0000 1.415 --- configure.in 14 Jun 2003 14:46:38 -0000 1.416 *************** *** 1141,1144 **** --- 1141,1155 ---- *) SO=.so;; esac + else + # this might also be a termcap variable, see #610332 + echo + echo '=====================================================================' + echo '+ +' + echo '+ WARNING: You have set SO in your environment. +' + echo '+ Do you really mean to change the extension for shared libraries? +' + echo '+ Continuing in 10 seconds to let you to ponder. +' + echo '+ +' + echo '=====================================================================' + sleep 10 fi AC_MSG_RESULT($SO) Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.404 retrieving revision 1.405 diff -C2 -d -r1.404 -r1.405 *** configure 14 Jun 2003 07:48:07 -0000 1.404 --- configure 14 Jun 2003 14:46:38 -0000 1.405 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.414 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.415 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 9479,9482 **** --- 9479,9493 ---- *) SO=.so;; esac + else + # this might also be a termcap variable, see #610332 + echo + echo '=====================================================================' + echo '+ +' + echo '+ WARNING: You have set SO in your environment. +' + echo '+ Do you really mean to change the extension for shared libraries? +' + echo '+ Continuing in 10 seconds to let you to ponder. +' + echo '+ +' + echo '=====================================================================' + sleep 10 fi echo "$as_me:$LINENO: result: $SO" >&5 From loewis@users.sourceforge.net Sat Jun 14 16:03:09 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 08:03:09 -0700 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.77.6.1,2.77.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv11554/Modules Modified Files: Tag: release22-maint _sre.c Log Message: Backport FreeBSD recursion limit. Fixes #553736. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.77.6.1 retrieving revision 2.77.6.2 diff -C2 -d -r2.77.6.1 -r2.77.6.2 *** _sre.c 31 Jul 2002 11:19:49 -0000 2.77.6.1 --- _sre.c 14 Jun 2003 15:03:06 -0000 2.77.6.2 *************** *** 89,93 **** --- 89,107 ---- #define USE_RECURSION_LIMIT 7500 #else + #if defined(__GNUC__) && defined(WITH_THREAD) && defined(__FreeBSD__) + /* the pthreads library on FreeBSD has a fixed 1MB stack size for the + * initial (or "primary") thread, which is insufficient for the default + * recursion limit. gcc 3.x at the default optimisation + * level (-O3) uses stack space more aggressively than gcc 2.95. + */ + #if (__GNUC__ > 2) + #define USE_RECURSION_LIMIT 6500 + #else + #define USE_RECURSION_LIMIT 7500 + #endif + + #else #define USE_RECURSION_LIMIT 10000 + #endif #endif #endif From loewis@users.sourceforge.net Sat Jun 14 16:05:15 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 08:05:15 -0700 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.55,2.55.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv11805 Modified Files: Tag: release21-maint _sre.c Log Message: Backport 2.3 FreeBSD recursion_limit settings. Fixes #553736. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.55 retrieving revision 2.55.2.1 diff -C2 -d -r2.55 -r2.55.2.1 *** _sre.c 15 Apr 2001 19:00:58 -0000 2.55 --- _sre.c 14 Jun 2003 15:05:13 -0000 2.55.2.1 *************** *** 77,81 **** --- 77,95 ---- #define USE_RECURSION_LIMIT 7500 #else + #if defined(__GNUC__) && defined(WITH_THREAD) && defined(__FreeBSD__) + /* the pthreads library on FreeBSD has a fixed 1MB stack size for the + * initial (or "primary") thread, which is insufficient for the default + * recursion limit. gcc 3.x at the default optimisation + * level (-O3) uses stack space more aggressively than gcc 2.95. + */ + #if (__GNUC__ > 2) + #define USE_RECURSION_LIMIT 6500 + #else + #define USE_RECURSION_LIMIT 7500 + #endif + + #else #define USE_RECURSION_LIMIT 10000 + #endif #endif #endif From loewis@users.sourceforge.net Sat Jun 14 16:20:30 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 08:20:30 -0700 Subject: [Python-checkins] python/dist/src configure,1.405,1.406 configure.in,1.416,1.417 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv13288 Modified Files: configure configure.in Log Message: Use -R instead of -rpath on Solaris. Fixes #749911. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.405 retrieving revision 1.406 diff -C2 -d -r1.405 -r1.406 *** configure 14 Jun 2003 14:46:38 -0000 1.405 --- configure 14 Jun 2003 15:20:26 -0000 1.406 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.415 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.416 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 3270,3274 **** SunOS*) LDLIBRARY='libpython$(VERSION).so' ! BLDLIBRARY='-Wl,-rpath,$(LIBDIR) -L. -lpython$(VERSION)' RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH ;; --- 3270,3274 ---- SunOS*) LDLIBRARY='libpython$(VERSION).so' ! BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)' RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH ;; Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.416 retrieving revision 1.417 diff -C2 -d -r1.416 -r1.417 *** configure.in 14 Jun 2003 14:46:38 -0000 1.416 --- configure.in 14 Jun 2003 15:20:28 -0000 1.417 *************** *** 502,506 **** SunOS*) LDLIBRARY='libpython$(VERSION).so' ! BLDLIBRARY='-Wl,-rpath,$(LIBDIR) -L. -lpython$(VERSION)' RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH ;; --- 502,506 ---- SunOS*) LDLIBRARY='libpython$(VERSION).so' ! BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)' RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH ;; From goodger@users.sourceforge.net Sat Jun 14 18:14:10 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Sat, 14 Jun 2003 10:14:10 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.243,1.244 pep-0245.txt,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv28110 Modified Files: pep-0000.txt pep-0245.txt Log Message: email update Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.243 retrieving revision 1.244 diff -C2 -d -r1.243 -r1.244 *** pep-0000.txt 12 Jun 2003 13:53:59 -0000 1.243 --- pep-0000.txt 14 Jun 2003 17:14:08 -0000 1.244 *************** *** 396,400 **** Norwitz, Neal neal@metaslash.com Oliphant, Travis oliphant@ee.byu.edu ! Pelletier, Michel michel@digicool.com Peters, Tim tim@zope.com Petrone, Jason jp@demonseed.net --- 396,400 ---- Norwitz, Neal neal@metaslash.com Oliphant, Travis oliphant@ee.byu.edu ! Pelletier, Michel michel@users.sourceforge.net Peters, Tim tim@zope.com Petrone, Jason jp@demonseed.net Index: pep-0245.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0245.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pep-0245.txt 5 Jul 2001 19:20:16 -0000 1.5 --- pep-0245.txt 14 Jun 2003 17:14:08 -0000 1.6 *************** *** 2,6 **** Title: Python Interface Syntax Version: $Revision$ ! Author: michel@digicool.com (Michel Pelletier) Discussions-To: http://www.zope.org/Wikis/Interfaces Status: Draft --- 2,6 ---- Title: Python Interface Syntax Version: $Revision$ ! Author: Michel Pelletier Discussions-To: http://www.zope.org/Wikis/Interfaces Status: Draft From kbk@users.sourceforge.net Sat Jun 14 18:56:27 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Sat, 14 Jun 2003 10:56:27 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib IOBinding.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv4911 Modified Files: IOBinding.py Log Message: Forwardport Patch from IDLEfork SF 610329 Remove deprecated tempfile usage Index: IOBinding.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/IOBinding.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** IOBinding.py 9 Jun 2003 03:12:42 -0000 1.18 --- IOBinding.py 14 Jun 2003 17:56:25 -0000 1.19 *************** *** 466,471 **** if not saved or filename is None: # XXX KBK 08Jun03 Wouldn't it be better to ask the user to save? ! filename = tempfilename = tempfile.mktemp() ! if not self.writefile(filename): os.unlink(tempfilename) return "break" --- 466,473 ---- if not saved or filename is None: # XXX KBK 08Jun03 Wouldn't it be better to ask the user to save? ! (tfd, tempfilename) = tempfile.mkstemp(prefix='IDLE_tmp_') ! filename = tempfilename ! os.close(tfd) ! if not self.writefile(tempfilename): os.unlink(tempfilename) return "break" *************** *** 495,498 **** --- 497,502 ---- message="Printing is not enabled for this platform: %s" % platform tkMessageBox.showinfo("Print status", message, master=self.text) + if tempfilename: + os.unlink(tempfilename) return "break" From loewis@users.sourceforge.net Sat Jun 14 22:03:07 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 14:03:07 -0700 Subject: [Python-checkins] python/dist/src/Modules Setup.dist,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv28534/Modules Modified Files: Setup.dist Log Message: Patch #752671: NetBSD needs to link libintl to _locale.so. Index: Setup.dist =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Setup.dist,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** Setup.dist 26 May 2003 21:19:47 -0000 1.40 --- Setup.dist 14 Jun 2003 21:03:05 -0000 1.41 *************** *** 174,178 **** #unicodedata unicodedata.c # static Unicode character database ! #_locale _localemodule.c # access to ISO C locale support --- 174,179 ---- #unicodedata unicodedata.c # static Unicode character database ! # access to ISO C locale support ! #_locale _localemodule.c # -lintl From loewis@users.sourceforge.net Sat Jun 14 22:03:07 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 14:03:07 -0700 Subject: [Python-checkins] python/dist/src configure,1.406,1.407 configure.in,1.417,1.418 pyconfig.h.in,1.80,1.81 setup.py,1.168,1.169 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv28534 Modified Files: configure configure.in pyconfig.h.in setup.py Log Message: Patch #752671: NetBSD needs to link libintl to _locale.so. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.406 retrieving revision 1.407 diff -C2 -d -r1.406 -r1.407 *** configure 14 Jun 2003 15:20:26 -0000 1.406 --- configure 14 Jun 2003 21:03:05 -0000 1.407 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.416 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.417 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 9931,9934 **** --- 9931,9998 ---- # posix4 on Solaris 2.6 # pthread (first!) on Linux + # check if we need libintl for locale functions + echo "$as_me:$LINENO: checking for textdomain in -lintl" >&5 + echo $ECHO_N "checking for textdomain in -lintl... $ECHO_C" >&6 + if test "${ac_cv_lib_intl_textdomain+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + ac_check_lib_save_LIBS=$LIBS + LIBS="-lintl $LIBS" + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + + /* Override any gcc2 internal prototype to avoid an error. */ + #ifdef __cplusplus + extern "C" + #endif + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ + char textdomain (); + #ifdef F77_DUMMY_MAIN + # ifdef __cplusplus + extern "C" + # endif + int F77_DUMMY_MAIN() { return 1; } + #endif + int + main () + { + textdomain (); + ; + return 0; + } + _ACEOF + rm -f conftest.$ac_objext conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_intl_textdomain=yes + else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_lib_intl_textdomain=no + fi + rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_lib_save_LIBS + fi + echo "$as_me:$LINENO: result: $ac_cv_lib_intl_textdomain" >&5 + echo "${ECHO_T}$ac_cv_lib_intl_textdomain" >&6 + if test $ac_cv_lib_intl_textdomain = yes; then + + cat >>confdefs.h <<\_ACEOF + #define WITH_LIBINTL 1 + _ACEOF + + fi + # checks for system dependent C++ extensions support Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.417 retrieving revision 1.418 diff -C2 -d -r1.417 -r1.418 *** configure.in 14 Jun 2003 15:20:28 -0000 1.417 --- configure.in 14 Jun 2003 21:03:05 -0000 1.418 *************** *** 1347,1350 **** --- 1347,1354 ---- # posix4 on Solaris 2.6 # pthread (first!) on Linux + # check if we need libintl for locale functions + AC_CHECK_LIB(intl, textdomain, + AC_DEFINE(WITH_LIBINTL, 1, + [Define to 1 if libintl is needed for locale functions.])) # checks for system dependent C++ extensions support Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** pyconfig.h.in 23 May 2003 14:35:23 -0000 1.80 --- pyconfig.h.in 14 Jun 2003 21:03:05 -0000 1.81 *************** *** 782,785 **** --- 782,788 ---- #undef WITH_DYLD + /* Define to 1 if libintl is needed for locale functions. */ + #undef WITH_LIBINTL + /* Define if you want to produce an OpenStep/Rhapsody framework (shared library plus accessory files). */ Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.168 retrieving revision 1.169 diff -C2 -d -r1.168 -r1.169 *** setup.py 13 Jun 2003 20:35:11 -0000 1.168 --- setup.py 14 Jun 2003 21:03:05 -0000 1.169 *************** *** 340,344 **** exts.append( Extension('unicodedata', ['unicodedata.c']) ) # access to ISO C locale support ! if platform in ['cygwin', 'aix4']: locale_libs = ['intl'] else: --- 340,346 ---- exts.append( Extension('unicodedata', ['unicodedata.c']) ) # access to ISO C locale support ! data = open('pyconfig.h').read() ! m = re.search(r"#s*define\s+WITH_LIBINTL\s+1\s*", data) ! if m is not None: locale_libs = ['intl'] else: From loewis@users.sourceforge.net Sat Jun 14 22:34:34 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 14:34:34 -0700 Subject: [Python-checkins] python/dist/src/Lib/lib-tk tkFileDialog.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory sc8-pr-cvs1:/tmp/cvs-serv32124/Lib/lib-tk Modified Files: tkFileDialog.py Log Message: Properly deal with tuples in Open._fixresult. Fixes bug reported in follow-up to #621891. Index: tkFileDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/tkFileDialog.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tkFileDialog.py 4 Jan 2003 00:08:09 -0000 1.9 --- tkFileDialog.py 14 Jun 2003 21:34:32 -0000 1.10 *************** *** 77,80 **** --- 77,95 ---- command = "tk_getOpenFile" + def _fixresult(self, widget, result): + if isinstance(result, tuple): + # multiple results: + result = tuple([getattr(r, "string", r) for r in result]) + if result: + import os + path, file = os.path.split(result[0]) + self.options["initialdir"] = path + # don't set initialfile or filename, as we have multiple of these + return result + if not widget.tk.wantobjects() and "multiple" in self.options: + # Need to split result explicitly + return self._fixresult(widget, widget.tk.splitlist(result)) + return _Dialog._fixresult(widget, result) + class SaveAs(_Dialog): "Ask for a filename to save as" *************** *** 116,122 **** """ options["multiple"]=1 ! files=Open(**options).show() ! return files.split() ! # FIXME: are the following perhaps a bit too convenient? --- 131,135 ---- """ options["multiple"]=1 ! return Open(**options).show() # FIXME: are the following perhaps a bit too convenient? From loewis@users.sourceforge.net Sat Jun 14 22:34:34 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 14:34:34 -0700 Subject: [Python-checkins] python/dist/src/Modules _tkinter.c,1.160,1.161 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv32124/Modules Modified Files: _tkinter.c Log Message: Properly deal with tuples in Open._fixresult. Fixes bug reported in follow-up to #621891. Index: _tkinter.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v retrieving revision 1.160 retrieving revision 1.161 diff -C2 -d -r1.160 -r1.161 *** _tkinter.c 29 May 2003 00:17:03 -0000 1.160 --- _tkinter.c 14 Jun 2003 21:34:32 -0000 1.161 *************** *** 2605,2611 **** { ! int wantobjects; ! if (!PyArg_ParseTuple(args, "i:wantobjects", &wantobjects)) return NULL; ((TkappObject*)self)->wantobjects = wantobjects; --- 2605,2613 ---- { ! int wantobjects = -1; ! if (!PyArg_ParseTuple(args, "|i:wantobjects", &wantobjects)) return NULL; + if (wantobjects == -1) + return PyBool_FromLong(((TkappObject*)self)->wantobjects); ((TkappObject*)self)->wantobjects = wantobjects; From loewis@users.sourceforge.net Sat Jun 14 22:40:06 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 14 Jun 2003 14:40:06 -0700 Subject: [Python-checkins] python/dist/src/Lib/lib-tk tkFont.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory sc8-pr-cvs1:/tmp/cvs-serv476 Modified Files: tkFont.py Log Message: Patch #751107: Slant must be 'roman', not 'normal'. Index: tkFont.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/tkFont.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tkFont.py 6 Apr 2003 09:00:53 -0000 1.4 --- tkFont.py 14 Jun 2003 21:40:04 -0000 1.5 *************** *** 22,25 **** --- 22,26 ---- # weight/slant NORMAL = "normal" + ROMAN = "roman" BOLD = "bold" ITALIC = "italic" *************** *** 38,42 **** size -- font size in points weight -- font thickness: NORMAL, BOLD ! slant -- font slant: NORMAL, ITALIC underline -- font underlining: false (0), true (1) overstrike -- font strikeout: false (0), true (1) --- 39,43 ---- size -- font size in points weight -- font thickness: NORMAL, BOLD ! slant -- font slant: ROMAN, ITALIC underline -- font underlining: false (0), true (1) overstrike -- font strikeout: false (0), true (1) From goodger@users.sourceforge.net Sat Jun 14 23:40:38 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Sat, 14 Jun 2003 15:40:38 -0700 Subject: [Python-checkins] python/nondist/peps pep-0319.txt,NONE,1.1 pep-0000.txt,1.244,1.245 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv6384 Modified Files: pep-0000.txt Added Files: pep-0319.txt Log Message: new PEP --- NEW FILE: pep-0319.txt --- PEP: 319 Title: Python Synchronize/Asynchronize Block Version: $Revision: 1.1 $ Last-Modified: $Date: 2003/06/14 22:40:36 $ Author: Michel Pelletier Status: Draft Type: Standards Track Created: 24-Feb-2003 Python-Version: 2.4? Post-History: Abstract This PEP proposes adding two new keywords to Python, `synchronize' and 'asynchronize'. The `synchronize' Keyword The concept of code synchronization in Python is too low-level. To synchronize code a programmer must be aware of the details of the following pseudo-code pattern: initialize_lock() ... acquire_lock() try: change_shared_data() finally: release_lock() This synchronized block pattern is not the only pattern (more discussed below) but it is very common. This PEP proposes replacing the above code with the following equivalent: synchronize: change_shared_data() The advantages of this scheme are simpler syntax and less room for user error. Currently users are required to write code about acquiring and releasing thread locks in 'try/finally' blocks; errors in this code can cause notoriously difficult concurrent thread locking issues. The `asynchronize' Keyword While executing a `synchronize' block of code a programmer may want to "drop back" to running asynchronously momentarily to run blocking input/output routines or something else that might take a indeterminate amount of time and does not require synchronization. This code usually follows the pattern: initialize_lock() ... acquire_lock() try: change_shared_data() release_lock() # become async do_blocking_io() acquire_lock() # sync again change_shared_data2() finally: release_lock() The asynchronous section of the code is not very obvious visually, so it is marked up with comments. Using the proposed 'asynchronize' keyword this code becomes much cleaner, easier to understand, and less prone to error: synchronize: change_shared_data() asynchronize: do_blocking_io() change_shared_data2() Encountering an `asynchronize' keyword inside a non-synchronized block can raise either an error or issue a warning (as all code blocks are implicitly asynchronous anyway). It is important to note that the above example is *not* the same as: synchronize: change_shared_data() do_blocking_io() synchronize: change_shared_data2() Because both synchronized blocks of code may be running inside the same iteration of a loop, Consider: while in_main_loop(): synchronize: change_shared_data() asynchronize: do_blocking_io() change_shared_data2() Many threads may be looping through this code. Without the 'asynchronize' keyword one thread cannot stay in the loop and release the lock at the same time while blocking IO is going on. This pattern of releasing locks inside a main loop to do blocking IO is used extensively inside the CPython interpreter itself. Synchronization Targets As proposed the `synchronize' and `asynchronize' keywords synchronize a block of code. However programmers may want to specify a target object that threads synchronize on. Any object can be a synchronization target. Consider a two-way queue object: two different objects are used by the same `synchronize' code block to synchronize both queues separately in the 'get' method: class TwoWayQueue: def __init__(self): self.front = [] self.rear = [] def putFront(self, item): self.put(item, self.front) def getFront(self): item = self.get(self.front) return item def putRear(self, item): self.put(item, self.rear) def getRear(self): item = self.get(self.rear) return item def put(self, item, queue): synchronize queue: queue.append(item) def get(self, queue): synchronize queue: item = queue[0] del queue[0] return item Here is the equivalent code in Python as it is now without a `synchronize' keyword: import thread class LockableQueue: def __init__(self): self.queue = [] self.lock = thread.allocate_lock() class TwoWayQueue: def __init__(self): self.front = LockableQueue() self.rear = LockableQueue() def putFront(self, item): self.put(item, self.front) def getFront(self): item = self.get(self.front) return item def putRear(self, item): self.put(item, self.rear) def getRear(self): item = self.get(self.rear) return item def put(self, item, queue): queue.lock.acquire() try: queue.append(item) finally: queue.lock.release() def get(self, queue): queue.lock.acquire() try: item = queue[0] del queue[0] return item finally: queue.lock.release() The last example had to define an extra class to associate a lock with the queue where the first example the `synchronize' keyword does this association internally and transparently. Other Patterns that Synchronize There are some situations where the `synchronize' and `asynchronize' keywords cannot entirely replace the use of lock methods like `acquire' and `release'. Some examples are if the programmer wants to provide arguments for `acquire' or if a lock is acquired in one code block but released in another, as shown below. Here is a class from Zope modified to use both the `synchronize' and `asynchronize' keywords and also uses a pool of explicit locks that are acquired and released in different code blocks and thus don't use `synchronize': import thread from ZServerPublisher import ZServerPublisher class ZRendevous: def __init__(self, n=1): pool=[] self._lists=pool, [], [] synchronize: while n > 0: l=thread.allocate_lock() l.acquire() pool.append(l) thread.start_new_thread(ZServerPublisher, (self.accept,)) n=n-1 def accept(self): synchronize: pool, requests, ready = self._lists while not requests: l=pool[-1] del pool[-1] ready.append(l) asynchronize: l.acquire() pool.append(l) r=requests[0] del requests[0] return r def handle(self, name, request, response): synchronize: pool, requests, ready = self._lists requests.append((name, request, response)) if ready: l=ready[-1] del ready[-1] l.release() Here is the original class as found in the 'Zope/ZServer/PubCore/ZRendevous.py' module. The "convenience" of the '_a' and '_r' shortcut names obscure the code: import thread from ZServerPublisher import ZServerPublisher class ZRendevous: def __init__(self, n=1): sync=thread.allocate_lock() self._a=sync.acquire self._r=sync.release pool=[] self._lists=pool, [], [] self._a() try: while n > 0: l=thread.allocate_lock() l.acquire() pool.append(l) thread.start_new_thread(ZServerPublisher, (self.accept,)) n=n-1 finally: self._r() def accept(self): self._a() try: pool, requests, ready = self._lists while not requests: l=pool[-1] del pool[-1] ready.append(l) self._r() l.acquire() self._a() pool.append(l) r=requests[0] del requests[0] return r finally: self._r() def handle(self, name, request, response): self._a() try: pool, requests, ready = self._lists requests.append((name, request, response)) if ready: l=ready[-1] del ready[-1] l.release() finally: self._r() In particular the asynchronize section of the `accept' method is not very obvious. To beginner programmers, `synchronize' and `asynchronize' remove many of the problems encountered when juggling multiple `acquire' and `release' methods on different locks in different `try/finally' blocks. Formal Syntax Python syntax is defined in a modified BNF grammar notation described in the Python Language Reference [1]. This section describes the proposed synchronization syntax using this grammar: synchronize_stmt: 'synchronize' [test] ':' suite asynchronize_stmt: 'asynchronize' [test] ':' suite compound_stmt: ... | synchronized_stmt | asynchronize_stmt (The '...' indicates other compound statements elided). Proposed Implementation The author of this PEP has not explored an implementation yet. There are several implementation issues that must be resolved. The main implementation issue is what exactly gets locked and unlocked during a synchronized block. During an unqualified synchronized block (the use of the `synchronize' keyword without an target argument) a lock could be created and associated with the synchronized code block object. Any threads that are to execute the block must first acquire the code block lock. When an `asynchronize' keyword is encountered in a `synchronize' block the code block lock is unlocked before the inner block is executed and re-locked when the inner block terminates. When a synchronized block target is specified the object is associated with a lock. How this is implemented cleanly is probably the highest risk of this proposal. Java Virtual Machines typically associate a special hidden lock object with target object and use it to synchronized the block around the target only. Backward Compatibility Backward compatibility is solved with the new `from __future__' Python syntax [2], and the new warning framework [3] to evolve the Python language into phasing out any conflicting names that use the new keywords `synchronize' and `asynchronize'. To use the syntax now, a developer could use the statement: from __future__ import threadsync # or whatever In addition, any code that uses the keyword `synchronize' or `asynchronize' as an identifier will be issued a warning from Python. After the appropriate period of time, the syntax would become standard, the above import statement would do nothing, and any identifiers named `synchronize' or `asynchronize' would raise an exception. PEP 310 Reliable Acquisition/Release Pairs PEP 310 [4] proposes the 'with' keyword that can serve the same function as 'synchronize' (but no facility for 'asynchronize'). The pattern: initialize_lock() with the_lock: change_shared_data() is equivalent to the proposed: synchronize the_lock: change_shared_data() PEP 310 must synchronize on an exsiting lock, while this PEP proposes that unqualified 'synchronize' statements synchronize on a global, internal, transparent lock in addition to qualifiled 'synchronize' statements. The 'with' statement also requires lock initialization, while the 'synchronize' statment can synchronize on any target object *including* locks. While limited in this fashion, the 'with' statment is more abstract and serves more purposes than synchronization. For example, transactions could be used with the 'with' keyword: initialize_transaction() with my_transaction: do_in_transaction() # when the block terminates, the transaction is commited. The 'synchronize' and 'asynchronize' keywords cannot serve this or any other general acquire/release pattern other than thread synchronization. How Java Does It Java defines a 'synchronized' keyword (note the grammatical tense different between the Java keyword and this PEP's 'synchronize') which must be qualified on any object. The syntax is: synchronized (Expression) Block Expression must yeild a valid object (null raises an error and exceptions during 'Expression' terminate the 'synchronized' block for the same reason) upon which 'Block' is synchronized. How Jython Does It Jython uses a 'synchronize' class with the static method 'make_synchronized' that accepts one callable argument and returns a newly created, synchronized, callable "wrapper" around the argument. Summary of Proposed Changes to Python Adding new `synchronize' and `asynchronize' keywords to the language. Risks This PEP proposes adding two keywords to the Python language. This may break code. There is no implementation to test. It's not the most important problem facing Python programmers today (although it is a fairly notorious one). The equivalent Java keyword is the past participle 'synchronized'. This PEP proposes the present tense, 'synchronize' as being more in spirit with Python (there being less distinction between compile-time and run-time in Python than Java). Dissenting Opinion This PEP has not been discussed on python-dev. References [1] The Python Language Reference http://www.python.org/doc/current/ref/ref.html [2] PEP 236, Back to the __future__, Peters http://python.sourceforge.net/peps/pep-0236.html [3] PEP 230, Warning Framework, van Rossum http://python.sourceforge.net/peps/pep-0236.html [4] PEP 310, Reliable Acquisition/Release Pairs, Hudson, Moore http://www.python.org/peps/pep-0310.html Copyright This document has been placed in the public domain. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 70 End: Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.244 retrieving revision 1.245 diff -C2 -d -r1.244 -r1.245 *** pep-0000.txt 14 Jun 2003 17:14:08 -0000 1.244 --- pep-0000.txt 14 Jun 2003 22:40:36 -0000 1.245 *************** *** 119,122 **** --- 119,123 ---- S 317 Eliminate Implicit Exception Instantiation Taschuk S 318 Function/Method Decorator Syntax Smith + S 319 Python Synchronize/Asynchronize Block Pelletier S 754 IEEE 754 Floating Point Special Values Warnes *************** *** 330,333 **** --- 331,335 ---- S 317 Eliminate Implicit Exception Instantiation Taschuk S 318 Function/Method Decorator Syntax Smith + S 319 Python Synchronize/Asynchronize Block Pelletier SR 666 Reject Foolish Indentation Creighton S 754 IEEE 754 Floating Point Special Values Warnes From gward@users.sourceforge.net Sun Jun 15 16:37:20 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sun, 15 Jun 2003 08:37:20 -0700 Subject: [Python-checkins] python/dist/src/Lib textwrap.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv18865 Modified Files: textwrap.py Log Message: Update copyright dates. Define True and False (if necessary) so this module can be copied as-is to other projects (eg. Optik, Docutils) that don't depend on Python 2.3. Index: textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** textwrap.py 14 Jun 2003 00:26:39 -0000 1.31 --- textwrap.py 15 Jun 2003 15:37:18 -0000 1.32 *************** *** 3,7 **** # Copyright (C) 1999-2001 Gregory P. Ward. ! # Copyright (C) 2002 Python Software Foundation. # Written by Greg Ward --- 3,7 ---- # Copyright (C) 1999-2001 Gregory P. Ward. ! # Copyright (C) 2002, 2003 Python Software Foundation. # Written by Greg Ward *************** *** 9,12 **** --- 9,20 ---- import string, re + + # Do the right thing with boolean values for all known Python versions + # (so this module can be copied to projects that don't depend on Python + # 2.3, e.g. Optik and Docutils). + try: + True, False + except NameError: + (True, False) = (1, 0) __all__ = ['TextWrapper', 'wrap', 'fill'] From kbk@users.sourceforge.net Sun Jun 15 18:12:27 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Sun, 15 Jun 2003 10:12:27 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib idlever.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv31408 Modified Files: idlever.py Log Message: Move to Version 1.0b2 Index: idlever.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/idlever.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** idlever.py 12 Jun 2003 03:15:47 -0000 1.11 --- idlever.py 15 Jun 2003 17:12:25 -0000 1.12 *************** *** 1 **** ! IDLE_VERSION = "0.9b1+" --- 1 ---- ! IDLE_VERSION = "1.0b2" From kbk@users.sourceforge.net Sun Jun 15 18:38:47 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Sun, 15 Jun 2003 10:38:47 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib PyShell.py,1.76,1.77 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv1846 Modified Files: PyShell.py Log Message: Support testing in .../Lib/idlelib when calling by providing other modules access to globals set up in PyShell.main() Index: PyShell.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/PyShell.py,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** PyShell.py 14 Jun 2003 03:33:20 -0000 1.76 --- PyShell.py 15 Jun 2003 17:38:45 -0000 1.77 *************** *** 1300,1302 **** --- 1300,1303 ---- if __name__ == "__main__": + sys.modules['PyShell'] = sys.modules['__main__'] main() From kbk@users.sourceforge.net Sun Jun 15 18:50:01 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Sun, 15 Jun 2003 10:50:01 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib OutputWindow.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv3103 Modified Files: OutputWindow.py Log Message: Forwardport Patch from IDLEfork SF 615312 Convert characters from the locale's encoding on output Index: OutputWindow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/OutputWindow.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** OutputWindow.py 31 Dec 2002 15:59:14 -0000 1.8 --- OutputWindow.py 15 Jun 2003 17:49:59 -0000 1.9 *************** *** 3,6 **** --- 3,7 ---- import re import tkMessageBox + import IOBinding class OutputWindow(EditorWindow): *************** *** 35,38 **** --- 36,47 ---- def write(self, s, tags=(), mark="insert"): + # Tk assumes that byte strings are Latin-1; + # we assume that they are in the locale's encoding + if isinstance(s, str): + try: + s = unicode(s, IOBinding.encoding) + except UnicodeError: + # some other encoding; let Tcl deal with it + pass self.text.insert(mark, s, tags) self.text.see(mark) From gvanrossum@users.sourceforge.net Sun Jun 15 20:08:59 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sun, 15 Jun 2003 12:08:59 -0700 Subject: [Python-checkins] python/dist/src/Lib/lib-tk tkFileDialog.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory sc8-pr-cvs1:/tmp/cvs-serv13375 Modified Files: tkFileDialog.py Log Message: Add a missing 'self,' to a super call in recently checked-in code. This was reported in the IDLEFORK bug tracker as #754971. Index: tkFileDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/tkFileDialog.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tkFileDialog.py 14 Jun 2003 21:34:32 -0000 1.10 --- tkFileDialog.py 15 Jun 2003 19:08:57 -0000 1.11 *************** *** 90,94 **** # Need to split result explicitly return self._fixresult(widget, widget.tk.splitlist(result)) ! return _Dialog._fixresult(widget, result) class SaveAs(_Dialog): --- 90,94 ---- # Need to split result explicitly return self._fixresult(widget, widget.tk.splitlist(result)) ! return _Dialog._fixresult(self, widget, result) class SaveAs(_Dialog): From gvanrossum@users.sourceforge.net Sun Jun 15 20:42:42 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sun, 15 Jun 2003 12:42:42 -0700 Subject: [Python-checkins] python/dist/src/PCbuild python20.wse,1.124,1.125 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv17615 Modified Files: python20.wse Log Message: Changes to install the new idle: it's now in Lib/idlelib instead of Tools/idle, in both source and destination. (There are still problems when running the IDLE icon, but they don't seem to have to do with the installer.) Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -d -r1.124 -r1.125 *** python20.wse 12 May 2003 19:42:04 -0000 1.124 --- python20.wse 15 Jun 2003 19:42:39 -0000 1.125 *************** *** 2142,2165 **** end item: Install File ! Source=..\tools\idle\*.py ! Destination=%MAINDIR%\Tools\idle Description=Integrated DeveLopment Environment for Python Flags=0000000000000010 end item: Install File ! Source=..\tools\idle\*.txt ! Destination=%MAINDIR%\Tools\idle Description=Integrated DeveLopment Environment for Python Flags=0000000000000010 end item: Install File ! Source=..\tools\idle\icons\* ! Destination=%MAINDIR%\Tools\idle\Icons Description=Integrated DeveLopment Environment for Python Flags=0000000000000010 end item: Install File ! Source=..\tools\idle\idle.pyw ! Destination=%MAINDIR%\Tools\idle\idle.pyw Description=IDLE bootstrap script Flags=0000000000000010 --- 2142,2165 ---- end item: Install File ! Source=..\Lib\idlelib\*.py ! Destination=%MAINDIR%\Lib\idlelib Description=Integrated DeveLopment Environment for Python Flags=0000000000000010 end item: Install File ! Source=..\Lib\idlelib\*.txt ! Destination=%MAINDIR%\Lib\idlelib Description=Integrated DeveLopment Environment for Python Flags=0000000000000010 end item: Install File ! Source=..\Lib\idlelib\Icons\* ! Destination=%MAINDIR%\Lib\idlelib\Icons Description=Integrated DeveLopment Environment for Python Flags=0000000000000010 end item: Install File ! Source=..\Lib\idlelib\idle.pyw ! Destination=%MAINDIR%\Lib\idlelib\idle.pyw Description=IDLE bootstrap script Flags=0000000000000010 *************** *** 2945,2949 **** Source=%MAINDIR%\pythonw.exe Destination=%GROUP%\IDLE (Python GUI).lnk ! Command Options="%MAINDIR%\Tools\idle\idle.pyw" Working Directory=%MAINDIR% Key Type=1536 --- 2945,2949 ---- Source=%MAINDIR%\pythonw.exe Destination=%GROUP%\IDLE (Python GUI).lnk ! Command Options="%MAINDIR%\Lib\idlelib\idle.pyw" Working Directory=%MAINDIR% Key Type=1536 From gvanrossum@users.sourceforge.net Sun Jun 15 21:40:35 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sun, 15 Jun 2003 13:40:35 -0700 Subject: [Python-checkins] python/dist/src/PCbuild python20.wse,1.125,1.126 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv25576 Modified Files: python20.wse Log Message: Install IDLE's .def files; these are essential for the configuration! Also install the start script from Tools/script/idle. (This may change again.) Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -d -r1.125 -r1.126 *** python20.wse 15 Jun 2003 19:42:39 -0000 1.125 --- python20.wse 15 Jun 2003 20:40:33 -0000 1.126 *************** *** 2154,2157 **** --- 2154,2163 ---- end item: Install File + Source=..\Lib\idlelib\*.def + Destination=%MAINDIR%\Lib\idlelib + Description=Integrated DeveLopment Environment for Python + Flags=0000000000000010 + end + item: Install File Source=..\Lib\idlelib\Icons\* Destination=%MAINDIR%\Lib\idlelib\Icons *************** *** 2160,2164 **** end item: Install File ! Source=..\Lib\idlelib\idle.pyw Destination=%MAINDIR%\Lib\idlelib\idle.pyw Description=IDLE bootstrap script --- 2166,2170 ---- end item: Install File ! Source=..\Tools\scripts\idle Destination=%MAINDIR%\Lib\idlelib\idle.pyw Description=IDLE bootstrap script From tim_one@users.sourceforge.net Sun Jun 15 23:06:00 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 15 Jun 2003 15:06:00 -0700 Subject: [Python-checkins] python/dist/src/Lib mimetools.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv9193/Lib Modified Files: mimetools.py Log Message: choose_boundary(): Incorporated a threadsafe incrementing counter, so that unique boundary strings within a program run are guaranteed. On Windows, duplicates were pretty likely, due to the coarse granularity of time.time. Toned down the absurdly optimistic claims in the docstring. Bugfix candidate. Index: mimetools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/mimetools.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** mimetools.py 9 Aug 2002 16:37:33 -0000 1.27 --- mimetools.py 15 Jun 2003 22:05:58 -0000 1.28 *************** *** 96,108 **** # ----------------- _prefix = None def choose_boundary(): ! """Return a random string usable as a multipart boundary. ! The method used is so that it is *very* unlikely that the same ! string of characters will every occur again in the Universe, ! so the caller needn't check the data it is packing for the ! occurrence of the boundary. The boundary contains dots so you have to quote it in the header.""" --- 96,124 ---- # ----------------- + try: + import thread + except ImportError: + import dummy_thread as thread + _counter_lock = thread.allocate_lock() + del thread + + _counter = 0 + def _get_next_counter(): + global _counter + _counter_lock.acquire() + _counter += 1 + result = _counter + _counter_lock.release() + return result _prefix = None def choose_boundary(): ! """Return a string usable as a multipart boundary. ! ! The string chosen is unique within a single program run, and ! incorporates the user id (if available), process id (if available), ! and current time. So it's very unlikely the returned string appears ! in message text, but there's no guarantee. The boundary contains dots so you have to quote it in the header.""" *************** *** 123,129 **** pid = '1' _prefix = hostid + '.' + uid + '.' + pid ! timestamp = '%.3f' % time.time() ! seed = `random.randint(0, 32767)` ! return _prefix + '.' + timestamp + '.' + seed --- 139,143 ---- pid = '1' _prefix = hostid + '.' + uid + '.' + pid ! return "%s.%.3f.%d" % (_prefix, time.time(), _get_next_counter()) From tim_one@users.sourceforge.net Sun Jun 15 23:12:25 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 15 Jun 2003 15:12:25 -0700 Subject: [Python-checkins] python/dist/src/Lib mimetools.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv10597/Lib Modified Files: mimetools.py Log Message: choose_boundary(): This no longer uses random, so stop importing it. Index: mimetools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/mimetools.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** mimetools.py 15 Jun 2003 22:05:58 -0000 1.28 --- mimetools.py 15 Jun 2003 22:12:23 -0000 1.29 *************** *** 126,130 **** global _prefix import time - import random if _prefix is None: import socket --- 126,129 ---- From loewis@users.sourceforge.net Sun Jun 15 23:28:07 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 15 Jun 2003 15:28:07 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib CREDITS.txt,1.8,1.9 aboutDialog.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv13436 Modified Files: CREDITS.txt aboutDialog.py Log Message: Make CREDITS.txt a Latin-1 file. Extend ViewFile to support file encodings. Index: CREDITS.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/CREDITS.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CREDITS.txt 12 Jun 2003 03:50:55 -0000 1.8 --- CREDITS.txt 15 Jun 2003 22:28:05 -0000 1.9 *************** *** 23,27 **** integration and persistent breakpoints). ! Hernan Foffani, Christos Georgiou, Martin v. Loewis, Jason Orendorff, Noam Raphael, Josh Robb, Nigel Rowe, and Bruce Sherwood have submitted useful patches. Thanks, guys! --- 23,27 ---- integration and persistent breakpoints). ! Hernan Foffani, Christos Georgiou, Martin v. Löwis, Jason Orendorff, Noam Raphael, Josh Robb, Nigel Rowe, and Bruce Sherwood have submitted useful patches. Thanks, guys! Index: aboutDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/aboutDialog.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** aboutDialog.py 12 Jun 2003 04:20:55 -0000 1.11 --- aboutDialog.py 15 Jun 2003 22:28:05 -0000 1.12 *************** *** 119,123 **** def ShowIDLECredits(self): ! self.ViewFile('About - Credits','CREDITS.txt') def ShowIDLEAbout(self): --- 119,123 ---- def ShowIDLECredits(self): ! self.ViewFile('About - Credits','CREDITS.txt', 'iso-8859-1') def ShowIDLEAbout(self): *************** *** 132,138 **** textView.TextViewer(self, title, None, data) ! def ViewFile(self,viewTitle,viewFile): fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),viewFile) ! textView.TextViewer(self,viewTitle,fn) def Ok(self, event=None): --- 132,151 ---- textView.TextViewer(self, title, None, data) ! def ViewFile(self, viewTitle, viewFile, encoding=None): fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),viewFile) ! if encoding: ! import codecs ! try: ! textFile = codecs.open(fn, 'r') ! except IOError: ! tkMessageBox.showerror(title='File Load Error', ! message='Unable to load file '+ ! `fileName`+' .') ! return ! else: ! data = textFile.read() ! else: ! data = None ! textView.TextViewer(self, viewTitle, fn, data=data) def Ok(self, event=None): From bcannon@users.sourceforge.net Sun Jun 15 23:33:30 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sun, 15 Jun 2003 15:33:30 -0700 Subject: [Python-checkins] python/dist/src/Lib inspect.py,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv14551/Lib Modified Files: inspect.py Log Message: Return None to signal that the module the object was defined in was not found when object has no __name__ attr but is needed to figure out location of object. Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** inspect.py 3 May 2003 09:09:01 -0000 1.43 --- inspect.py 15 Jun 2003 22:33:28 -0000 1.44 *************** *** 384,387 **** --- 384,389 ---- return sys.modules.get(modulesbyfile[file]) main = sys.modules['__main__'] + if not hasattr(object, '__name__'): + return None if hasattr(main, object.__name__): mainobject = getattr(main, object.__name__) From bcannon@users.sourceforge.net Sun Jun 15 23:57:46 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sun, 15 Jun 2003 15:57:46 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.103,1.104 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv19019/Doc/ref Modified Files: ref3.tex Log Message: Add explicit text for where an obindex call for generators was since obindex does not cause output of its argument. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** ref3.tex 12 May 2003 13:50:11 -0000 1.103 --- ref3.tex 15 Jun 2003 22:57:44 -0000 1.104 *************** *** 805,809 **** \code{0x08} is set if the function uses the \samp{**keywords} syntax to accept arbitrary keyword arguments; bit \code{0x20} is set if the ! function is a \obindex{generator}. Future feature declarations (\samp{from __future__ import division}) --- 805,810 ---- \code{0x08} is set if the function uses the \samp{**keywords} syntax to accept arbitrary keyword arguments; bit \code{0x20} is set if the ! function is a generator. ! \obindex{generator} Future feature declarations (\samp{from __future__ import division}) From tim_one@users.sourceforge.net Mon Jun 16 00:08:48 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 15 Jun 2003 16:08:48 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libsmtplib.tex,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv20932/Doc/lib Modified Files: libsmtplib.tex Log Message: ^D means EOF on Unix but not on Windows. Expand the example's prompt to tell Windows Truth too. Bugfix candidate. Index: libsmtplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsmtplib.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** libsmtplib.tex 8 Jan 2003 03:04:42 -0000 1.23 --- libsmtplib.tex 15 Jun 2003 23:08:45 -0000 1.24 *************** *** 51,55 **** \begin{excdesc}{SMTPSenderRefused} ! Sender address refused. In addition to the attributes set by on all \exception{SMTPResponseException} exceptions, this sets `sender' to the string that the SMTP server refused. --- 51,55 ---- \begin{excdesc}{SMTPSenderRefused} ! Sender address refused. In addition to the attributes set by on all \exception{SMTPResponseException} exceptions, this sets `sender' to the string that the SMTP server refused. *************** *** 99,106 **** \begin{methoddesc}{connect}{\optional{host\optional{, port}}} ! Connect to a host on a given port. The defaults are to connect to the local host at the standard SMTP port (25). If the hostname ends with a colon (\character{:}) followed by a ! number, that suffix will be stripped off and the number interpreted as the port number to use. This method is automatically invoked by the constructor if a --- 99,106 ---- \begin{methoddesc}{connect}{\optional{host\optional{, port}}} ! Connect to a host on a given port. The defaults are to connect to the local host at the standard SMTP port (25). If the hostname ends with a colon (\character{:}) followed by a ! number, that suffix will be stripped off and the number interpreted as the port number to use. This method is automatically invoked by the constructor if a *************** *** 258,262 **** This example prompts the user for addresses needed in the message envelope (`To' and `From' addresses), and the message to be ! delivered. Note that the headers to be included with the message must be included in the message as entered; this example doesn't do any processing of the \rfc{822} headers. In particular, the `To' and --- 258,262 ---- This example prompts the user for addresses needed in the message envelope (`To' and `From' addresses), and the message to be ! delivered. Note that the headers to be included with the message must be included in the message as entered; this example doesn't do any processing of the \rfc{822} headers. In particular, the `To' and *************** *** 272,276 **** fromaddr = prompt("From: ") toaddrs = prompt("To: ").split() ! print "Enter message, end with ^D:" # Add the From: and To: headers at the start! --- 272,276 ---- fromaddr = prompt("From: ") toaddrs = prompt("To: ").split() ! print "Enter message, end with ^D (Unix) or ^Z (Windows):" # Add the From: and To: headers at the start! From tim_one@users.sourceforge.net Mon Jun 16 00:13:37 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 15 Jun 2003 16:13:37 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.783,1.784 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv22005/Misc Modified Files: NEWS Log Message: mimetools.choose_boundary() news. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.783 retrieving revision 1.784 diff -C2 -d -r1.783 -r1.784 *** NEWS 14 Jun 2003 09:03:46 -0000 1.783 --- NEWS 15 Jun 2003 23:13:35 -0000 1.784 *************** *** 56,59 **** --- 56,63 ---- ----------------- + - mimetools.choose_boundary() could return duplicate strings at times, + especially likely on Windows. The strings returned are now guaranteed + unique within a single program run. + - thread.interrupt_main() raises KeyboardInterrupt in the main thread. dummy_thread has also been modified to try to simulate the behavior. From tim_one@users.sourceforge.net Mon Jun 16 00:26:32 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 15 Jun 2003 16:26:32 -0700 Subject: [Python-checkins] python/dist/src/Lib pdb.py,1.65,1.66 urllib2.py,1.49,1.50 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv24755/Lib Modified Files: pdb.py urllib2.py Log Message: Whitespace normalization. Index: pdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pdb.py,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** pdb.py 22 May 2003 14:46:12 -0000 1.65 --- pdb.py 15 Jun 2003 23:26:29 -0000 1.66 *************** *** 398,402 **** print 'Breakpoint index %r is not a number' % i continue ! if not (0 <= i < len(bdb.Breakpoint.bpbynumber)): print 'No breakpoint numbered', i --- 398,402 ---- print 'Breakpoint index %r is not a number' % i continue ! if not (0 <= i < len(bdb.Breakpoint.bpbynumber)): print 'No breakpoint numbered', i Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** urllib2.py 14 Jun 2003 05:51:25 -0000 1.49 --- urllib2.py 15 Jun 2003 23:26:29 -0000 1.50 *************** *** 413,417 **** return True return self.handler_order < other.handler_order ! class HTTPDefaultErrorHandler(BaseHandler): --- 413,417 ---- return True return self.handler_order < other.handler_order ! class HTTPDefaultErrorHandler(BaseHandler): From tim_one@users.sourceforge.net Mon Jun 16 00:26:32 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 15 Jun 2003 16:26:32 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_codeop.py,1.7,1.8 test_dummy_thread.py,1.6,1.7 test_grammar.py,1.46,1.47 test_mimetools.py,1.4,1.5 test_urllibnet.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv24755/Lib/test Modified Files: test_codeop.py test_dummy_thread.py test_grammar.py test_mimetools.py test_urllibnet.py Log Message: Whitespace normalization. Index: test_codeop.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codeop.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_codeop.py 17 May 2003 12:51:10 -0000 1.7 --- test_codeop.py 15 Jun 2003 23:26:30 -0000 1.8 *************** *** 66,75 **** PyCF_DONT_IMPLY_DEDENT)) self.assertEquals(compile_command("\n"), ! compile("pass", "", 'single', PyCF_DONT_IMPLY_DEDENT)) else: av("") av("\n") ! av("a = 1") av("\na = 1") --- 66,75 ---- PyCF_DONT_IMPLY_DEDENT)) self.assertEquals(compile_command("\n"), ! compile("pass", "", 'single', PyCF_DONT_IMPLY_DEDENT)) else: av("") av("\n") ! av("a = 1") av("\na = 1") *************** *** 126,132 **** ai("if 1:\n") ai("if 1:\n pass\n if 1:\n pass\n else:") ! ai("if 1:\n pass\n if 1:\n pass\n else:\n") ! ai("if 1:\n pass\n if 1:\n pass\n else:\n pass") ! ai("def x():") ai("def x():\n") --- 126,132 ---- ai("if 1:\n") ai("if 1:\n pass\n if 1:\n pass\n else:") ! ai("if 1:\n pass\n if 1:\n pass\n else:\n") ! ai("if 1:\n pass\n if 1:\n pass\n else:\n pass") ! ai("def x():") ai("def x():\n") *************** *** 157,161 **** ai("a b @") ai("a ** @") ! ai("a = ") ai("a = 9 +") --- 157,161 ---- ai("a b @") ai("a ** @") ! ai("a = ") ai("a = 9 +") Index: test_dummy_thread.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_dummy_thread.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_dummy_thread.py 13 Jun 2003 23:56:32 -0000 1.6 --- test_dummy_thread.py 15 Jun 2003 23:26:30 -0000 1.7 *************** *** 110,114 **** self.failUnlessRaises(KeyboardInterrupt, _thread.start_new_thread, call_interrupt, tuple()) ! def test_interrupt_in_main(self): # Make sure that if interrupt_main is called in main threat that --- 110,114 ---- self.failUnlessRaises(KeyboardInterrupt, _thread.start_new_thread, call_interrupt, tuple()) ! def test_interrupt_in_main(self): # Make sure that if interrupt_main is called in main threat that Index: test_grammar.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grammar.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** test_grammar.py 21 May 2003 17:34:50 -0000 1.46 --- test_grammar.py 15 Jun 2003 23:26:30 -0000 1.47 *************** *** 702,706 **** print [(i, s) for i in nums for s in strs] print [(i, s) for i in nums for s in [f for f in strs if "n" in f]] ! print [(lambda a:[a**i for i in range(a+1)])(j) for j in range(5)] def test_in_func(l): --- 702,706 ---- print [(i, s) for i in nums for s in strs] print [(i, s) for i in nums for s in [f for f in strs if "n" in f]] ! print [(lambda a:[a**i for i in range(a+1)])(j) for j in range(5)] def test_in_func(l): Index: test_mimetools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mimetools.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_mimetools.py 22 May 2003 17:32:40 -0000 1.4 --- test_mimetools.py 15 Jun 2003 23:26:30 -0000 1.5 *************** *** 49,51 **** if __name__=="__main__": test_main() - --- 49,50 ---- Index: test_urllibnet.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllibnet.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_urllibnet.py 16 May 2003 15:35:10 -0000 1.4 --- test_urllibnet.py 15 Jun 2003 23:26:30 -0000 1.5 *************** *** 85,89 **** def test_fileno(self): ! if (sys.platform in ('win32',) or not hasattr(os, 'fdopen')): # On Windows, socket handles are not file descriptors; this --- 85,89 ---- def test_fileno(self): ! if (sys.platform in ('win32',) or not hasattr(os, 'fdopen')): # On Windows, socket handles are not file descriptors; this From niemeyer@users.sourceforge.net Mon Jun 16 03:49:44 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Sun, 15 Jun 2003 19:49:44 -0700 Subject: [Python-checkins] python/dist/src/Lib xmlrpclib.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv27917/Lib Modified Files: xmlrpclib.py Log Message: Made DateTime's constructor accept a time.struct_time class, besides plain tuples. Index: xmlrpclib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xmlrpclib.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** xmlrpclib.py 12 May 2003 20:19:36 -0000 1.27 --- xmlrpclib.py 16 Jun 2003 02:49:42 -0000 1.28 *************** *** 344,348 **** def __init__(self, value=0): if not isinstance(value, StringType): ! if not isinstance(value, TupleType): if value == 0: value = time.time() --- 344,348 ---- def __init__(self, value=0): if not isinstance(value, StringType): ! if not isinstance(value, (TupleType, time.struct_time)): if value == 0: value = time.time() From jackjansen@users.sourceforge.net Mon Jun 16 10:47:27 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 16 Jun 2003 02:47:27 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1:/tmp/cvs-serv26193 Modified Files: Makefile Log Message: Patch #755147 by Brian Lenihan: - Build idle from new location - use ln -fsn when linking files. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** Makefile 25 May 2003 22:01:32 -0000 1.41 --- Makefile 16 Jun 2003 09:47:25 -0000 1.42 *************** *** 25,29 **** FILEMODE=644 INSTALL=/usr/bin/install -c ! INSTALL_SYMLINK=ln -fs INSTALL_PROGRAM=${INSTALL} INSTALL_SCRIPT= ${INSTALL_PROGRAM} --- 25,29 ---- FILEMODE=644 INSTALL=/usr/bin/install -c ! INSTALL_SYMLINK=ln -fsn INSTALL_PROGRAM=${INSTALL} INSTALL_SCRIPT= ${INSTALL_PROGRAM} *************** *** 153,163 **** --python $(INSTALLED_PYTHONW) \ --output $(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app \ ! --extra $(srcdir)/Tools/idle \ ! $(srcdir)/Tools/idle/idle ; \ $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ --python $(INSTALLED_PYTHONW) \ --output $(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app \ ! --extra $(srcdir)/Tools/idle:Contents/Resources/idlelib \ ! $(srcdir)/Tools/idle/idle ; \ fi --- 153,163 ---- --python $(INSTALLED_PYTHONW) \ --output $(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app \ ! --extra $(srcdir)/Lib/idlelib \ ! $(srcdir)/Lib/idlelib/idle ; \ $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ --python $(INSTALLED_PYTHONW) \ --output $(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app \ ! --extra $(srcdir)/Lib/idlelib:Contents/Resources/idlelib \ ! $(srcdir)/Lib/idlelib/idle ; \ fi From jackjansen@users.sourceforge.net Mon Jun 16 14:53:43 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 16 Jun 2003 06:53:43 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.784,1.785 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv22792 Modified Files: NEWS Log Message: Added two mac items (pimp auto-update and OSA property access). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.784 retrieving revision 1.785 diff -C2 -d -r1.784 -r1.785 *** NEWS 15 Jun 2003 23:13:35 -0000 1.784 --- NEWS 16 Jun 2003 13:53:40 -0000 1.785 *************** *** 177,180 **** --- 177,183 ---- goes to sleep, allowing other threads to run. It's currently only supported on OSX, in the Mach-O version. + - The OSA modules now allow direct access to properties of the + toplevel application class (in AppleScript terminology). + - The Package Manager can now update itself. What's New in Python 2.3 beta 1? From jackjansen@users.sourceforge.net Mon Jun 16 14:55:23 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 16 Jun 2003 06:55:23 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts zappycfiles.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv22970/Mac/scripts Modified Files: zappycfiles.py Log Message: Import EasyDialogs only when needed, so this works if there is no window manager (if it isn't needed). Index: zappycfiles.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/zappycfiles.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** zappycfiles.py 5 Feb 2003 22:53:29 -0000 1.5 --- zappycfiles.py 16 Jun 2003 13:55:21 -0000 1.6 *************** *** 3,7 **** import os import sys - import EasyDialogs # set doit true to actually delete files --- 3,6 ---- *************** *** 12,15 **** --- 11,15 ---- if not sys.argv[1:]: if os.name == 'mac': + import EasyDialogs dir = EasyDialogs.AskFolder(message='Directory to zap pyc files in') if not dir: From jackjansen@users.sourceforge.net Mon Jun 16 14:56:07 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 16 Jun 2003 06:56:07 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules ColorPickermodule.c,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv23170/Mac/Modules Modified Files: ColorPickermodule.c Log Message: This wasn't ansified. Fixed. Index: ColorPickermodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ColorPickermodule.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ColorPickermodule.c 24 May 2003 20:14:24 -0000 1.4 --- ColorPickermodule.c 16 Jun 2003 13:56:05 -0000 1.5 *************** *** 38,44 **** static PyObject * ! cp_GetColor(self, args) ! PyObject *self; /* Not used */ ! PyObject *args; { RGBColor inColor, outColor; --- 38,42 ---- static PyObject * ! cp_GetColor(PyObject *self, PyObject *args) { RGBColor inColor, outColor; *************** *** 69,75 **** ; ! void initColorPicker(); ! ! void initColorPicker() { PyObject *m; --- 67,71 ---- ; ! void initColorPicker(void) { PyObject *m; From jackjansen@users.sourceforge.net Mon Jun 16 14:57:11 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 16 Jun 2003 06:57:11 -0700 Subject: [Python-checkins] python/dist/src/Mac ReadMe,1.47,1.48 Message-ID: Update of /cvsroot/python/python/dist/src/Mac In directory sc8-pr-cvs1:/tmp/cvs-serv23289/Mac Modified Files: ReadMe Log Message: Added a note about FSRef tests failing on MacOS 8.6. Index: ReadMe =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/ReadMe,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** ReadMe 21 Feb 2003 22:33:37 -0000 1.47 --- ReadMe 16 Jun 2003 13:57:09 -0000 1.48 *************** *** 74,78 **** It is probably a good idea to run the automatic tests. Start ! Python and "import test.regrtest ; test.regrtest.main()". test_socket and test_logging fail, this problem is being investigated. --- 74,81 ---- It is probably a good idea to run the automatic tests. Start ! Python and "import test.regrtest ; test.regrtest.main()". ! ! On MacOS 8.6 a number of tests will fail because FSRefs are not ! supported. test_socket and test_logging fail, this problem is being investigated. From jackjansen@users.sourceforge.net Mon Jun 16 16:10:49 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 16 Jun 2003 08:10:49 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/Dist/resources postflight,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist/resources In directory sc8-pr-cvs1:/tmp/cvs-serv3242/resources Modified Files: postflight Log Message: Only fix up pathnames in installed scripts when needed, i.e. when not installing to /. Pathnames are correct for installing to / since the DESTDIR patch. Index: postflight =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Dist/resources/postflight,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** postflight 9 May 2003 15:09:50 -0000 1.4 --- postflight 16 Jun 2003 15:10:47 -0000 1.5 *************** *** 67,77 **** fi ! ! # The link in the app bundles and in pydoc need updating. ! installed_python=$DEST/Library/Frameworks/Python.framework/Versions/$PYVER/Resources/Python.app/Contents/MacOS/python ! for app in BuildApplet IDLE PackageManager PythonIDE; do ! ln -fsh $installed_python \ ! $DEST/Applications/MacPython-$PYVER/$app.app/Contents/MacOS ! ed -s $DEST/Applications/MacPython-$PYVER/$app.app/Contents/MacOS/$app << xyzzy 1c #!$installed_python --- 67,77 ---- fi ! if [ "$DEST" != "/" ]; then ! # The link in the app bundles and in pydoc need updating. ! installed_python=$DEST/Library/Frameworks/Python.framework/Versions/$PYVER/Resources/Python.app/Contents/MacOS/python ! for app in BuildApplet IDLE PackageManager PythonIDE; do ! ln -fsh $installed_python \ ! $DEST/Applications/MacPython-$PYVER/$app.app/Contents/MacOS ! ed -s $DEST/Applications/MacPython-$PYVER/$app.app/Contents/MacOS/$app << xyzzy 1c #!$installed_python *************** *** 80,84 **** q xyzzy ! ed -s $DEST/Library/Frameworks/Python.framework/Versions/$PYVER/bin/pydoc << xyzzy 1c #!$installed_python --- 80,84 ---- q xyzzy ! ed -s $DEST/Library/Frameworks/Python.framework/Versions/$PYVER/bin/pydoc << xyzzy 1c #!$installed_python *************** *** 87,89 **** q xyzzy ! done --- 87,90 ---- q xyzzy ! done ! fi From jackjansen@users.sourceforge.net Mon Jun 16 16:12:18 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Mon, 16 Jun 2003 08:12:18 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/Dist build,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist In directory sc8-pr-cvs1:/tmp/cvs-serv3493 Modified Files: build Log Message: Allow passing a build directory on the command line. Also, if the build directory is found to exist we don't clean it up. We also use configure -C. All this lets us keep build directories, which graeatly speeds up the process of debugging installers. Index: build =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Dist/build,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** build 9 May 2003 15:08:39 -0000 1.4 --- build 16 Jun 2003 15:12:16 -0000 1.5 *************** *** 23,27 **** #TMPDIR=/projects/_py - BUILDROOT=$TMPDIR/build INSTALLROOT=$TMPDIR/install DMGDIR=$TMPDIR/dmg --- 23,26 ---- *************** *** 31,37 **** WASTEDIR=$PYTHONSRC/../waste # Setup ! mkdir -p $BUILDROOT ! mkdir -p $INSTALLROOT rm -rf $DMGDIR mkdir -p $DMGDIR/root --- 30,51 ---- WASTEDIR=$PYTHONSRC/../waste + case x$1 in + x) + BUILDROOT=$TMPDIR/build + ;; + *) + BUILDROOT=$1 + ;; + esac + # Setup ! if [ -e $BUILDROOT ]; then ! echo Using existing build directory $BUILDROOT ! CLEANBUILD=no ! else ! echo Creating clean build directory $BUILDROOT ! CLEANBUILD=yes ! mkdir -p $BUILDROOT ! fi rm -rf $DMGDIR mkdir -p $DMGDIR/root *************** *** 69,75 **** fi ! $PYTHONSRC/configure --enable-framework=$INSTALLROOT/Library/Frameworks LDFLAGS=-Wl,-x make ! make DIRMODE=775 EXEMODE=775 FILEMODE=664 frameworkinstall if [ "$builddocs" = "y" -o "$builddocs" = "Y" ]; then --- 83,89 ---- fi ! $PYTHONSRC/configure -C --enable-framework LDFLAGS=-Wl,-x make ! make DIRMODE=775 EXEMODE=775 FILEMODE=664 DESTDIR=$INSTALLROOT frameworkinstall if [ "$builddocs" = "y" -o "$builddocs" = "Y" ]; then *************** *** 123,132 **** if [ $DOCLEANUP = yes ]; then echo "Cleaning up..." ! rm -rf $BUILDROOT rm -rf $INSTALLROOT rm -rf $DMGDIR else echo "Cleanup is disabled. You should remove these dirs when done:" ! echo " $BUILDROOT" echo " $INSTALLROOT" echo " $DMGDIR" --- 137,150 ---- if [ $DOCLEANUP = yes ]; then echo "Cleaning up..." ! if [ $CLEANBUILD = yes ]; then ! rm -rf $BUILDROOT ! fi rm -rf $INSTALLROOT rm -rf $DMGDIR else echo "Cleanup is disabled. You should remove these dirs when done:" ! if [ $CLEANBUILD = yes ]; then ! echo " $BUILDROOT" ! fi echo " $INSTALLROOT" echo " $DMGDIR" From kbk@users.sourceforge.net Mon Jun 16 19:46:44 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Mon, 16 Jun 2003 11:46:44 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib aboutDialog.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv5059 Modified Files: aboutDialog.py Log Message: Add ':' after IDLE version, fix spacing on a couple of lines I missed Index: aboutDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/aboutDialog.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** aboutDialog.py 15 Jun 2003 22:28:05 -0000 1.12 --- aboutDialog.py 16 Jun 2003 18:46:42 -0000 1.13 *************** *** 55,59 **** labelEmail = Label(frameBg, text='email: idle-dev@python.org', justify=LEFT, fg=self.fg, bg=self.bg) ! labelEmail.grid(row=6,column=0,columnspan=2,sticky=W,padx=10,pady=0) labelWWW = Label(frameBg, text='www: http://www.python.org/idle/', justify=LEFT, fg=self.fg, bg=self.bg) --- 55,60 ---- labelEmail = Label(frameBg, text='email: idle-dev@python.org', justify=LEFT, fg=self.fg, bg=self.bg) ! labelEmail.grid(row=6, column=0, columnspan=2, ! sticky=W, padx=10, pady=0) labelWWW = Label(frameBg, text='www: http://www.python.org/idle/', justify=LEFT, fg=self.fg, bg=self.bg) *************** *** 91,95 **** height=2, bg=self.bg).grid(row=11, column=0, sticky=EW, columnspan=3, padx=5, pady=5) ! idle_v = Label(frameBg, text='IDLE version ' + idlever.IDLE_VERSION, fg=self.fg, bg=self.bg) idle_v.grid(row=12, column=0, sticky=W, padx=10, pady=0) --- 92,96 ---- height=2, bg=self.bg).grid(row=11, column=0, sticky=EW, columnspan=3, padx=5, pady=5) ! idle_v = Label(frameBg, text='IDLE version: ' + idlever.IDLE_VERSION, fg=self.fg, bg=self.bg) idle_v.grid(row=12, column=0, sticky=W, padx=10, pady=0) *************** *** 133,137 **** def ViewFile(self, viewTitle, viewFile, encoding=None): ! fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),viewFile) if encoding: import codecs --- 134,138 ---- def ViewFile(self, viewTitle, viewFile, encoding=None): ! fn = os.path.join(os.path.abspath(os.path.dirname(__file__)), viewFile) if encoding: import codecs *************** *** 157,161 **** def run(): import aboutDialog ! aboutDialog.AboutDialog(root,'About') Button(root, text='Dialog', command=run).pack() root.mainloop() --- 158,162 ---- def run(): import aboutDialog ! aboutDialog.AboutDialog(root, 'About') Button(root, text='Dialog', command=run).pack() root.mainloop() From kbk@users.sourceforge.net Mon Jun 16 19:51:30 2003 From: kbk@users.sourceforge.net (kbk@users.sourceforge.net) Date: Mon, 16 Jun 2003 11:51:30 -0700 Subject: [Python-checkins] python/dist/src/Modules threadmodule.c,2.55,2.56 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv5830 Modified Files: threadmodule.c Log Message: Correct function name. Index: threadmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/threadmodule.c,v retrieving revision 2.55 retrieving revision 2.56 diff -C2 -d -r2.55 -r2.56 *** threadmodule.c 13 Jun 2003 21:59:45 -0000 2.55 --- threadmodule.c 16 Jun 2003 18:51:28 -0000 2.56 *************** *** 280,284 **** static PyObject * ! sys_interrupt_main(PyObject * self, PyObject * args) { PyErr_SetInterrupt(); --- 280,284 ---- static PyObject * ! thread_PyThread_interrupt_main(PyObject * self) { PyErr_SetInterrupt(); *************** *** 291,295 **** \n\ Raise a KeyboardInterrupt in the main thread.\n\ ! A subthread can use this method to interrupt the main thread." ); --- 291,295 ---- \n\ Raise a KeyboardInterrupt in the main thread.\n\ ! A subthread can use this function to interrupt the main thread." ); *************** *** 356,360 **** {"exit", (PyCFunction)thread_PyThread_exit_thread, METH_NOARGS, exit_doc}, ! {"interrupt_main", (PyCFunction)sys_interrupt_main, METH_NOARGS, interrupt_doc}, {"get_ident", (PyCFunction)thread_get_ident, --- 356,360 ---- {"exit", (PyCFunction)thread_PyThread_exit_thread, METH_NOARGS, exit_doc}, ! {"interrupt_main", (PyCFunction)thread_PyThread_interrupt_main, METH_NOARGS, interrupt_doc}, {"get_ident", (PyCFunction)thread_get_ident, From jhylton@users.sourceforge.net Mon Jun 16 21:19:52 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 16 Jun 2003 13:19:52 -0700 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.145,2.146 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv21457 Modified Files: cPickle.c Log Message: Remove many blanket try/except clauses. SF bug [ 751276 ] cPickle doesn't raise error, pickle does (recursiondepth) Most of the calls to PyErr_Clear() were intended to catch & clear an attribute error and try something different. Guard all those cases with a PyErr_ExceptionMatches() and fail if some other error occurred. The other error is likely a bug in the user code. This is basically the C equivalent of changing "except:" to "except AttributeError:" Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.145 retrieving revision 2.146 diff -C2 -d -r2.145 -r2.146 *** cPickle.c 21 May 2003 21:29:47 -0000 2.145 --- cPickle.c 16 Jun 2003 20:19:49 -0000 2.146 *************** *** 834,839 **** module = PyObject_GetAttrString(global, "__module__"); ! if (module) return module; ! PyErr_Clear(); if (!( modules_dict = PySys_GetObject("modules"))) --- 834,843 ---- module = PyObject_GetAttrString(global, "__module__"); ! if (module) ! return module; ! if (PyErr_ExceptionMatches(PyExc_AttributeError)) ! PyErr_Clear(); ! else ! return NULL; if (!( modules_dict = PySys_GetObject("modules"))) *************** *** 847,851 **** global_name_attr = PyObject_GetAttr(module, global_name); if (!global_name_attr) { ! PyErr_Clear(); continue; } --- 851,858 ---- global_name_attr = PyObject_GetAttr(module, global_name); if (!global_name_attr) { ! if (PyErr_ExceptionMatches(PyExc_AttributeError)) ! PyErr_Clear(); ! else ! return NULL; continue; } *************** *** 1815,1819 **** } else { ! PyErr_Clear(); } --- 1822,1829 ---- } else { ! if (PyErr_ExceptionMatches(PyExc_AttributeError)) ! PyErr_Clear(); ! else ! goto finally; } *************** *** 1860,1867 **** } else { ! PyErr_Clear(); if (!( state = PyObject_GetAttr(args, __dict___str))) { ! PyErr_Clear(); res = 0; goto finally; --- 1870,1883 ---- } else { ! if (PyErr_ExceptionMatches(PyExc_AttributeError)) ! PyErr_Clear(); ! else ! goto finally; if (!( state = PyObject_GetAttr(args, __dict___str))) { ! if (PyErr_ExceptionMatches(PyExc_AttributeError)) ! PyErr_Clear(); ! else ! goto finally; res = 0; goto finally; *************** *** 2142,2146 **** if (temp == NULL) { ! PyErr_Clear(); use_newobj = 0; } --- 2158,2165 ---- if (temp == NULL) { ! if (PyErr_ExceptionMatches(PyExc_AttributeError)) ! PyErr_Clear(); ! else ! return -1; use_newobj = 0; } *************** *** 2177,2182 **** ob_dot_class = PyObject_GetAttr(ob, __class___str); ! if (ob_dot_class == NULL) ! PyErr_Clear(); i = ob_dot_class != cls; /* true iff a problem */ Py_XDECREF(ob_dot_class); --- 2196,2206 ---- ob_dot_class = PyObject_GetAttr(ob, __class___str); ! if (ob_dot_class == NULL) { ! if (PyErr_ExceptionMatches( ! PyExc_AttributeError)) ! PyErr_Clear(); ! else ! return -1; ! } i = ob_dot_class != cls; /* true iff a problem */ Py_XDECREF(ob_dot_class); *************** *** 2448,2452 **** } else { ! PyErr_Clear(); /* Check for a __reduce__ method. */ __reduce__ = PyObject_GetAttr(args, __reduce___str); --- 2472,2479 ---- } else { ! if (PyErr_ExceptionMatches(PyExc_AttributeError)) ! PyErr_Clear(); ! else ! goto finally; /* Check for a __reduce__ method. */ __reduce__ = PyObject_GetAttr(args, __reduce___str); *************** *** 3565,3569 **** __getinitargs__ = PyObject_GetAttr(cls, ! __getinitargs___str); if (!__getinitargs__) { /* We have a class with no __getinitargs__, --- 3592,3596 ---- __getinitargs__ = PyObject_GetAttr(cls, ! __getinitargs___str); if (!__getinitargs__) { /* We have a class with no __getinitargs__, *************** *** 4254,4257 **** --- 4281,4286 ---- return 0; } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) + return -1; PyErr_Clear(); From jhylton@users.sourceforge.net Mon Jun 16 21:38:17 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 16 Jun 2003 13:38:17 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.785,1.786 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv25252 Modified Files: NEWS Log Message: Add item about new threading module functions. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.785 retrieving revision 1.786 diff -C2 -d -r1.785 -r1.786 *** NEWS 16 Jun 2003 13:53:40 -0000 1.785 --- NEWS 16 Jun 2003 20:38:15 -0000 1.786 *************** *** 85,88 **** --- 85,93 ---- no more. + - The threading module has new functions settrace() and setprofile() + that cooperate with the functions of the same name in the sys + module. A function registered with the threading module will + be used for all threads it creates. + - copy.py: applied SF patch 707900, fixing bug 702858, by Steven Taschuk. Copying a new-style class that had a reference to itself From nascheme@users.sourceforge.net Mon Jun 16 22:03:09 2003 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Mon, 16 Jun 2003 14:03:09 -0700 Subject: [Python-checkins] python/dist/src/Python import.c,2.220,2.221 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv29262/Python Modified Files: import.c Log Message: Don't use the module object setattr when importing submodules. Instead, operate on the module dictionary directly. This prevents spurious depreciation warnings from being raised if a submodule name shadows a builtin name. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.220 retrieving revision 2.221 diff -C2 -d -r2.220 -r2.221 *** import.c 23 Mar 2003 14:31:01 -0000 2.220 --- import.c 16 Jun 2003 21:03:07 -0000 2.221 *************** *** 2212,2220 **** } static PyObject * import_submodule(PyObject *mod, char *subname, char *fullname) { PyObject *modules = PyImport_GetModuleDict(); ! PyObject *m, *res = NULL; /* Require: --- 2212,2254 ---- } + static int + add_submodule(PyObject *mod, PyObject *submod, char *fullname, char *subname, + PyObject *modules) + { + if (mod == Py_None) + return 1; + /* Irrespective of the success of this load, make a + reference to it in the parent package module. A copy gets + saved in the modules dictionary under the full name, so get a + reference from there, if need be. (The exception is when the + load failed with a SyntaxError -- then there's no trace in + sys.modules. In that case, of course, do nothing extra.) */ + if (submod == NULL) { + submod = PyDict_GetItemString(modules, fullname); + if (submod == NULL) + return 1; + } + if (PyModule_Check(mod)) { + /* We can't use setattr here since it can give a + * spurious warning if the submodule name shadows a + * builtin name */ + PyObject *dict = PyModule_GetDict(mod); + if (!dict) + return 0; + if (PyDict_SetItemString(dict, subname, submod) < 0) + return 0; + } + else { + if (PyObject_SetAttrString(mod, subname, submod) < 0) + return 0; + } + return 1; + } + static PyObject * import_submodule(PyObject *mod, char *subname, char *fullname) { PyObject *modules = PyImport_GetModuleDict(); ! PyObject *m = NULL; /* Require: *************** *** 2258,2278 **** if (fp) fclose(fp); ! if (mod != Py_None) { ! /* Irrespective of the success of this load, make a ! reference to it in the parent package module. ! A copy gets saved in the modules dictionary ! under the full name, so get a reference from ! there, if need be. (The exception is when ! the load failed with a SyntaxError -- then ! there's no trace in sys.modules. In that case, ! of course, do nothing extra.) */ ! res = m; ! if (res == NULL) ! res = PyDict_GetItemString(modules, fullname); ! if (res != NULL && ! PyObject_SetAttrString(mod, subname, res) < 0) { ! Py_XDECREF(m); ! m = NULL; ! } } } --- 2292,2298 ---- if (fp) fclose(fp); ! if (!add_submodule(mod, m, fullname, subname, modules)) { ! Py_XDECREF(m); ! m = NULL; } } From bcannon@users.sourceforge.net Mon Jun 16 22:54:52 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon, 16 Jun 2003 14:54:52 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_posixpath.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv9825/Lib/test Modified Files: test_posixpath.py Log Message: Complete rewrite of tests by Walter Dorwald as unittest tests. Index: test_posixpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_posixpath.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_posixpath.py 12 Dec 2002 20:30:20 -0000 1.5 --- test_posixpath.py 16 Jun 2003 21:54:50 -0000 1.6 *************** *** 1,45 **** ! import posixpath ! errors = 0 ! def tester(fn, wantResult): ! gotResult = eval(fn) ! if wantResult != gotResult: ! print "error!" ! print "evaluated: " + str(fn) ! print "should be: " + str(wantResult) ! print " returned: " + str(gotResult) ! print "" ! global errors ! errors = errors + 1 ! tester('posixpath.splitdrive("/foo/bar")', ('', '/foo/bar')) ! tester('posixpath.split("/foo/bar")', ('/foo', 'bar')) ! tester('posixpath.split("/")', ('/', '')) ! tester('posixpath.split("foo")', ('', 'foo')) ! tester('posixpath.splitext("foo.ext")', ('foo', '.ext')) ! tester('posixpath.splitext("/foo/foo.ext")', ('/foo/foo', '.ext')) ! tester('posixpath.splitext(".ext")', ('', '.ext')) ! tester('posixpath.splitext("/foo.ext/foo")', ('/foo.ext/foo', '')) ! tester('posixpath.splitext("foo.ext/")', ('foo.ext/', '')) ! tester('posixpath.splitext("")', ('', '')) ! tester('posixpath.splitext("foo.bar.ext")', ('foo.bar', '.ext')) ! tester('posixpath.isabs("/")', 1) ! tester('posixpath.isabs("/foo")', 1) ! tester('posixpath.isabs("/foo/bar")', 1) ! tester('posixpath.isabs("foo/bar")', 0) ! tester('posixpath.commonprefix(["/home/swenson/spam", "/home/swen/spam"])', ! "/home/swen") ! tester('posixpath.commonprefix(["/home/swen/spam", "/home/swen/eggs"])', ! "/home/swen/") ! tester('posixpath.commonprefix(["/home/swen/spam", "/home/swen/spam"])', ! "/home/swen/spam") ! if errors: ! print str(errors) + " errors." ! else: ! print "No errors. Thank your lucky stars." --- 1,394 ---- ! import unittest ! from test import test_support ! import posixpath, os ! class PosixPathTest(unittest.TestCase): ! def assertIs(self, a, b): ! self.assert_(a is b) ! def test_normcase(self): ! # Check that normcase() is idempotent ! p = "FoO/./BaR" ! p = posixpath.normcase(p) ! self.assertEqual(p, posixpath.normcase(p)) ! self.assertRaises(TypeError, posixpath.normcase) ! def test_join(self): ! self.assertEqual(posixpath.join("/foo", "bar", "/bar", "baz"), "/bar/baz") ! self.assertEqual(posixpath.join("/foo", "bar", "baz"), "/foo/bar/baz") ! self.assertEqual(posixpath.join("/foo/", "bar/", "baz/"), "/foo/bar/baz/") ! self.assertRaises(TypeError, posixpath.join) ! def test_splitdrive(self): ! self.assertEqual(posixpath.splitdrive("/foo/bar"), ("", "/foo/bar")) ! ! self.assertRaises(TypeError, posixpath.splitdrive) ! ! def test_split(self): ! self.assertEqual(posixpath.split("/foo/bar"), ("/foo", "bar")) ! self.assertEqual(posixpath.split("/"), ("/", "")) ! self.assertEqual(posixpath.split("foo"), ("", "foo")) ! self.assertEqual(posixpath.split("////foo"), ("////", "foo")) ! self.assertEqual(posixpath.split("//foo//bar"), ("//foo", "bar")) ! ! self.assertRaises(TypeError, posixpath.split) ! ! def test_splitext(self): ! self.assertEqual(posixpath.splitext("foo.ext"), ("foo", ".ext")) ! self.assertEqual(posixpath.splitext("/foo/foo.ext"), ("/foo/foo", ".ext")) ! self.assertEqual(posixpath.splitext(".ext"), ("", ".ext")) ! self.assertEqual(posixpath.splitext("/foo.ext/foo"), ("/foo.ext/foo", "")) ! self.assertEqual(posixpath.splitext("foo.ext/"), ("foo.ext/", "")) ! self.assertEqual(posixpath.splitext(""), ("", "")) ! self.assertEqual(posixpath.splitext("foo.bar.ext"), ("foo.bar", ".ext")) ! ! self.assertRaises(TypeError, posixpath.splitext) ! ! def test_isabs(self): ! self.assertIs(posixpath.isabs(""), False) ! self.assertIs(posixpath.isabs("/"), True) ! self.assertIs(posixpath.isabs("/foo"), True) ! self.assertIs(posixpath.isabs("/foo/bar"), True) ! self.assertIs(posixpath.isabs("foo/bar"), False) ! ! self.assertRaises(TypeError, posixpath.isabs) ! ! def test_splitdrive(self): ! self.assertEqual(posixpath.splitdrive("/foo/bar"), ("", "/foo/bar")) ! ! self.assertRaises(TypeError, posixpath.splitdrive) ! ! def test_basename(self): ! self.assertEqual(posixpath.basename("/foo/bar"), "bar") ! self.assertEqual(posixpath.basename("/"), "") ! self.assertEqual(posixpath.basename("foo"), "foo") ! self.assertEqual(posixpath.basename("////foo"), "foo") ! self.assertEqual(posixpath.basename("//foo//bar"), "bar") ! ! self.assertRaises(TypeError, posixpath.basename) ! ! def test_dirname(self): ! self.assertEqual(posixpath.dirname("/foo/bar"), "/foo") ! self.assertEqual(posixpath.dirname("/"), "/") ! self.assertEqual(posixpath.dirname("foo"), "") ! self.assertEqual(posixpath.dirname("////foo"), "////") ! self.assertEqual(posixpath.dirname("//foo//bar"), "//foo") ! ! self.assertRaises(TypeError, posixpath.dirname) ! ! def test_commonprefix(self): ! self.assertEqual( ! posixpath.commonprefix([]), ! "" ! ) ! self.assertEqual( ! posixpath.commonprefix(["/home/swenson/spam", "/home/swen/spam"]), ! "/home/swen" ! ) ! self.assertEqual( ! posixpath.commonprefix(["/home/swen/spam", "/home/swen/eggs"]), ! "/home/swen/" ! ) ! self.assertEqual( ! posixpath.commonprefix(["/home/swen/spam", "/home/swen/spam"]), ! "/home/swen/spam" ! ) ! ! def test_getsize(self): ! f = open(test_support.TESTFN, "wb") ! try: ! f.write("foo") ! f.close() ! self.assertEqual(posixpath.getsize(test_support.TESTFN), 3) ! finally: ! if not f.closed: ! f.close() ! os.remove(test_support.TESTFN) ! ! def test_time(self): ! f = open(test_support.TESTFN, "wb") ! try: ! f.write("foo") ! f.close() ! f = open(test_support.TESTFN, "ab") ! f.write("bar") ! f.close() ! f = open(test_support.TESTFN, "rb") ! d = f.read() ! f.close() ! self.assertEqual(d, "foobar") ! ! self.assert_( ! posixpath.getctime(test_support.TESTFN) <= ! posixpath.getmtime(test_support.TESTFN) ! ) ! finally: ! if not f.closed: ! f.close() ! os.remove(test_support.TESTFN) ! ! def test_islink(self): ! self.assertIs(posixpath.islink(test_support.TESTFN + "1"), False) ! f = open(test_support.TESTFN + "1", "wb") ! try: ! f.write("foo") ! f.close() ! self.assertIs(posixpath.islink(test_support.TESTFN + "1"), False) ! if hasattr(os, "symlink"): ! os.symlink(test_support.TESTFN + "1", test_support.TESTFN + "2") ! self.assertIs(posixpath.islink(test_support.TESTFN + "2"), True) ! os.remove(test_support.TESTFN + "1") ! self.assertIs(posixpath.islink(test_support.TESTFN + "2"), True) ! self.assertIs(posixpath.exists(test_support.TESTFN + "2"), False) ! finally: ! if not f.close(): ! f.close() ! try: ! os.remove(test_support.TESTFN + "1") ! except os.error: ! pass ! try: ! os.remove(test_support.TESTFN + "2") ! except os.error: ! pass ! ! self.assertRaises(TypeError, posixpath.islink) ! ! def test_exists(self): ! self.assertIs(posixpath.exists(test_support.TESTFN), False) ! f = open(test_support.TESTFN, "wb") ! try: ! f.write("foo") ! f.close() ! self.assertIs(posixpath.exists(test_support.TESTFN), True) ! finally: ! if not f.close(): ! f.close() ! try: ! os.remove(test_support.TESTFN) ! except os.error: ! pass ! ! self.assertRaises(TypeError, posixpath.exists) ! ! def test_isdir(self): ! self.assertIs(posixpath.isdir(test_support.TESTFN), False) ! f = open(test_support.TESTFN, "wb") ! try: ! f.write("foo") ! f.close() ! self.assertIs(posixpath.isdir(test_support.TESTFN), False) ! os.remove(test_support.TESTFN) ! os.mkdir(test_support.TESTFN) ! self.assertIs(posixpath.isdir(test_support.TESTFN), True) ! os.rmdir(test_support.TESTFN) ! finally: ! if not f.close(): ! f.close() ! try: ! os.remove(test_support.TESTFN) ! except os.error: ! pass ! try: ! os.rmdir(test_support.TESTFN) ! except os.error: ! pass ! ! self.assertRaises(TypeError, posixpath.isdir) ! ! def test_isfile(self): ! self.assertIs(posixpath.isfile(test_support.TESTFN), False) ! f = open(test_support.TESTFN, "wb") ! try: ! f.write("foo") ! f.close() ! self.assertIs(posixpath.isfile(test_support.TESTFN), True) ! os.remove(test_support.TESTFN) ! os.mkdir(test_support.TESTFN) ! self.assertIs(posixpath.isfile(test_support.TESTFN), False) ! os.rmdir(test_support.TESTFN) ! finally: ! if not f.close(): ! f.close() ! try: ! os.remove(test_support.TESTFN) ! except os.error: ! pass ! try: ! os.rmdir(test_support.TESTFN) ! except os.error: ! pass ! ! self.assertRaises(TypeError, posixpath.isdir) ! ! def test_samefile(self): ! f = open(test_support.TESTFN + "1", "wb") ! try: ! f.write("foo") ! f.close() ! self.assertIs( ! posixpath.samefile( ! test_support.TESTFN + "1", ! test_support.TESTFN + "1" ! ), ! True ! ) ! # If we don't have links, assume that os.stat doesn't return resonable ! # inode information and thus, that samefile() doesn't work ! if hasattr(os, "symlink"): ! os.symlink( ! test_support.TESTFN + "1", ! test_support.TESTFN + "2" ! ) ! self.assertIs( ! posixpath.samefile( ! test_support.TESTFN + "1", ! test_support.TESTFN + "2" ! ), ! True ! ) ! os.remove(test_support.TESTFN + "2") ! f = open(test_support.TESTFN + "2", "wb") ! f.write("bar") ! f.close() ! self.assertIs( ! posixpath.samefile( ! test_support.TESTFN + "1", ! test_support.TESTFN + "2" ! ), ! False ! ) ! finally: ! if not f.close(): ! f.close() ! try: ! os.remove(test_support.TESTFN + "1") ! except os.error: ! pass ! try: ! os.remove(test_support.TESTFN + "2") ! except os.error: ! pass ! ! self.assertRaises(TypeError, posixpath.samefile) ! ! def test_samestat(self): ! f = open(test_support.TESTFN + "1", "wb") ! try: ! f.write("foo") ! f.close() ! self.assertIs( ! posixpath.samestat( ! os.stat(test_support.TESTFN + "1"), ! os.stat(test_support.TESTFN + "1") ! ), ! True ! ) ! # If we don't have links, assume that os.stat() doesn't return resonable ! # inode information and thus, that samefile() doesn't work ! if hasattr(os, "symlink"): ! if hasattr(os, "symlink"): ! os.symlink(test_support.TESTFN + "1", test_support.TESTFN + "2") ! self.assertIs( ! posixpath.samestat( ! os.stat(test_support.TESTFN + "1"), ! os.stat(test_support.TESTFN + "2") ! ), ! True ! ) ! os.remove(test_support.TESTFN + "2") ! f = open(test_support.TESTFN + "2", "wb") ! f.write("bar") ! f.close() ! self.assertIs( ! posixpath.samestat( ! os.stat(test_support.TESTFN + "1"), ! os.stat(test_support.TESTFN + "2") ! ), ! False ! ) ! finally: ! if not f.close(): ! f.close() ! try: ! os.remove(test_support.TESTFN + "1") ! except os.error: ! pass ! try: ! os.remove(test_support.TESTFN + "2") ! except os.error: ! pass ! ! self.assertRaises(TypeError, posixpath.samestat) ! ! def test_ismount(self): ! self.assertIs(posixpath.ismount("/"), True) ! ! self.assertRaises(TypeError, posixpath.ismount) ! ! def test_expanduser(self): ! self.assertEqual(posixpath.expanduser("foo"), "foo") ! self.assert_(isinstance(posixpath.expanduser("~/"), basestring)) ! try: ! import pwd ! except ImportError: ! pass ! else: ! self.assert_(isinstance(posixpath.expanduser("~root/"), basestring)) ! self.assert_(isinstance(posixpath.expanduser("~foo/"), basestring)) ! ! self.assertRaises(TypeError, posixpath.expanduser) ! ! def test_expandvars(self): ! oldenv = os.environ.copy() ! try: ! os.environ.clear() ! os.environ["foo"] = "bar" ! os.environ["{foo"] = "baz1" ! os.environ["{foo}"] = "baz2" ! self.assertEqual(posixpath.expandvars("foo"), "foo") ! self.assertEqual(posixpath.expandvars("$foo bar"), "bar bar") ! self.assertEqual(posixpath.expandvars("${foo}bar"), "barbar") ! self.assertEqual(posixpath.expandvars("$[foo]bar"), "$[foo]bar") ! self.assertEqual(posixpath.expandvars("$bar bar"), "$bar bar") ! self.assertEqual(posixpath.expandvars("$?bar"), "$?bar") ! self.assertEqual(posixpath.expandvars("${foo}bar"), "barbar") ! self.assertEqual(posixpath.expandvars("$foo}bar"), "bar}bar") ! self.assertEqual(posixpath.expandvars("${foo"), "${foo") ! self.assertEqual(posixpath.expandvars("${{foo}}"), "baz1}") ! finally: ! os.environ.clear() ! os.environ.update(oldenv) ! ! self.assertRaises(TypeError, posixpath.expandvars) ! ! def test_normpath(self): ! self.assertEqual(posixpath.normpath(""), ".") ! self.assertEqual(posixpath.normpath("/"), "/") ! self.assertEqual(posixpath.normpath("//"), "//") ! self.assertEqual(posixpath.normpath("///"), "/") ! self.assertEqual(posixpath.normpath("///foo/.//bar//"), "/foo/bar") ! self.assertEqual(posixpath.normpath("///foo/.//bar//.//..//.//baz"), "/foo/baz") ! self.assertEqual(posixpath.normpath("///..//./foo/.//bar"), "/foo/bar") ! ! self.assertRaises(TypeError, posixpath.normpath) ! ! def test_abspath(self): ! self.assert_("foo" in posixpath.abspath("foo")) ! ! self.assertRaises(TypeError, posixpath.abspath) ! ! def test_realpath(self): ! self.assert_("foo" in posixpath.realpath("foo")) ! ! self.assertRaises(TypeError, posixpath.realpath) ! ! def test_main(): ! test_support.run_unittest(PosixPathTest) ! ! if __name__=="__main__": ! test_main() From nnorwitz@users.sourceforge.net Mon Jun 16 23:51:24 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 16 Jun 2003 15:51:24 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.193,1.194 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv20238/Lib/test Modified Files: test_descr.py Log Message: Add test for bug #751998. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.193 retrieving revision 1.194 diff -C2 -d -r1.193 -r1.194 *** test_descr.py 29 May 2003 14:30:49 -0000 1.193 --- test_descr.py 16 Jun 2003 22:51:22 -0000 1.194 *************** *** 1268,1271 **** --- 1268,1287 ---- new_objects = len(gc.get_objects()) vereq(orig_objects, new_objects) + class H(object): + __slots__ = ['a', 'b'] + def __init__(self): + self.a = 1 + self.b = 2 + def __del__(self): + assert self.a == 1 + assert self.b == 2 + + save_stderr = sys.stderr + sys.stderr = sys.stdout + h = H() + try: + del h + finally: + sys.stderr = save_stderr def slotspecials(): From nnorwitz@users.sourceforge.net Tue Jun 17 00:38:03 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 16 Jun 2003 16:38:03 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.126.4.38,2.126.4.39 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv25923/Objects Modified Files: Tag: release22-maint typeobject.c Log Message: Backport 2.237 by Guido: - SF patch 751998 fixes an unwanted side effect of the previous fix for SF bug 742860 (the next item). Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.126.4.38 retrieving revision 2.126.4.39 diff -C2 -d -r2.126.4.38 -r2.126.4.39 *** typeobject.c 29 May 2003 15:13:18 -0000 2.126.4.38 --- typeobject.c 16 Jun 2003 23:38:00 -0000 2.126.4.39 *************** *** 432,447 **** /* This function exists so we can DECREF self->ob_type */ ! /* Find the nearest base with a different tp_dealloc ! and clear slots while we're at it */ type = self->ob_type; base = type; while ((basedealloc = base->tp_dealloc) == subtype_dealloc) { - if (base->ob_size) - clear_slots(base, self); base = base->tp_base; assert(base); } ! /* If we added weaklist, we clear it */ if (type->tp_weaklistoffset && !base->tp_weaklistoffset) PyObject_ClearWeakRefs(self); --- 432,447 ---- /* This function exists so we can DECREF self->ob_type */ ! /* Find the nearest base with a different tp_dealloc */ type = self->ob_type; base = type; while ((basedealloc = base->tp_dealloc) == subtype_dealloc) { base = base->tp_base; assert(base); } ! /* If we added a weaklist, we clear it. Do this *before* calling ! the finalizer (__del__), clearing slots, or clearing the instance ! dict. */ ! if (type->tp_weaklistoffset && !base->tp_weaklistoffset) PyObject_ClearWeakRefs(self); *************** *** 449,452 **** --- 449,461 ---- if (call_finalizer(self) < 0) return; + + /* Clear slots up to the nearest base with a different tp_dealloc */ + base = type; + while ((basedealloc = base->tp_dealloc) == subtype_dealloc) { + if (base->ob_size) + clear_slots(base, self); + base = base->tp_base; + assert(base); + } /* If we added a dict, DECREF it */ From nnorwitz@users.sourceforge.net Tue Jun 17 00:38:29 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 16 Jun 2003 16:38:29 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.113.4.33,1.113.4.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv26038/Lib/test Modified Files: Tag: release22-maint test_descr.py Log Message: Backport 1.194: Add test for bug #751998. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.113.4.33 retrieving revision 1.113.4.34 diff -C2 -d -r1.113.4.33 -r1.113.4.34 *** test_descr.py 29 May 2003 15:14:52 -0000 1.113.4.33 --- test_descr.py 16 Jun 2003 23:38:27 -0000 1.113.4.34 *************** *** 1117,1120 **** --- 1117,1136 ---- new_objects = len(gc.get_objects()) vereq(orig_objects, new_objects) + class H(object): + __slots__ = ['a', 'b'] + def __init__(self): + self.a = 1 + self.b = 2 + def __del__(self): + assert self.a == 1 + assert self.b == 2 + + save_stderr = sys.stderr + sys.stderr = sys.stdout + h = H() + try: + del h + finally: + sys.stderr = save_stderr def dynamics(): From goodger@users.sourceforge.net Tue Jun 17 00:46:49 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Mon, 16 Jun 2003 16:46:49 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.245,1.246 pep-0317.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv27121 Modified Files: pep-0000.txt pep-0317.txt Log Message: reject PEP 317, with summary from author Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.245 retrieving revision 1.246 diff -C2 -d -r1.245 -r1.246 *** pep-0000.txt 14 Jun 2003 22:40:36 -0000 1.245 --- pep-0000.txt 16 Jun 2003 23:46:47 -0000 1.246 *************** *** 117,121 **** S 314 Metadata for Python Software Packages v1.1 Kuchling S 315 Enhanced While Loop Carroll - S 317 Eliminate Implicit Exception Instantiation Taschuk S 318 Function/Method Decorator Syntax Smith S 319 Python Synchronize/Asynchronize Block Pelletier --- 117,120 ---- *************** *** 186,189 **** --- 185,189 ---- SR 295 Interpretation of multiline string constants Koltsov SD 316 Programming by Contract for Python Way + SR 317 Eliminate Implicit Exception Instantiation Taschuk SR 666 Reject Foolish Indentation Creighton *************** *** 329,333 **** S 315 Enhanced While Loop Carroll SD 316 Programming by Contract for Python Way ! S 317 Eliminate Implicit Exception Instantiation Taschuk S 318 Function/Method Decorator Syntax Smith S 319 Python Synchronize/Asynchronize Block Pelletier --- 329,333 ---- S 315 Enhanced While Loop Carroll SD 316 Programming by Contract for Python Way ! SR 317 Eliminate Implicit Exception Instantiation Taschuk S 318 Function/Method Decorator Syntax Smith S 319 Python Synchronize/Asynchronize Block Pelletier Index: pep-0317.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0317.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0317.txt 9 Jun 2003 04:43:39 -0000 1.2 --- pep-0317.txt 16 Jun 2003 23:46:47 -0000 1.3 *************** *** 4,13 **** Last-Modified: $Date$ Author: Steven Taschuk ! Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 06-May-2003 Python-Version: 2.4 ! Post-History: --- 4,13 ---- Last-Modified: $Date$ Author: Steven Taschuk ! Status: Rejected Type: Standards Track Content-Type: text/x-rst Created: 06-May-2003 Python-Version: 2.4 ! Post-History: 09-Jun-2003 *************** *** 313,316 **** --- 313,431 ---- + Rejection + ========= + + If this PEP were accepted, nearly all existing Python code would need + to be reviewed and probably revised; even if all the above arguments + in favour of explicit instantiation are accepted, the improvement in + clarity is too minor to justify the cost of doing the revision and the + risk of new bugs introduced thereby. + + This proposal has therefore been rejected [6]_. + + Note that string exceptions are slated for removal independently of + this proposal; what is rejected is the removal of implicit exception + instantiation. + + + Summary of Discussion + ===================== + + A small minority of respondents were in favour of the proposal, but + the dominant response was that any such migration would be costly + out of proportion to the putative benefit. As noted above, this + point is sufficient in itself to reject the PEP. + + + New-Style Exceptions + -------------------- + + Implicit instantiation might conflict with future plans to allow + instances of new-style classes to be used as exceptions. In order to + decide whether to instantiate implicitly, the ``raise`` machinery must + determine whether the first argument is a class or an instance -- but + with new-style classes there is no clear and strong distinction. + + Under this proposal, the problem would be avoided because the + exception would already have been instantiated. However, there are + two plausible alternative solutions: + + 1. Require exception types to be subclasses of ``Exception``, and + instantiate implicitly if and only if :: + + issubclass(firstarg, Exception) + + 2. Instantiate implicitly if and only if :: + + isinstance(firstarg, type) + + Thus eliminating implicit instantiation entirely is not necessary to + solve this problem. + + + Ugliness of Explicit Instantiation + ---------------------------------- + + Some respondents felt that the explicitly instantiating syntax is + uglier, especially in cases when no arguments are supplied to the + exception constructor:: + + raise TypeError() + + The problem is particularly acute when the exception instance itself + is not of interest, that is, when the only relevant point is the + exception type:: + + try: + # ... deeply nested search loop ... + raise Found + except Found: + # ... + + In such cases the symmetry between ``raise`` and ``except`` can be + more expressive of the intent of the code. + + Guido opined that the implicitly instantiating syntax is "a tad + prettier" even for cases with a single argument, since it has less + punctuation. + + + Performance Penalty of Warnings + ------------------------------- + + Experience with deprecating ``apply()`` shows that use of the warning + framework can incur a significant performance penalty. + + Code which instantiates explicitly would not be affected, since the + run-time checks necessary to determine whether to issue a warning are + exactly those which are needed to determine whether to instantiate + implicitly in the first place. That is, such statements are already + incurring the cost of these checks. + + Code which instantiates implicitly would incur a large cost: timing + trials indicate that issuing a warning (whether it is suppressed or + not) takes about five times more time than simply instantiating, + raising, and catching an exception. + + This penalty is mitigated by the fact that ``raise`` statements are + rarely on performance-critical execution paths. + + + Traceback Argument + ------------------ + + As the proposal stands, it would be impossible to use the traceback + argument to ``raise`` conveniently with all 2.x versions of Python. + + For compatibility with versions < 2.4, the three-argument form must be + used; but this form would produce warnings with versions >= 2.4. + Those warnings could be suppressed, but doing so is awkward because + the relevant type of warning is issued at compile-time. + + If this PEP were still under consideration, this objection would be + met by extending the phase-in period. For example, warnings could + first be issued in 3.0, and become errors in some later release. + + References ========== *************** *** 330,333 **** --- 445,451 ---- .. [5] PEP 230 "Warning Framework", Guido van Rossum. http://www.python.org/peps/pep-0230.html + + .. [6] Guido van Rossum, 11 June 2003 post to ``python-dev``. + http://mail.python.org/pipermail/python-dev/2003-June/036176.html From tim_one@users.sourceforge.net Tue Jun 17 01:05:55 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 16 Jun 2003 17:05:55 -0700 Subject: [Python-checkins] python/dist/src/Parser grammar.mak,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory sc8-pr-cvs1:/tmp/cvs-serv28956/Parser Modified Files: grammar.mak Log Message: SF bug 751956: graminit.[ch] don't build on windows A change from Duncan Booth, to deal with changes in the way pgen gets built. Note that graminit.[ch] aren't normally built on Windows (they're obtained from CVS). Index: grammar.mak =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/grammar.mak,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** grammar.mak 23 May 2002 19:25:59 -0000 1.3 --- grammar.mak 17 Jun 2003 00:05:53 -0000 1.4 *************** *** 3,6 **** --- 3,9 ---- # nmake /f grammar.mak # + # You may also need to copy python23.dll into this directory, or get + # it on your search path. + # # The intermediate files can be nuked afterwards: # *************** *** 15,19 **** LIBS= ..\PCbuild\python23.lib ! CFLAGS= /I ..\Include /I ..\PC /D MS_NO_COREDLL /MD GRAMMAR_H= ..\Include\graminit.h --- 18,22 ---- LIBS= ..\PCbuild\python23.lib ! CFLAGS= /I ..\Include /I ..\PC /D MS_NO_COREDLL /D PGEN /MD GRAMMAR_H= ..\Include\graminit.h From nnorwitz@users.sourceforge.net Tue Jun 17 03:37:09 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 16 Jun 2003 19:37:09 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.136,1.137 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv13276/Doc/lib Modified Files: libfuncs.tex Log Message: Fix some markup nits Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.136 retrieving revision 1.137 diff -C2 -d -r1.136 -r1.137 *** libfuncs.tex 11 Jun 2003 09:15:26 -0000 1.136 --- libfuncs.tex 17 Jun 2003 02:37:06 -0000 1.137 *************** *** 92,97 **** \versionadded{2.2.1} ! If no argument is given, this function returns \code{False}. ! \versionchanged{2.3} \end{funcdesc} --- 92,97 ---- \versionadded{2.2.1} ! \versionchanged[If no argument is given, this function returns ! \code{False}]{2.3} \end{funcdesc} *************** *** 688,693 **** \versionadded{2.2} ! This function does not accept any arguments. \versionchanged{2.3} ! Formerly, it accepted arguments but ignored them. \end{funcdesc} --- 688,693 ---- \versionadded{2.2} ! \versionchanged[This function does not accept any arguments. ! Formerly, it accepted arguments but ignored them]{2.3} \end{funcdesc} From nnorwitz@users.sourceforge.net Tue Jun 17 03:51:31 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 16 Jun 2003 19:51:31 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.169,1.170 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv14726 Modified Files: setup.py Log Message: Convert some repetitive code into a loop Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.169 retrieving revision 1.170 diff -C2 -d -r1.169 -r1.170 *** setup.py 14 Jun 2003 21:03:05 -0000 1.169 --- setup.py 17 Jun 2003 02:51:28 -0000 1.170 *************** *** 233,251 **** level=3) ! def get_platform (self): # Get value of sys.platform ! platform = sys.platform ! if platform[:6] =='cygwin': ! platform = 'cygwin' ! elif platform[:4] =='beos': ! platform = 'beos' ! elif platform[:6] == 'darwin': ! platform = 'darwin' ! elif platform[:6] == 'atheos': ! platform = 'atheos' ! elif platform[:4] == 'osf1': ! platform = 'osf1' ! ! return platform def detect_modules(self): --- 233,242 ---- level=3) ! def get_platform(self): # Get value of sys.platform ! for platform in ['cygwin', 'beos', 'darwin', 'atheos', 'osf1']: ! if sys.platform.startswith(platform): ! return platform ! return sys.platform def detect_modules(self): From rhettinger@users.sourceforge.net Tue Jun 17 05:20:01 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 16 Jun 2003 21:20:01 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_posixpath,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1:/tmp/cvs-serv26645 Removed Files: test_posixpath Log Message: test_posixpath.py now uses unittest. The output file is no longer needed. --- test_posixpath DELETED --- From rhettinger@users.sourceforge.net Tue Jun 17 06:05:50 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 16 Jun 2003 22:05:50 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.786,1.787 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv30555/Misc Modified Files: NEWS Log Message: SF #754014: list.index() should accept optional start, end arguments Also, modified UserList.index() to match and expanded the related tests. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.786 retrieving revision 1.787 diff -C2 -d -r1.786 -r1.787 *** NEWS 16 Jun 2003 20:38:15 -0000 1.786 --- NEWS 17 Jun 2003 05:05:48 -0000 1.787 *************** *** 13,16 **** --- 13,19 ---- ----------------- + - list.index() now accepts optional start and stop arguments. Similar + changes were made to UserList.index(). SF feature request 754014. + - SF patch 751998 fixes an unwanted side effect of the previous fix for SF bug 742860 (the next item). From rhettinger@users.sourceforge.net Tue Jun 17 06:05:51 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 16 Jun 2003 22:05:51 -0700 Subject: [Python-checkins] python/dist/src/Lib UserList.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv30555/Lib Modified Files: UserList.py Log Message: SF #754014: list.index() should accept optional start, end arguments Also, modified UserList.index() to match and expanded the related tests. Index: UserList.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserList.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** UserList.py 27 Feb 2003 20:14:31 -0000 1.18 --- UserList.py 17 Jun 2003 05:05:49 -0000 1.19 *************** *** 76,80 **** def remove(self, item): self.data.remove(item) def count(self, item): return self.data.count(item) ! def index(self, item): return self.data.index(item) def reverse(self): self.data.reverse() def sort(self, *args): self.data.sort(*args) --- 76,80 ---- def remove(self, item): self.data.remove(item) def count(self, item): return self.data.count(item) ! def index(self, item, *args): return self.data.index(item, *args) def reverse(self): self.data.reverse() def sort(self, *args): self.data.sort(*args) From rhettinger@users.sourceforge.net Tue Jun 17 06:05:51 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 16 Jun 2003 22:05:51 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.153,2.154 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv30555/Objects Modified Files: listobject.c Log Message: SF #754014: list.index() should accept optional start, end arguments Also, modified UserList.index() to match and expanded the related tests. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.153 retrieving revision 2.154 diff -C2 -d -r2.153 -r2.154 *** listobject.c 21 May 2003 05:58:46 -0000 2.153 --- listobject.c 17 Jun 2003 05:05:48 -0000 2.154 *************** *** 1828,1836 **** static PyObject * ! listindex(PyListObject *self, PyObject *v) { ! int i; ! for (i = 0; i < self->ob_size; i++) { int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ); if (cmp > 0) --- 1828,1841 ---- static PyObject * ! listindex(PyListObject *self, PyObject *args) { ! int i, start=0, stop=self->ob_size; ! PyObject *v; ! if (!PyArg_ParseTuple(args, "O|ii:index", &v, &start, &stop)) ! return NULL; ! start = max(0, start); ! stop = max(0, min(self->ob_size, stop)); ! for (i = start; i < stop; i++) { int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ); if (cmp > 0) *************** *** 2089,2093 **** "L.remove(value) -- remove first occurrence of value"); PyDoc_STRVAR(index_doc, ! "L.index(value) -> integer -- return index of first occurrence of value"); PyDoc_STRVAR(count_doc, "L.count(value) -> integer -- return number of occurrences of value"); --- 2094,2098 ---- "L.remove(value) -- remove first occurrence of value"); PyDoc_STRVAR(index_doc, ! "L.index(value, [start, [stop]]) -> integer -- return first index of value"); PyDoc_STRVAR(count_doc, "L.count(value) -> integer -- return number of occurrences of value"); *************** *** 2103,2107 **** {"pop", (PyCFunction)listpop, METH_VARARGS, pop_doc}, {"remove", (PyCFunction)listremove, METH_O, remove_doc}, ! {"index", (PyCFunction)listindex, METH_O, index_doc}, {"count", (PyCFunction)listcount, METH_O, count_doc}, {"reverse", (PyCFunction)listreverse, METH_NOARGS, reverse_doc}, --- 2108,2112 ---- {"pop", (PyCFunction)listpop, METH_VARARGS, pop_doc}, {"remove", (PyCFunction)listremove, METH_O, remove_doc}, ! {"index", (PyCFunction)listindex, METH_VARARGS, index_doc}, {"count", (PyCFunction)listcount, METH_O, count_doc}, {"reverse", (PyCFunction)listreverse, METH_NOARGS, reverse_doc}, From rhettinger@users.sourceforge.net Tue Jun 17 06:05:51 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 16 Jun 2003 22:05:51 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_types.py,1.52,1.53 test_userlist.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv30555/Lib/test Modified Files: test_types.py test_userlist.py Log Message: SF #754014: list.index() should accept optional start, end arguments Also, modified UserList.index() to match and expanded the related tests. Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** test_types.py 12 May 2003 20:19:37 -0000 1.52 --- test_types.py 17 Jun 2003 05:05:49 -0000 1.53 *************** *** 367,371 **** --- 367,387 ---- if a.count(0) != 2: raise TestFailed, ' list count' if a.index(0) != 2: raise TestFailed, 'list index' + if a.index(0,2) != 2: raise TestFailed, 'list index, start argument' + if a.index(-2,-10) != 0: raise TestFailed, 'list index, negative start argument' + if a.index(0,3) != 3: raise TestFailed, 'list index, start argument' + if a.index(0,3,4) != 3: raise TestFailed, 'list index, stop argument' + try: + a.index(2,0,-10) + except ValueError: + pass + else: + raise TestFailed, 'list index, negative stop argument' a.remove(0) + try: + a.index(2,0,4) + except ValueError: + pass + else: + raise TestFailed, 'list index, stop argument.' if a != [-2,-1,0,1,2]: raise TestFailed, 'list remove' a.reverse() Index: test_userlist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userlist.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_userlist.py 1 May 2003 17:45:54 -0000 1.9 --- test_userlist.py 17 Jun 2003 05:05:49 -0000 1.10 *************** *** 207,210 **** --- 207,219 ---- self.assertRaises(ValueError, u.index, 2) + u = UserList([-2,-1,0,0,1,2]) + self.assertEqual(u.count(0), 2) + self.assertEqual(u.index(0), 2) + self.assertEqual(u.index(0,2), 2) + self.assertEqual(u.index(-2,-10), 0) + self.assertEqual(u.index(0,3), 3) + self.assertEqual(u.index(0,3,4), 3) + self.assertRaises(ValueError, u.index, 2,0,-10) + def test_reverse(self): u = UserList((0, 1)) From walter@livinglogic.de Tue Jun 17 13:26:47 2003 From: walter@livinglogic.de (=?ISO-8859-15?Q?Walter_D=F6rwald?=) Date: Tue, 17 Jun 2003 14:26:47 +0200 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.153,2.154 In-Reply-To: References: Message-ID: <3EEF0907.6040900@livinglogic.de> rhettinger@users.sourceforge.net wrote: > Update of /cvsroot/python/python/dist/src/Objects > In directory sc8-pr-cvs1:/tmp/cvs-serv30555/Objects > > Modified Files: > listobject.c > Log Message: > SF #754014: list.index() should accept optional start, end arguments > > Also, modified UserList.index() to match and expanded the related tests. > > [...] > static PyObject * > ! listindex(PyListObject *self, PyObject *args) > { > [...] > ! start = max(0, start); > ! stop = max(0, min(self->ob_size, stop)); > [...] This gives me (on Linux): Objects/listobject.c:1837: undefined reference to `max' Objects/listobject.c:1838: undefined reference to `min' Objects/listobject.c:1838: undefined reference to `max' Bye, Walter Dörwald From barry@python.org Tue Jun 17 13:32:00 2003 From: barry@python.org (Barry Warsaw) Date: 17 Jun 2003 08:32:00 -0400 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.153,2.154 In-Reply-To: <3EEF0907.6040900@livinglogic.de> References: <3EEF0907.6040900@livinglogic.de> Message-ID: <1055853119.3599.2.camel@anthem> On Tue, 2003-06-17 at 08:26, Walter D=F6rwald wrote: > This gives me (on Linux): >=20 > Objects/listobject.c:1837: undefined reference to `max' > Objects/listobject.c:1838: undefined reference to `min' > Objects/listobject.c:1838: undefined reference to `max' This seems like a pretty significant change to Python's API (or at least one of its more common built-ins). Given that Python 2.3 is in beta, I'm wondering how wise it is to add this feature. I'm sure I missed the python-dev debate about it . -Barry From montanaro@users.sourceforge.net Tue Jun 17 13:58:33 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 17 Jun 2003 05:58:33 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.787,1.788 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv30363/Misc Modified Files: NEWS Log Message: SF Patch 569574 - enhancements to cgitb for plain text display Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.787 retrieving revision 1.788 diff -C2 -d -r1.787 -r1.788 *** NEWS 17 Jun 2003 05:05:48 -0000 1.787 --- NEWS 17 Jun 2003 12:58:30 -0000 1.788 *************** *** 84,87 **** --- 84,90 ---- ------- + - The cgitb module has been extended to support plain text display (SF patch + 569574). + - A brand new version of IDLE (from the IDLEfork project at SourceForge) is now included as Lib/idlelib. The old Tools/idle is From montanaro@users.sourceforge.net Tue Jun 17 13:58:33 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 17 Jun 2003 05:58:33 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcgitb.tex,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv30363/Doc/lib Modified Files: libcgitb.tex Log Message: SF Patch 569574 - enhancements to cgitb for plain text display Index: libcgitb.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcgitb.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** libcgitb.tex 20 Dec 2001 17:13:09 -0000 1.3 --- libcgitb.tex 17 Jun 2003 12:58:31 -0000 1.4 *************** *** 13,19 **** \index{tracebacks!in CGI scripts} ! The \module{cgitb} module provides a special exception handler for CGI ! scripts. After this module is activated, if an uncaught exception occurs, ! a detailed, formatted report will be sent to the Web browser. The report includes a traceback showing excerpts of the source code for each level, as well as the values of the arguments and local variables to currently --- 13,22 ---- \index{tracebacks!in CGI scripts} ! The \module{cgitb} module provides a special exception handler for Python ! scripts. (It's name is a bit misleading. It was originally designed to ! display extensive traceback information in HTML for CGI scripts. It was ! later generalized to also display this information in plain text.) After ! this module is activated, if an uncaught exception occurs, a detailed, ! formatted report will be displayed. The report includes a traceback showing excerpts of the source code for each level, as well as the values of the arguments and local variables to currently *************** *** 33,37 **** \begin{funcdesc}{enable}{\optional{display\optional{, logdir\optional{, ! context}}}} This function causes the \module{cgitb} module to take over the interpreter's default handling for exceptions by setting the --- 36,40 ---- \begin{funcdesc}{enable}{\optional{display\optional{, logdir\optional{, ! context\optional{, format}}}}} This function causes the \module{cgitb} module to take over the interpreter's default handling for exceptions by setting the *************** *** 47,50 **** --- 50,56 ---- context to display around the current line of source code in the traceback; this defaults to \code{5}. + If the optional argument \var{format} is \code{"html"}, the output is + formatted as HTML. Any other value forces plain text output. The default + value is \code{"html"}. \end{funcdesc} From montanaro@users.sourceforge.net Tue Jun 17 13:58:33 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 17 Jun 2003 05:58:33 -0700 Subject: [Python-checkins] python/dist/src/Lib cgitb.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv30363/Lib Modified Files: cgitb.py Log Message: SF Patch 569574 - enhancements to cgitb for plain text display Index: cgitb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/cgitb.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** cgitb.py 31 Dec 2002 01:08:35 -0000 1.7 --- cgitb.py 17 Jun 2003 12:58:31 -0000 1.8 *************** *** 1,3 **** ! """Handle exceptions in CGI scripts by formatting tracebacks into nice HTML. To enable this module, do: --- 1,3 ---- ! """More comprehensive traceback formatting for Python scripts. To enable this module, do: *************** *** 5,19 **** import cgitb; cgitb.enable() ! at the top of your CGI script. The optional arguments to enable() are: display - if true, tracebacks are displayed in the web browser logdir - if set, tracebacks are written to files in this directory context - number of lines of source code to show for each stack frame ! By default, tracebacks are displayed but not saved, and context is 5. Alternatively, if you have caught an exception and want cgitb to display it ! for you, call cgitb.handler(). The optional argument to handler() is a 3-item ! tuple (etype, evalue, etb) just like the value of sys.exc_info().""" __author__ = 'Ka-Ping Yee' --- 5,24 ---- import cgitb; cgitb.enable() ! at the top of your script. The optional arguments to enable() are: display - if true, tracebacks are displayed in the web browser logdir - if set, tracebacks are written to files in this directory context - number of lines of source code to show for each stack frame + format - 'text' or 'html' controls the output format ! By default, tracebacks are displayed but not saved, the context is 5 lines ! and the output format is 'html' (for backwards compatibility with the ! original use of this module) Alternatively, if you have caught an exception and want cgitb to display it ! for you, call cgitb.handler(). The optional argument to handler() is a ! 3-item tuple (etype, evalue, etb) just like the value of sys.exc_info(). ! The default handler displays output as HTML. ! """ __author__ = 'Ka-Ping Yee' *************** *** 161,172 **** ''' % ''.join(traceback.format_exception(etype, evalue, etb)) class Hook: """A hook to replace sys.excepthook that shows tracebacks in HTML.""" ! def __init__(self, display=1, logdir=None, context=5, file=None): self.display = display # send tracebacks to browser if true self.logdir = logdir # log tracebacks to files if not None self.context = context # number of source code lines per frame self.file = file or sys.stdout # place to send the output def __call__(self, etype, evalue, etb): --- 166,248 ---- ''' % ''.join(traceback.format_exception(etype, evalue, etb)) + def text((etype, evalue, etb), context=5): + """Return a plain text document describing a given traceback.""" + import os, types, time, traceback, linecache, inspect, pydoc + + if type(etype) is types.ClassType: + etype = etype.__name__ + pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable + date = time.ctime(time.time()) + head = "%s\n%s\n%s\n" % (str(etype), pyver, date) + ''' + A problem occurred in a Python script. Here is the sequence of + function calls leading up to the error, in the order they occurred. + ''' + + frames = [] + records = inspect.getinnerframes(etb, context) + for frame, file, lnum, func, lines, index in records: + file = file and os.path.abspath(file) or '?' + args, varargs, varkw, locals = inspect.getargvalues(frame) + call = '' + if func != '?': + call = 'in ' + func + \ + inspect.formatargvalues(args, varargs, varkw, locals, + formatvalue=lambda value: '=' + pydoc.text.repr(value)) + + highlight = {} + def reader(lnum=[lnum]): + highlight[lnum[0]] = 1 + try: return linecache.getline(file, lnum[0]) + finally: lnum[0] += 1 + vars = scanvars(reader, frame, locals) + + rows = [' %s %s' % (file, call)] + if index is not None: + i = lnum - index + for line in lines: + num = '%5d ' % i + rows.append(num+line.rstrip()) + i += 1 + + done, dump = {}, [] + for name, where, value in vars: + if name in done: continue + done[name] = 1 + if value is not __UNDEF__: + if where == 'global': name = 'global ' + name + elif where == 'local': name = name + else: name = where + name.split('.')[-1] + dump.append('%s = %s' % (name, pydoc.text.repr(value))) + else: + dump.append(name + ' undefined') + + rows.append('\n'.join(dump)) + frames.append('\n%s\n' % '\n'.join(rows)) + + exception = ['%s: %s' % (str(etype), str(evalue))] + if type(evalue) is types.InstanceType: + for name in dir(evalue): + value = pydoc.text.repr(getattr(evalue, name)) + exception.append('\n%s%s = %s' % (" "*4, name, value)) + + import traceback + return head + ''.join(frames) + ''.join(exception) + ''' + + The above is a description of an error in a Python program. Here is + the original traceback: + + %s + ''' % ''.join(traceback.format_exception(etype, evalue, etb)) + class Hook: """A hook to replace sys.excepthook that shows tracebacks in HTML.""" ! def __init__(self, display=1, logdir=None, context=5, file=None, ! format="html"): self.display = display # send tracebacks to browser if true self.logdir = logdir # log tracebacks to files if not None self.context = context # number of source code lines per frame self.file = file or sys.stdout # place to send the output + self.format = format def __call__(self, etype, evalue, etb): *************** *** 175,188 **** def handle(self, info=None): info = info or sys.exc_info() ! self.file.write(reset()) try: ! text, doc = 0, html(info, self.context) except: # just in case something goes wrong import traceback ! text, doc = 1, ''.join(traceback.format_exception(*info)) if self.display: ! if text: doc = doc.replace('&', '&').replace('<', '<') self.file.write('
' + doc + '
\n') --- 251,268 ---- def handle(self, info=None): info = info or sys.exc_info() ! if self.format == "html": ! self.file.write(reset()) + formatter = (self.format=="html") and html or text + plain = False try: ! doc = formatter(info, self.context) except: # just in case something goes wrong import traceback ! doc = ''.join(traceback.format_exception(*info)) ! plain = True if self.display: ! if plain: doc = doc.replace('&', '&').replace('<', '<') self.file.write('
' + doc + '
\n') *************** *** 194,199 **** if self.logdir is not None: import os, tempfile ! (fd, path) = tempfile.mkstemp(suffix=['.html', '.txt'][text], ! dir=self.logdir) try: file = os.fdopen(fd, 'w') --- 274,279 ---- if self.logdir is not None: import os, tempfile ! suffix = ['.html', '.txt'][self.format=="html"] ! (fd, path) = tempfile.mkstemp(suffix=suffix, dir=self.logdir) try: file = os.fdopen(fd, 'w') *************** *** 209,213 **** handler = Hook().handle ! def enable(display=1, logdir=None, context=5): """Install an exception handler that formats tracebacks as HTML. --- 289,293 ---- handler = Hook().handle ! def enable(display=1, logdir=None, context=5, format="html"): """Install an exception handler that formats tracebacks as HTML. *************** *** 215,217 **** traceback to the browser, and 'logdir' can be set to a directory to cause tracebacks to be written to files there.""" ! sys.excepthook = Hook(display, logdir, context) --- 295,298 ---- traceback to the browser, and 'logdir' can be set to a directory to cause tracebacks to be written to files there.""" ! sys.excepthook = Hook(display=display, logdir=logdir, ! context=context, format=format) From doerwalter@users.sourceforge.net Tue Jun 17 14:13:42 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 17 Jun 2003 06:13:42 -0700 Subject: [Python-checkins] python/dist/src/Lib posixpath.py,1.58,1.59 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv32632/Lib Modified Files: posixpath.py Log Message: Modernize Lib/posixpath.py: Use startswith(), endswith(), rstrip(), struct_passwd attributes and +=. >From SF patch #755245. Index: posixpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/posixpath.py,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** posixpath.py 14 Feb 2003 19:35:30 -0000 1.58 --- posixpath.py 17 Jun 2003 13:13:40 -0000 1.59 *************** *** 46,50 **** def isabs(s): """Test whether a path is absolute""" ! return s[:1] == '/' --- 46,50 ---- def isabs(s): """Test whether a path is absolute""" ! return s.startswith('/') *************** *** 57,66 **** path = a for b in p: ! if b[:1] == '/': path = b ! elif path == '' or path[-1:] == '/': ! path = path + b else: ! path = path + '/' + b return path --- 57,66 ---- path = a for b in p: ! if b.startswith('/'): path = b ! elif path == '' or path.endswith('/'): ! path += b else: ! path += '/' + b return path *************** *** 77,82 **** head, tail = p[:i], p[i:] if head and head != '/'*len(head): ! while head[-1] == '/': ! head = head[:-1] return head, tail --- 77,81 ---- head, tail = p[:i], p[i:] if head and head != '/'*len(head): ! head = head.rstrip('/') return head, tail *************** *** 130,134 **** if prefix[:i+1] != item[:i+1]: prefix = prefix[:i] ! if i == 0: return '' break return prefix --- 129,134 ---- if prefix[:i+1] != item[:i+1]: prefix = prefix[:i] ! if i == 0: ! return '' break return prefix *************** *** 302,314 **** """Expand ~ and ~user constructions. If user or $HOME is unknown, do nothing.""" ! if path[:1] != '~': return path i, n = 1, len(path) while i < n and path[i] != '/': ! i = i + 1 if i == 1: if not 'HOME' in os.environ: import pwd ! userhome = pwd.getpwuid(os.getuid())[5] else: userhome = os.environ['HOME'] --- 302,314 ---- """Expand ~ and ~user constructions. If user or $HOME is unknown, do nothing.""" ! if not path.startswith('~'): return path i, n = 1, len(path) while i < n and path[i] != '/': ! i += 1 if i == 1: if not 'HOME' in os.environ: import pwd ! userhome = pwd.getpwuid(os.getuid()).pw_dir else: userhome = os.environ['HOME'] *************** *** 319,324 **** except KeyError: return path ! userhome = pwent[5] ! if userhome[-1:] == '/': i = i + 1 return userhome + path[i:] --- 319,325 ---- except KeyError: return path ! userhome = pwent.pw_dir ! if userhome.endswith('/'): ! i += 1 return userhome + path[i:] *************** *** 346,350 **** i, j = m.span(0) name = m.group(1) ! if name[:1] == '{' and name[-1:] == '}': name = name[1:-1] if name in os.environ: --- 347,351 ---- i, j = m.span(0) name = m.group(1) ! if name.startswith('{') and name.endswith('}'): name = name[1:-1] if name in os.environ: *************** *** 352,356 **** path = path[:i] + os.environ[name] i = len(path) ! path = path + tail else: i = j --- 353,357 ---- path = path[:i] + os.environ[name] i = len(path) ! path += tail else: i = j From python@rcn.com Tue Jun 17 14:23:17 2003 From: python@rcn.com (Raymond Hettinger) Date: Tue, 17 Jun 2003 09:23:17 -0400 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.153,2.154 References: <3EEF0907.6040900@livinglogic.de> Message-ID: <005e01c334d3$9dd60aa0$125ffea9@oemcomputer> > This gives me (on Linux): > > Objects/listobject.c:1837: undefined reference to `max' > Objects/listobject.c:1838: undefined reference to `min' > Objects/listobject.c:1838: undefined reference to `max' Walter, If you have time, you're welcome to fix this one (replacing min/max with equivalent ?: or if/else). I won't be able to touch it until tonight. Raymond From python@rcn.com Tue Jun 17 14:28:50 2003 From: python@rcn.com (Raymond Hettinger) Date: Tue, 17 Jun 2003 09:28:50 -0400 Subject: [Python-checkins] python/dist/src/Objectslistobject.c,2.153,2.154 References: <3EEF0907.6040900@livinglogic.de> <1055853119.3599.2.camel@anthem> Message-ID: <006901c334d4$63f7c840$125ffea9@oemcomputer> Hi Barry, I suppose we could have more debate after the fact, but this one seems straight-forward enough: * discussed on comp.lang.python * had an RFE on SF * has clear use cases * got a +1 from Guido * is backwards compatible * matches the signature of str.index() and unicode.index() * matches the search technique for regular expressions * was a relatively simple coding change * checked in with thorough tests Raymond Hettinger ----- Original Message ----- From: "Barry Warsaw" This seems like a pretty significant change to Python's API (or at least one of its more common built-ins). Given that Python 2.3 is in beta, I'm wondering how wise it is to add this feature. I'm sure I missed the python-dev debate about it . From guido@python.org Tue Jun 17 15:10:57 2003 From: guido@python.org (Guido van Rossum) Date: Tue, 17 Jun 2003 10:10:57 -0400 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.153,2.154 In-Reply-To: Your message of "17 Jun 2003 08:32:00 EDT." <1055853119.3599.2.camel@anthem> References: <3EEF0907.6040900@livinglogic.de> <1055853119.3599.2.camel@anthem> Message-ID: <200306171410.h5HEAv204496@odiug.zope.com> > This seems like a pretty significant change to Python's API (or at least > one of its more common built-ins). Given that Python 2.3 is in beta, > I'm wondering how wise it is to add this feature. I'm sure I missed the > python-dev debate about it . Actually, I +1'ed it on the grounds that (a) str.index() does it the same way, and (b) it's backwards compatible. > > Objects/listobject.c:1837: undefined reference to `max' > > Objects/listobject.c:1838: undefined reference to `min' > > Objects/listobject.c:1838: undefined reference to `max' However, the implementation leaves something to desire... :-( --Guido van Rossum (home page: http://www.python.org/~guido/) From gvanrossum@users.sourceforge.net Tue Jun 17 15:25:16 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 17 Jun 2003 07:25:16 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_types.py,1.53,1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv10647 Modified Files: test_types.py Log Message: Fix sloppy index() implementation: - don't use min() and max() - interpret negative start/stop argument like negative slice indices Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** test_types.py 17 Jun 2003 05:05:49 -0000 1.53 --- test_types.py 17 Jun 2003 14:25:14 -0000 1.54 *************** *** 365,374 **** b.insert(200, "right") if b != ["left",-2,-1,0,0,"foo",1,2,"right"]: raise TestFailed, 'list insert2' if a.count(0) != 2: raise TestFailed, ' list count' if a.index(0) != 2: raise TestFailed, 'list index' if a.index(0,2) != 2: raise TestFailed, 'list index, start argument' ! if a.index(-2,-10) != 0: raise TestFailed, 'list index, negative start argument' if a.index(0,3) != 3: raise TestFailed, 'list index, start argument' if a.index(0,3,4) != 3: raise TestFailed, 'list index, stop argument' try: a.index(2,0,-10) --- 365,378 ---- b.insert(200, "right") if b != ["left",-2,-1,0,0,"foo",1,2,"right"]: raise TestFailed, 'list insert2' + # a = [-2,-1,0,0,1,2] if a.count(0) != 2: raise TestFailed, ' list count' if a.index(0) != 2: raise TestFailed, 'list index' if a.index(0,2) != 2: raise TestFailed, 'list index, start argument' ! if a.index(0,-4) != 2: raise TestFailed, 'list index, -start argument' ! if a.index(-2,-10) != 0: raise TestFailed, 'list index, very -start argument' if a.index(0,3) != 3: raise TestFailed, 'list index, start argument' + if a.index(0,-3) != 3: raise TestFailed, 'list index, -start argument' if a.index(0,3,4) != 3: raise TestFailed, 'list index, stop argument' + if a.index(0,-3,-2) != 3: raise TestFailed, 'list index, -stop argument' try: a.index(2,0,-10) *************** *** 376,380 **** pass else: ! raise TestFailed, 'list index, negative stop argument' a.remove(0) try: --- 380,384 ---- pass else: ! raise TestFailed, 'list index, very -stop argument' a.remove(0) try: From gvanrossum@users.sourceforge.net Tue Jun 17 15:24:55 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 17 Jun 2003 07:24:55 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.154,2.155 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv10479 Modified Files: listobject.c Log Message: Fix sloppy index() implementation: - don't use min() and max() - interpret negative start/stop argument like negative slice indices Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.154 retrieving revision 2.155 diff -C2 -d -r2.154 -r2.155 *** listobject.c 17 Jun 2003 05:05:48 -0000 2.154 --- listobject.c 17 Jun 2003 14:24:53 -0000 2.155 *************** *** 1835,1840 **** if (!PyArg_ParseTuple(args, "O|ii:index", &v, &start, &stop)) return NULL; ! start = max(0, start); ! stop = max(0, min(self->ob_size, stop)); for (i = start; i < stop; i++) { int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ); --- 1835,1850 ---- if (!PyArg_ParseTuple(args, "O|ii:index", &v, &start, &stop)) return NULL; ! if (start < 0) { ! start += self->ob_size; ! if (start < 0) ! start = 0; ! } ! if (stop < 0) { ! stop += self->ob_size; ! if (stop < 0) ! stop = 0; ! } ! else if (stop > self->ob_size) ! stop = self->ob_size; for (i = start; i < stop; i++) { int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ); From jackjansen@users.sourceforge.net Tue Jun 17 15:36:56 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 17 Jun 2003 07:36:56 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/Dist build,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist In directory sc8-pr-cvs1:/tmp/cvs-serv12422 Modified Files: build Log Message: Make sure the files in the installer have group "admin", otherwise administrators can still not add packages. Index: build =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Dist/build,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** build 16 Jun 2003 15:12:16 -0000 1.5 --- build 17 Jun 2003 14:36:54 -0000 1.6 *************** *** 49,52 **** --- 49,54 ---- fi rm -rf $DMGDIR + mkdir $TMPDIR + chgrp admin $TMPDIR mkdir -p $DMGDIR/root From doerwalter@users.sourceforge.net Tue Jun 17 16:48:14 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 17 Jun 2003 08:48:14 -0700 Subject: [Python-checkins] python/dist/src/Objects obmalloc.c,2.50,2.51 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv25264/Objects Modified Files: obmalloc.c Log Message: Whitespace normalization. Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.50 retrieving revision 2.51 diff -C2 -d -r2.50 -r2.51 *** obmalloc.c 23 Nov 2002 09:13:40 -0000 2.50 --- obmalloc.c 17 Jun 2003 15:48:11 -0000 2.51 *************** *** 652,658 **** return (void *)bp; } ! /* ! * Allocate new pool ! */ if (nfreepools) { commit_pool: --- 652,658 ---- return (void *)bp; } ! /* ! * Allocate new pool ! */ if (nfreepools) { commit_pool: *************** *** 664,670 **** goto init_pool; } ! /* ! * Allocate new arena ! */ #ifdef WITH_MEMORY_LIMITS if (!(narenas < MAX_ARENAS)) { --- 664,670 ---- goto init_pool; } ! /* ! * Allocate new arena ! */ #ifdef WITH_MEMORY_LIMITS if (!(narenas < MAX_ARENAS)) { From doerwalter@users.sourceforge.net Tue Jun 17 17:19:58 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 17 Jun 2003 09:19:58 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.126,1.127 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv30807/lib Modified Files: libstdtypes.tex Log Message: Updated documentation for the new slice arguments for list.index(). Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.126 retrieving revision 1.127 diff -C2 -d -r1.126 -r1.127 *** libstdtypes.tex 31 May 2003 08:05:49 -0000 1.126 --- libstdtypes.tex 17 Jun 2003 16:19:56 -0000 1.127 *************** *** 943,948 **** \lineiii{\var{s}.count(\var{x})} {return number of \var{i}'s for which \code{\var{s}[\var{i}] == \var{x}}}{} ! \lineiii{\var{s}.index(\var{x})} ! {return smallest \var{i} such that \code{\var{s}[\var{i}] == \var{x}}}{(4)} \lineiii{\var{s}.insert(\var{i}, \var{x})} {same as \code{\var{s}[\var{i}:\var{i}] = [\var{x}]}}{(5)} --- 943,949 ---- \lineiii{\var{s}.count(\var{x})} {return number of \var{i}'s for which \code{\var{s}[\var{i}] == \var{x}}}{} ! \lineiii{\var{s}.index(\var{x}\optional{, \var{i}\optional{, \var{j}}})} ! {return smallest \var{k} such that \code{\var{s}[\var{k}] == \var{x}} and ! \code{\var{i} <= \var{k} < \var{j}}}{(4)} \lineiii{\var{s}.insert(\var{i}, \var{x})} {same as \code{\var{s}[\var{i}:\var{i}] = [\var{x}]}}{(5)} *************** *** 983,987 **** \item[(4)] Raises \exception{ValueError} when \var{x} is not found in ! \var{s}. \item[(5)] When a negative index is passed as the first parameter to --- 984,992 ---- \item[(4)] Raises \exception{ValueError} when \var{x} is not found in ! \var{s}. When a negative index is passed as the second or third parameter ! to the \method{index()} method, the list length is added, as for slice ! indices. If it is still negative, it is truncated to zero, as for ! slice indices. \versionchanged[Previously, \method{index()} didn't ! have arguments for specifying start and stop positions]{2.3} \item[(5)] When a negative index is passed as the first parameter to From rhettinger@users.sourceforge.net Tue Jun 17 17:53:27 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 17 Jun 2003 09:53:27 -0700 Subject: [Python-checkins] python/dist/src/Lib difflib.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv3816 Modified Files: difflib.py Log Message: Fix docstring Index: difflib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/difflib.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** difflib.py 8 Jun 2003 19:38:42 -0000 1.13 --- difflib.py 17 Jun 2003 16:53:25 -0000 1.14 *************** *** 1108,1112 **** defaults to three. ! By default, the diff control lines (those with *** or ---) are created with a trailing newline. This is helpful so that inputs created from file.readlines() result in diffs that are suitable for --- 1108,1112 ---- defaults to three. ! By default, the diff control lines (those with ---, +++, or @@) are created with a trailing newline. This is helpful so that inputs created from file.readlines() result in diffs that are suitable for From klm@users.sourceforge.net Tue Jun 17 20:18:59 2003 From: klm@users.sourceforge.net (klm@users.sourceforge.net) Date: Tue, 17 Jun 2003 12:18:59 -0700 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.34,4.35 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv30394 Modified Files: python-mode.el Log Message: Remove short-circuitying grubbing by using last grubbed buffer. It's evil - if the last grubbed buffer didn't happen to be the right one, you couldn't remedy. Mainline emacs compat - don't use third arg to buffer-substring (which was for explicitly identifying the buffer in which to seek the substring, and which turns out to be unnecessary). Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.34 retrieving revision 4.35 diff -C2 -d -r4.34 -r4.35 *** python-mode.el 1 May 2003 21:07:32 -0000 4.34 --- python-mode.el 17 Jun 2003 19:18:57 -0000 4.35 *************** *** 1371,1376 **** (string-match "^\\([^#]\\|#[^#]\\|#$\\)" (buffer-substring (point-min) ! (point-max) ! funcbuffer)) )))))) (list lineno funcbuffer)) --- 1371,1375 ---- (string-match "^\\([^#]\\|#[^#]\\|#$\\)" (buffer-substring (point-min) ! (point-max))) )))))) (list lineno funcbuffer)) *************** *** 1393,1400 **** curbuf got) - (if (and py-pdbtrack-last-grubbed-buffer - (member py-pdbtrack-last-grubbed-buffer buffers)) - ; Prefer last grubbed buffer by putting it at the front of the list: - (setq buffers (cons py-pdbtrack-last-grubbed-buffer buffers))) (while (and buffers (not got)) (setq buf (car buffers) --- 1392,1395 ---- *************** *** 1405,1411 **** (string-match (concat "^\\s-*\\(def\\|class\\)\\s-+" funcname "\\s-*(") ! (buffer-substring (point-min buf) ! (point-max buf) ! buf)))) (setq got buf))) (setq py-pdbtrack-last-grubbed-buffer got))) --- 1400,1407 ---- (string-match (concat "^\\s-*\\(def\\|class\\)\\s-+" funcname "\\s-*(") ! (save-excursion ! (set-buffer buf) ! (buffer-substring (point-min) ! (point-max)))))) (setq got buf))) (setq py-pdbtrack-last-grubbed-buffer got))) From doerwalter@users.sourceforge.net Tue Jun 17 20:27:41 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 17 Jun 2003 12:27:41 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_types.py,1.54,1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv31530/Lib/test Modified Files: test_types.py Log Message: Use _PyEval_SliceIndex to handle list.index() calls with huge start and stop arguments. Add tests. Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** test_types.py 17 Jun 2003 14:25:14 -0000 1.54 --- test_types.py 17 Jun 2003 19:27:39 -0000 1.55 *************** *** 375,378 **** --- 375,387 ---- if a.index(0,3,4) != 3: raise TestFailed, 'list index, stop argument' if a.index(0,-3,-2) != 3: raise TestFailed, 'list index, -stop argument' + if a.index(0,-4*sys.maxint,4*sys.maxint) != 2: + raise TestFailed, 'list index, -maxint, maxint argument' + try: + a.index(0, 4*sys.maxint,-4*sys.maxint) + except ValueError: + pass + else: + raise TestFailed, 'list index, maxint,-maxint argument' + try: a.index(2,0,-10) From doerwalter@users.sourceforge.net Tue Jun 17 20:27:41 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 17 Jun 2003 12:27:41 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.155,2.156 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv31530/Objects Modified Files: listobject.c Log Message: Use _PyEval_SliceIndex to handle list.index() calls with huge start and stop arguments. Add tests. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.155 retrieving revision 2.156 diff -C2 -d -r2.155 -r2.156 *** listobject.c 17 Jun 2003 14:24:53 -0000 2.155 --- listobject.c 17 Jun 2003 19:27:38 -0000 2.156 *************** *** 1833,1837 **** PyObject *v; ! if (!PyArg_ParseTuple(args, "O|ii:index", &v, &start, &stop)) return NULL; if (start < 0) { --- 1833,1839 ---- PyObject *v; ! if (!PyArg_ParseTuple(args, "O|O&O&:index", &v, ! _PyEval_SliceIndex, &start, ! _PyEval_SliceIndex, &stop)) return NULL; if (start < 0) { From doerwalter@users.sourceforge.net Tue Jun 17 21:22:26 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 17 Jun 2003 13:22:26 -0700 Subject: [Python-checkins] python/dist/src/Objects complexobject.c,2.66,2.67 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv10739/Objects Modified Files: complexobject.c Log Message: Fix typo in comment. Index: complexobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v retrieving revision 2.66 retrieving revision 2.67 diff -C2 -d -r2.66 -r2.67 *** complexobject.c 2 Mar 2003 13:51:47 -0000 2.66 --- complexobject.c 17 Jun 2003 20:22:24 -0000 2.67 *************** *** 832,836 **** return NULL; ! /* Special-case for single argumet that is already complex */ if (PyComplex_CheckExact(r) && i == NULL && type == &PyComplex_Type) { --- 832,836 ---- return NULL; ! /* Special-case for single argument that is already complex */ if (PyComplex_CheckExact(r) && i == NULL && type == &PyComplex_Type) { From bcannon@users.sourceforge.net Tue Jun 17 22:52:36 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue, 17 Jun 2003 14:52:36 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv27694/Lib Modified Files: urllib2.py Log Message: Change all header strings to be as if they were capitalize()'ed. Also call capitalize in AbstractHTTPHandler before inserting headers into HTTP instance. Closes bug #649742, again. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** urllib2.py 15 Jun 2003 23:26:29 -0000 1.50 --- urllib2.py 17 Jun 2003 21:52:34 -0000 1.51 *************** *** 255,259 **** def __init__(self): server_version = "Python-urllib/%s" % __version__ ! self.addheaders = [('User-Agent', server_version)] # manage the individual handlers self.handlers = [] --- 255,259 ---- def __init__(self): server_version = "Python-urllib/%s" % __version__ ! self.addheaders = [('User-agent', server_version)] # manage the individual handlers self.handlers = [] *************** *** 508,512 **** user_pass = base64.encodestring('%s:%s' % (unquote(user), unquote(password))) ! req.add_header('Proxy-Authorization', 'Basic ' + user_pass) host = unquote(host) req.set_proxy(host, type) --- 508,512 ---- user_pass = base64.encodestring('%s:%s' % (unquote(user), unquote(password))) ! req.add_header('Proxy-authorization', 'Basic ' + user_pass) host = unquote(host) req.set_proxy(host, type) *************** *** 667,671 **** class ProxyBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler): ! auth_header = 'Proxy-Authorization' def http_error_407(self, req, fp, code, msg, headers): --- 667,671 ---- class ProxyBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler): ! auth_header = 'Proxy-authorization' def http_error_407(self, req, fp, code, msg, headers): *************** *** 819,826 **** sel_host, sel_path = splithost(sel) h.putheader('Host', sel_host or host) ! for args in self.parent.addheaders: ! name, value = args if name not in req.headers: ! h.putheader(*args) for k, v in req.headers.items(): h.putheader(k, v) --- 819,826 ---- sel_host, sel_path = splithost(sel) h.putheader('Host', sel_host or host) ! for name, value in self.parent.addheaders: ! name = name.capitalize() if name not in req.headers: ! h.putheader(name, value) for k, v in req.headers.items(): h.putheader(k, v) *************** *** 944,948 **** mtype = mimetypes.guess_type(file)[0] headers = mimetools.Message(StringIO( ! 'Content-Type: %s\nContent-Length: %d\nLast-modified: %s\n' % (mtype or 'text/plain', size, modified))) if host: --- 944,948 ---- mtype = mimetypes.guess_type(file)[0] headers = mimetools.Message(StringIO( ! 'Content-type: %s\nContent-length: %d\nLast-modified: %s\n' % (mtype or 'text/plain', size, modified))) if host: *************** *** 986,992 **** mtype = mimetypes.guess_type(req.get_full_url())[0] if mtype: ! headers += "Content-Type: %s\n" % mtype if retrlen is not None and retrlen >= 0: ! headers += "Content-Length: %d\n" % retrlen sf = StringIO(headers) headers = mimetools.Message(sf) --- 986,992 ---- mtype = mimetypes.guess_type(req.get_full_url())[0] if mtype: ! headers += "Content-type: %s\n" % mtype if retrlen is not None and retrlen >= 0: ! headers += "Content-length: %d\n" % retrlen sf = StringIO(headers) headers = mimetools.Message(sf) From rhettinger@users.sourceforge.net Wed Jun 18 00:14:43 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 17 Jun 2003 16:14:43 -0700 Subject: [Python-checkins] python/dist/src/Modules itertoolsmodule.c,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv10715 Modified Files: itertoolsmodule.c Log Message: Add missing DECREF. Index: itertoolsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** itertoolsmodule.c 23 May 2003 03:55:42 -0000 1.15 --- itertoolsmodule.c 17 Jun 2003 23:14:40 -0000 1.16 *************** *** 1011,1016 **** /* create chainobject structure */ lz = (chainobject *)type->tp_alloc(type, 0); ! if (lz == NULL) return NULL; lz->ittuple = ittuple; --- 1011,1018 ---- /* create chainobject structure */ lz = (chainobject *)type->tp_alloc(type, 0); ! if (lz == NULL) { ! Py_DECREF(ittuple); return NULL; + } lz->ittuple = ittuple; From python@rcn.com Wed Jun 18 01:27:05 2003 From: python@rcn.com (Raymond Hettinger) Date: Tue, 17 Jun 2003 20:27:05 -0400 Subject: [Python-checkins] python/dist/src/Lib/lib-tk tkFileDialog.py,1.10,1.11 References: Message-ID: <008201c33530$58e34ea0$072acb97@oemcomputer> This fix looks to be incomplete. Opening a new window (Control+O) results in the following traceback: Exception in Tkinter callback Traceback (most recent call last): File "C:\PY23\lib\lib-tk\Tkinter.py", line 1343, in __call__ return self.func(*args) File "C:\PY23\lib\idlelib\IOBinding.py", line 198, in open filename = self.askopenfile() File "C:\PY23\lib\idlelib\IOBinding.py", line 517, in askopenfile return self.opendialog.show(initialdir=dir, initialfile=base) File "C:\PY23\lib\lib-tk\tkCommonDialog.py", line 54, in show s = self._fixresult(w, s) File "C:\PY23\lib\lib-tk\tkFileDialog.py", line 89, in _fixresult if not widget.tk.wantobjects() and "multiple" in self.options: TypeError: wantobjects() takes exactly 1 argument (0 given) From gward@users.sourceforge.net Wed Jun 18 01:53:08 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Tue, 17 Jun 2003 17:53:08 -0700 Subject: [Python-checkins] python/dist/src/Lib zipfile.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv21153/Lib Modified Files: zipfile.py Log Message: SF patch #755987 (Jim Ahlstrom): This is a patch for Bug 755031: If a null byte appears in a file name, Python zipfile.py retains it, but InfoZip terminates the name. Null bytes in file names are used as a trick by viruses. I tested WinZip, and it also truncates the file name at the null byte. The patch also fixes a buglet: If a zipfile incorrectly uses a directory separator other than '/', there was an invalid complaint that the central directory name does not match the file header name. I also removed my name from the top of the file. It was there for legal reasons which I believe no longer apply. Many people have worked on this file besides me. Index: zipfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/zipfile.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** zipfile.py 15 Jan 2003 11:51:06 -0000 1.28 --- zipfile.py 18 Jun 2003 00:53:06 -0000 1.29 *************** *** 1,5 **** "Read and write ZIP files." - # Written by James C. Ahlstrom jim@interet.com - # All rights transferred to CNRI pursuant to the Python contribution agreement import struct, os, time --- 1,3 ---- *************** *** 117,121 **** def __init__(self, filename="NoName", date_time=(1980,1,1,0,0,0)): ! self.filename = _normpath(filename) # Name of the file in the archive self.date_time = date_time # year, month, day, hour, min, sec # Standard values: --- 115,131 ---- def __init__(self, filename="NoName", date_time=(1980,1,1,0,0,0)): ! self.orig_filename = filename # Original file name in archive ! # Terminate the file name at the first null byte. Null bytes in file ! # names are used as tricks by viruses in archives. ! null_byte = filename.find(chr(0)) ! if null_byte >= 0: ! filename = filename[0:null_byte] ! print "File name %s contains a suspicious null byte!" % filename ! # This is used to ensure paths in generated ZIP files always use ! # forward slashes as the directory separator, as required by the ! # ZIP format specification. ! if os.sep != "/": ! filename = filename.replace(os.sep, "/") ! self.filename = filename # Normalized file name self.date_time = date_time # year, month, day, hour, min, sec # Standard values: *************** *** 158,172 **** - # This is used to ensure paths in generated ZIP files always use - # forward slashes as the directory separator, as required by the - # ZIP format specification. - if os.sep != "/": - def _normpath(path): - return path.replace(os.sep, "/") - else: - def _normpath(path): - return path - - class ZipFile: """ Class with methods to open, read, write, close, list zip files. --- 168,171 ---- *************** *** 301,308 **** + fheader[_FH_EXTRA_FIELD_LENGTH]) fname = fp.read(fheader[_FH_FILENAME_LENGTH]) ! if fname != data.filename: raise RuntimeError, \ 'File name in directory "%s" and header "%s" differ.' % ( ! data.filename, fname) def namelist(self): --- 300,307 ---- + fheader[_FH_EXTRA_FIELD_LENGTH]) fname = fp.read(fheader[_FH_FILENAME_LENGTH]) ! if fname != data.orig_filename: raise RuntimeError, \ 'File name in directory "%s" and header "%s" differ.' % ( ! data.orig_filename, fname) def namelist(self): From gward@users.sourceforge.net Wed Jun 18 01:54:30 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Tue, 17 Jun 2003 17:54:30 -0700 Subject: [Python-checkins] python/dist/src/Lib zipfile.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv21376 Modified Files: zipfile.py Log Message: Remove debug print on filename with NUL byte. Index: zipfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/zipfile.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** zipfile.py 18 Jun 2003 00:53:06 -0000 1.29 --- zipfile.py 18 Jun 2003 00:54:28 -0000 1.30 *************** *** 121,125 **** if null_byte >= 0: filename = filename[0:null_byte] - print "File name %s contains a suspicious null byte!" % filename # This is used to ensure paths in generated ZIP files always use # forward slashes as the directory separator, as required by the --- 121,124 ---- From guido@python.org Wed Jun 18 02:01:07 2003 From: guido@python.org (Guido van Rossum) Date: Tue, 17 Jun 2003 21:01:07 -0400 Subject: [Python-checkins] python/dist/src/Lib/lib-tk tkFileDialog.py,1.10,1.11 In-Reply-To: "Your message of Tue, 17 Jun 2003 20:27:05 EDT." <008201c33530$58e34ea0$072acb97@oemcomputer> References: <008201c33530$58e34ea0$072acb97@oemcomputer> Message-ID: <200306180101.h5I117g18589@pcp02138704pcs.reston01.va.comcast.net> > This fix looks to be incomplete. > Opening a new window (Control+O) results in the > following traceback: > > > Exception in Tkinter callback > Traceback (most recent call last): > File "C:\PY23\lib\lib-tk\Tkinter.py", line 1343, in __call__ > return self.func(*args) > File "C:\PY23\lib\idlelib\IOBinding.py", line 198, in open > filename = self.askopenfile() > File "C:\PY23\lib\idlelib\IOBinding.py", line 517, in askopenfile > return self.opendialog.show(initialdir=dir, initialfile=base) > File "C:\PY23\lib\lib-tk\tkCommonDialog.py", line 54, in show > s = self._fixresult(w, s) > File "C:\PY23\lib\lib-tk\tkFileDialog.py", line 89, in _fixresult > if not widget.tk.wantobjects() and "multiple" in self.options: > TypeError: wantobjects() takes exactly 1 argument (0 given) Can't reproduce this on Linux. Looks like you have an out-of-date verson of _tkinter; the source I have definitely accepts 0 or 1 arguments. --Guido van Rossum (home page: http://www.python.org/~guido/) From gward@users.sourceforge.net Wed Jun 18 02:05:36 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Tue, 17 Jun 2003 18:05:36 -0700 Subject: [Python-checkins] python/dist/src/Lib zipfile.py,1.20,1.20.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv22404 Modified Files: Tag: release22-maint zipfile.py Log Message: Patch #755987 (bug #755031): backport from trunk. Index: zipfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/zipfile.py,v retrieving revision 1.20 retrieving revision 1.20.6.1 diff -C2 -d -r1.20 -r1.20.6.1 *** zipfile.py 6 Dec 2001 06:23:25 -0000 1.20 --- zipfile.py 18 Jun 2003 01:05:34 -0000 1.20.6.1 *************** *** 1,5 **** "Read and write ZIP files." - # Written by James C. Ahlstrom jim@interet.com - # All rights transferred to CNRI pursuant to the Python contribution agreement import struct, os, time --- 1,3 ---- *************** *** 93,97 **** def __init__(self, filename="NoName", date_time=(1980,1,1,0,0,0)): ! self.filename = _normpath(filename) # Name of the file in the archive self.date_time = date_time # year, month, day, hour, min, sec # Standard values: --- 91,106 ---- def __init__(self, filename="NoName", date_time=(1980,1,1,0,0,0)): ! self.orig_filename = filename # Original file name in archive ! # Terminate the file name at the first null byte. Null bytes in file ! # names are used as tricks by viruses in archives. ! null_byte = filename.find(chr(0)) ! if null_byte >= 0: ! filename = filename[0:null_byte] ! # This is used to ensure paths in generated ZIP files always use ! # forward slashes as the directory separator, as required by the ! # ZIP format specification. ! if os.sep != "/": ! filename = filename.replace(os.sep, "/") ! self.filename = filename # Normalized file name self.date_time = date_time # year, month, day, hour, min, sec # Standard values: *************** *** 134,148 **** - # This is used to ensure paths in generated ZIP files always use - # forward slashes as the directory separator, as required by the - # ZIP format specification. - if os.sep != "/": - def _normpath(path): - return path.replace(os.sep, "/") - else: - def _normpath(path): - return path - - class ZipFile: """ Class with methods to open, read, write, close, list zip files. --- 143,146 ---- *************** *** 282,289 **** + fheader[_FH_EXTRA_FIELD_LENGTH]) fname = fp.read(fheader[_FH_FILENAME_LENGTH]) ! if fname != data.filename: raise RuntimeError, \ 'File name in directory "%s" and header "%s" differ.' % ( ! data.filename, fname) def namelist(self): --- 280,287 ---- + fheader[_FH_EXTRA_FIELD_LENGTH]) fname = fp.read(fheader[_FH_FILENAME_LENGTH]) ! if fname != data.orig_filename: raise RuntimeError, \ 'File name in directory "%s" and header "%s" differ.' % ( ! data.orig_filename, fname) def namelist(self): From guido@python.org Wed Jun 18 02:11:04 2003 From: guido@python.org (Guido van Rossum) Date: Tue, 17 Jun 2003 21:11:04 -0400 Subject: [Python-checkins] python/dist/src/Lib/lib-tk tkFileDialog.py,1.10,1.11 In-Reply-To: "Your message of Tue, 17 Jun 2003 21:01:07 EDT." <200306180101.h5I117g18589@pcp02138704pcs.reston01.va.comcast.net> References: <008201c33530$58e34ea0$072acb97@oemcomputer> <200306180101.h5I117g18589@pcp02138704pcs.reston01.va.comcast.net> Message-ID: <200306180111.h5I1B5Y25048@pcp02138704pcs.reston01.va.comcast.net> > > This fix looks to be incomplete. > > Opening a new window (Control+O) results in the > > following traceback: > > > > > > Exception in Tkinter callback > > Traceback (most recent call last): > > File "C:\PY23\lib\lib-tk\Tkinter.py", line 1343, in __call__ > > return self.func(*args) > > File "C:\PY23\lib\idlelib\IOBinding.py", line 198, in open > > filename = self.askopenfile() > > File "C:\PY23\lib\idlelib\IOBinding.py", line 517, in askopenfile > > return self.opendialog.show(initialdir=dir, initialfile=base) > > File "C:\PY23\lib\lib-tk\tkCommonDialog.py", line 54, in show > > s = self._fixresult(w, s) > > File "C:\PY23\lib\lib-tk\tkFileDialog.py", line 89, in _fixresult > > if not widget.tk.wantobjects() and "multiple" in self.options: > > TypeError: wantobjects() takes exactly 1 argument (0 given) > > Can't reproduce this on Linux. Looks like you have an out-of-date > verson of _tkinter; the source I have definitely accepts 0 or 1 > arguments. Can't reproduce it on Windows either. DLL hell??? --Guido van Rossum (home page: http://www.python.org/~guido/) From rhettinger@users.sourceforge.net Wed Jun 18 02:13:43 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 17 Jun 2003 18:13:43 -0700 Subject: [Python-checkins] python/dist/src/Objects funcobject.c,2.62,2.63 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv23135/Objects Modified Files: funcobject.c Log Message: SF bug #753451: classmethod abuse --> SystemError Check the argument to classmethod for callability. Backport candidate. Index: funcobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v retrieving revision 2.62 retrieving revision 2.63 diff -C2 -d -r2.62 -r2.63 *** funcobject.c 6 May 2003 09:01:41 -0000 2.62 --- funcobject.c 18 Jun 2003 01:13:41 -0000 2.63 *************** *** 641,644 **** --- 641,650 ---- if (!PyArg_UnpackTuple(args, "classmethod", 1, 1, &callable)) return -1; + if (!PyCallable_Check(callable)) { + PyErr_Format(PyExc_TypeError, "'%s' object is not callable", + callable->ob_type->tp_name); + return -1; + } + Py_INCREF(callable); cm->cm_callable = callable; From rhettinger@users.sourceforge.net Wed Jun 18 02:13:44 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 17 Jun 2003 18:13:44 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.194,1.195 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv23135/Lib/test Modified Files: test_descr.py Log Message: SF bug #753451: classmethod abuse --> SystemError Check the argument to classmethod for callability. Backport candidate. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.194 retrieving revision 1.195 diff -C2 -d -r1.194 -r1.195 *** test_descr.py 16 Jun 2003 22:51:22 -0000 1.194 --- test_descr.py 18 Jun 2003 01:13:41 -0000 1.195 *************** *** 1486,1489 **** --- 1486,1497 ---- vereq(super(D,d).goo(), (D,)) + # Verify that argument is checked for callability (SF bug 753451) + try: + classmethod(1).__get__(1) + except TypeError: + pass + else: + raise TestFailed, "classmethod should check for callability" + def classmethods_in_c(): if verbose: print "Testing C-based class methods..." From rhettinger@users.sourceforge.net Wed Jun 18 02:32:27 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 17 Jun 2003 18:32:27 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref6.tex,1.65,1.66 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv25452 Modified Files: ref6.tex Log Message: SF patch #751038 fixing SF bug#750092: exec doesn't need newline Patch contributed by Steven Taschuk. Index: ref6.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref6.tex,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** ref6.tex 29 May 2003 02:17:23 -0000 1.65 --- ref6.tex 18 Jun 2003 01:32:24 -0000 1.66 *************** *** 897,906 **** \bifuncindex{locals} - Also, in the current implementation, multi-line compound statements must - end with a newline: - \code{exec "for v in seq:\e{}n\e{}tprint v\e{}n"} works, but - \code{exec "for v in seq:\e{}n\e{}tprint v"} fails with - \exception{SyntaxError}. - \exindex{SyntaxError} --- 897,900 ---- From kbk@shore.net Wed Jun 18 02:36:10 2003 From: kbk@shore.net (Kurt B. Kaiser) Date: Tue, 17 Jun 2003 21:36:10 -0400 Subject: [Python-checkins] python/dist/src/Lib/lib-tk tkFileDialog.py,1.10,1.11 In-Reply-To: <008201c33530$58e34ea0$072acb97@oemcomputer> ("Raymond Hettinger"'s message of "Tue, 17 Jun 2003 20:27:05 -0400") References: <008201c33530$58e34ea0$072acb97@oemcomputer> Message-ID: "Raymond Hettinger" writes: > This fix looks to be incomplete. > Opening a new window (Control+O) results in the > following traceback: > > > Exception in Tkinter callback > Traceback (most recent call last): > File "C:\PY23\lib\lib-tk\Tkinter.py", line 1343, in __call__ > return self.func(*args) > File "C:\PY23\lib\idlelib\IOBinding.py", line 198, in open > filename = self.askopenfile() > File "C:\PY23\lib\idlelib\IOBinding.py", line 517, in askopenfile > return self.opendialog.show(initialdir=dir, initialfile=base) > File "C:\PY23\lib\lib-tk\tkCommonDialog.py", line 54, in show > s = self._fixresult(w, s) > File "C:\PY23\lib\lib-tk\tkFileDialog.py", line 89, in _fixresult > if not widget.tk.wantobjects() and "multiple" in self.options: > TypeError: wantobjects() takes exactly 1 argument (0 given) Are you sure the fix is in /usr/local/lib/python2.3/lib-tk/tkFileDialog.py? It was applied in .../src/Lib/lib-tk and needs installation? Works for me on Linux __ KBK From python@rcn.com Wed Jun 18 02:35:24 2003 From: python@rcn.com (Raymond Hettinger) Date: Tue, 17 Jun 2003 21:35:24 -0400 Subject: [Python-checkins] python/dist/src/Lib/lib-tk tkFileDialog.py,1.10,1.11 References: <008201c33530$58e34ea0$072acb97@oemcomputer> Message-ID: <00ba01c33539$e41204e0$072acb97@oemcomputer> All is well. I needed to recompile _tkinter.c Thanks Guido. Raymond From rhettinger@users.sourceforge.net Wed Jun 18 02:58:33 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 17 Jun 2003 18:58:33 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcodecs.tex,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv28373 Modified Files: libcodecs.tex Log Message: Fix typo. Index: libcodecs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcodecs.tex,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** libcodecs.tex 30 Apr 2003 15:02:07 -0000 1.20 --- libcodecs.tex 18 Jun 2003 01:58:31 -0000 1.21 *************** *** 941,945 **** \end{funcdesc} ! \begin{funcdesc}{ToASCCII}{label} Convert a label to \ASCII, as specified in \rfc{3490}. \code{UseSTD3ASCIIRules} is assumed to be false. --- 941,945 ---- \end{funcdesc} ! \begin{funcdesc}{ToASCII}{label} Convert a label to \ASCII, as specified in \rfc{3490}. \code{UseSTD3ASCIIRules} is assumed to be false. From doerwalter@users.sourceforge.net Wed Jun 18 15:17:04 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 18 Jun 2003 07:17:04 -0700 Subject: [Python-checkins] python/dist/src/Objects stringobject.c,2.208,2.209 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv32596/Objects Modified Files: stringobject.c Log Message: Fix whitespace. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.208 retrieving revision 2.209 diff -C2 -d -r2.208 -r2.209 *** stringobject.c 10 Apr 2003 22:35:32 -0000 2.208 --- stringobject.c 18 Jun 2003 14:17:01 -0000 2.209 *************** *** 3868,3872 **** #endif /* Fall through */ ! case 'r': if (c == 's') temp = PyObject_Str(v); --- 3868,3872 ---- #endif /* Fall through */ ! case 'r': if (c == 's') temp = PyObject_Str(v); From jackjansen@users.sourceforge.net Wed Jun 18 15:17:36 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 18 Jun 2003 07:17:36 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac gensuitemodule.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv32671 Modified Files: gensuitemodule.py Log Message: An indenting error in the code made it miss some suites that have an application class. Index: gensuitemodule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/gensuitemodule.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** gensuitemodule.py 13 Jun 2003 14:27:35 -0000 1.9 --- gensuitemodule.py 18 Jun 2003 14:17:34 -0000 1.10 *************** *** 531,536 **** for k, v in codenamemapper.getall('class'): fp.write(" %s : %s,\n" % (`k`, v)) ! if k == 'capp': ! application_class = v fp.write("}\n") --- 531,536 ---- for k, v in codenamemapper.getall('class'): fp.write(" %s : %s,\n" % (`k`, v)) ! if k == 'capp': ! application_class = v fp.write("}\n") From jackjansen@users.sourceforge.net Wed Jun 18 15:19:10 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 18 Jun 2003 07:19:10 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac aetools.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv314 Modified Files: aetools.py Log Message: Give default _elemdict and _propdict attributes to OSA classes, so we don't get infinite recursion for suites that don't have an application class. Also got rid of some tabs. Index: aetools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/aetools.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** aetools.py 13 Jun 2003 14:27:35 -0000 1.8 --- aetools.py 18 Jun 2003 14:19:08 -0000 1.9 *************** *** 144,148 **** """An AE connection to an application""" _signature = None # Can be overridden by subclasses ! _moduleName = None # Can be overridden by subclasses __eventloop_initialized = 0 --- 144,150 ---- """An AE connection to an application""" _signature = None # Can be overridden by subclasses ! _moduleName = None # Can be overridden by subclasses ! _elemdict = {} # Can be overridden by subclasses ! _propdict = {} # Can be overridden by subclasses __eventloop_initialized = 0 *************** *** 285,291 **** set = _set ! # Magic glue to allow suite-generated classes to function somewhat ! # like the "application" class in OSA. ! def __getattr__(self, name): if self._elemdict.has_key(name): --- 287,293 ---- set = _set ! # Magic glue to allow suite-generated classes to function somewhat ! # like the "application" class in OSA. ! def __getattr__(self, name): if self._elemdict.has_key(name): From doerwalter@users.sourceforge.net Wed Jun 18 15:26:21 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 18 Jun 2003 07:26:21 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_builtin.py,1.20,1.21 test_complex.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv1935/Lib/test Modified Files: test_builtin.py test_complex.py Log Message: Port test_complex.py to unittest. Move the constructor tests from test_builtin to test_complex. Add a bunch of tests (code coverage is a 94%). >From SF patch #736962. Index: test_builtin.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_builtin.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** test_builtin.py 2 May 2003 09:06:25 -0000 1.20 --- test_builtin.py 18 Jun 2003 14:26:18 -0000 1.21 *************** *** 202,261 **** compile(unicode('print u"\xc3\xa5"\n', 'utf8'), '', 'exec') - def test_complex(self): - class OS: - def __complex__(self): return 1+10j - class NS(object): - def __complex__(self): return 1+10j - self.assertEqual(complex(OS()), 1+10j) - self.assertEqual(complex(NS()), 1+10j) - self.assertEqual(complex("1+10j"), 1+10j) - self.assertEqual(complex(10), 10+0j) - self.assertEqual(complex(10.0), 10+0j) - self.assertEqual(complex(10L), 10+0j) - self.assertEqual(complex(10+0j), 10+0j) - self.assertEqual(complex(1,10), 1+10j) - self.assertEqual(complex(1,10L), 1+10j) - self.assertEqual(complex(1,10.0), 1+10j) - self.assertEqual(complex(1L,10), 1+10j) - self.assertEqual(complex(1L,10L), 1+10j) - self.assertEqual(complex(1L,10.0), 1+10j) - self.assertEqual(complex(1.0,10), 1+10j) - self.assertEqual(complex(1.0,10L), 1+10j) - self.assertEqual(complex(1.0,10.0), 1+10j) - self.assertEqual(complex(3.14+0j), 3.14+0j) - self.assertEqual(complex(3.14), 3.14+0j) - self.assertEqual(complex(314), 314.0+0j) - self.assertEqual(complex(314L), 314.0+0j) - self.assertEqual(complex(3.14+0j, 0j), 3.14+0j) - self.assertEqual(complex(3.14, 0.0), 3.14+0j) - self.assertEqual(complex(314, 0), 314.0+0j) - self.assertEqual(complex(314L, 0L), 314.0+0j) - self.assertEqual(complex(0j, 3.14j), -3.14+0j) - self.assertEqual(complex(0.0, 3.14j), -3.14+0j) - self.assertEqual(complex(0j, 3.14), 3.14j) - self.assertEqual(complex(0.0, 3.14), 3.14j) - self.assertEqual(complex("1"), 1+0j) - self.assertEqual(complex("1j"), 1j) - - c = 3.14 + 1j - self.assert_(complex(c) is c) - del c - - self.assertRaises(TypeError, complex, "1", "1") - self.assertRaises(TypeError, complex, 1, "1") - - self.assertEqual(complex(" 3.14+J "), 3.14+1j) - if have_unicode: - self.assertEqual(complex(unicode(" 3.14+J ")), 3.14+1j) - - # SF bug 543840: complex(string) accepts strings with \0 - # Fixed in 2.3. - self.assertRaises(ValueError, complex, '1+1j\0j') - - class Z: - def __complex__(self): return 3.14j - z = Z() - self.assertEqual(complex(z), 3.14j) - def test_delattr(self): import sys --- 202,205 ---- Index: test_complex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_complex.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_complex.py 30 Jul 2002 23:26:01 -0000 1.9 --- test_complex.py 18 Jun 2003 14:26:18 -0000 1.10 *************** *** 1,91 **** ! from test.test_support import TestFailed, vereq from random import random ! # These tests ensure that complex math does the right thing; tests of ! # the complex() function/constructor are in test_b1.py. ! # XXX need many, many more tests here. ! nerrors = 0 ! def check_close_real(x, y, eps=1e-9): ! """Return true iff floats x and y "are close\"""" ! # put the one with larger magnitude second ! if abs(x) > abs(y): ! x, y = y, x ! if y == 0: ! return abs(x) < eps ! if x == 0: ! return abs(y) < eps ! # check that relative difference < eps ! return abs((x-y)/y) < eps ! def check_close(x, y, eps=1e-9): ! """Return true iff complexes x and y "are close\"""" ! return check_close_real(x.real, y.real, eps) and \ ! check_close_real(x.imag, y.imag, eps) ! def test_div(x, y): ! """Compute complex z=x*y, and check that z/x==y and z/y==x.""" ! global nerrors ! z = x * y ! if x != 0: ! q = z / x ! if not check_close(q, y): ! nerrors += 1 ! print "%r / %r == %r but expected %r" % (z, x, q, y) ! if y != 0: ! q = z / y ! if not check_close(q, x): ! nerrors += 1 ! print "%r / %r == %r but expected %r" % (z, y, q, x) ! simple_real = [float(i) for i in range(-5, 6)] ! simple_complex = [complex(x, y) for x in simple_real for y in simple_real] ! for x in simple_complex: ! for y in simple_complex: ! test_div(x, y) ! # A naive complex division algorithm (such as in 2.0) is very prone to ! # nonsense errors for these (overflows and underflows). ! test_div(complex(1e200, 1e200), 1+0j) ! test_div(complex(1e-200, 1e-200), 1+0j) ! # Just for fun. ! for i in range(100): ! test_div(complex(random(), random()), ! complex(random(), random())) ! for i in range(100): ! if not complex(random() + 1e-6, random() + 1e-6): ! raise TestFailed("complex(random(), random()) should be true") ! if complex(0.0, 0.0): ! raise TestFailed("complex(0.0, 0.0) should be false") ! vereq(complex(5.3, 9.8).conjugate(), 5.3-9.8j) ! try: ! print int(5+3j) ! except TypeError: ! pass ! else: ! raise TestFailed("int(complex()) didn't raise TypeError") ! try: ! print float(5+3j) ! except TypeError: ! pass ! else: ! raise TestFailed("float(complex()) didn't raise TypeError") ! try: ! z = 1.0 / (0+0j) ! except ZeroDivisionError: ! pass ! else: ! nerrors += 1 ! raise TestFailed("Division by complex 0 didn't raise ZeroDivisionError") ! if nerrors: ! raise TestFailed("%d tests failed" % nerrors) --- 1,251 ---- ! import unittest ! from test import test_support ! ! import warnings ! warnings.filterwarnings( ! "ignore", ! category=DeprecationWarning, ! message=".*complex divmod.*are deprecated" ! ) ! from random import random ! # These tests ensure that complex math does the right thing ! class ComplexTest(unittest.TestCase): ! def assertAlmostEqual(self, a, b): ! if isinstance(a, complex): ! if isinstance(b, complex): ! unittest.TestCase.assertAlmostEqual(self, a.real, b.real) ! unittest.TestCase.assertAlmostEqual(self, a.imag, b.imag) ! else: ! unittest.TestCase.assertAlmostEqual(self, a.real, b) ! unittest.TestCase.assertAlmostEqual(self, a.imag, 0.) ! else: ! if isinstance(b, complex): ! unittest.TestCase.assertAlmostEqual(self, a, b.real) ! unittest.TestCase.assertAlmostEqual(self, 0., b.imag) ! else: ! unittest.TestCase.assertAlmostEqual(self, a, b) ! def assertCloseAbs(self, x, y, eps=1e-9): ! """Return true iff floats x and y "are close\"""" ! # put the one with larger magnitude second ! if abs(x) > abs(y): ! x, y = y, x ! if y == 0: ! return abs(x) < eps ! if x == 0: ! return abs(y) < eps ! # check that relative difference < eps ! self.assert_(abs((x-y)/y) < eps) ! def assertClose(self, x, y, eps=1e-9): ! """Return true iff complexes x and y "are close\"""" ! self.assertCloseAbs(x.real, y.real, eps) ! self.assertCloseAbs(x.imag, y.imag, eps) ! def assertIs(self, a, b): ! self.assert_(a is b) ! def check_div(self, x, y): ! """Compute complex z=x*y, and check that z/x==y and z/y==x.""" ! z = x * y ! if x != 0: ! q = z / x ! self.assertClose(q, y) ! if y != 0: ! q = z / y ! self.assertClose(q, x) ! def test_div(self): ! simple_real = [float(i) for i in xrange(-5, 6)] ! simple_complex = [complex(x, y) for x in simple_real for y in simple_real] ! for x in simple_complex: ! for y in simple_complex: ! self.check_div(x, y) ! # A naive complex division algorithm (such as in 2.0) is very prone to ! # nonsense errors for these (overflows and underflows). ! self.check_div(complex(1e200, 1e200), 1+0j) ! self.check_div(complex(1e-200, 1e-200), 1+0j) ! # Just for fun. ! for i in xrange(100): ! self.check_div(complex(random(), random()), ! complex(random(), random())) ! self.assertRaises(ZeroDivisionError, complex.__div__, 1+1j, 0+0j) ! # FIXME: The following currently crashes on Alpha ! # self.assertRaises(OverflowError, pow, 1e200+1j, 1e200+1j) ! def test_truediv(self): ! self.assertAlmostEqual(complex.__truediv__(2+0j, 1+1j), 1-1j) ! self.assertRaises(ZeroDivisionError, complex.__truediv__, 1+1j, 0+0j) ! def test_floordiv(self): ! self.assertAlmostEqual(complex.__floordiv__(3+0j, 1.5+0j), 2) ! self.assertRaises(ZeroDivisionError, complex.__floordiv__, 3+0j, 0+0j) ! def test_coerce(self): ! self.assertRaises(OverflowError, complex.__coerce__, 1+1j, 1L<<10000) ! def test_richcompare(self): ! self.assertRaises(OverflowError, complex.__eq__, 1+1j, 1L<<10000) ! self.assertEqual(complex.__lt__(1+1j, None), NotImplemented) ! self.assertIs(complex.__eq__(1+1j, 1+1j), True) ! self.assertIs(complex.__eq__(1+1j, 2+2j), False) ! self.assertIs(complex.__ne__(1+1j, 1+1j), False) ! self.assertIs(complex.__ne__(1+1j, 2+2j), True) ! self.assertRaises(TypeError, complex.__lt__, 1+1j, 2+2j) ! self.assertRaises(TypeError, complex.__le__, 1+1j, 2+2j) ! self.assertRaises(TypeError, complex.__gt__, 1+1j, 2+2j) ! self.assertRaises(TypeError, complex.__ge__, 1+1j, 2+2j) ! def test_mod(self): ! self.assertRaises(ZeroDivisionError, (1+1j).__mod__, 0+0j) ! ! def test_divmod(self): ! self.assertRaises(ZeroDivisionError, divmod, 1+1j, 0+0j) ! ! def test_pow(self): ! self.assertAlmostEqual(pow(1+1j, 0+0j), 1.0) ! self.assertAlmostEqual(pow(0+0j, 2+0j), 0.0) ! self.assertRaises(ZeroDivisionError, pow, 0+0j, 1j) ! self.assertAlmostEqual(pow(1j, -1), 1/1j) ! self.assertAlmostEqual(pow(1j, 200), 1) ! self.assertRaises(ValueError, pow, 1+1j, 1+1j, 1+1j) ! ! def test_boolcontext(self): ! for i in xrange(100): ! self.assert_(complex(random() + 1e-6, random() + 1e-6)) ! self.assert_(not complex(0.0, 0.0)) ! ! def test_conjugate(self): ! self.assertClose(complex(5.3, 9.8).conjugate(), 5.3-9.8j) ! ! def test_constructor(self): ! class OS: ! def __init__(self, value): self.value = value ! def __complex__(self): return self.value ! class NS(object): ! def __init__(self, value): self.value = value ! def __complex__(self): return self.value ! self.assertEqual(complex(OS(1+10j)), 1+10j) ! self.assertEqual(complex(NS(1+10j)), 1+10j) ! self.assertRaises(TypeError, complex, OS(None)) ! self.assertRaises(TypeError, complex, NS(None)) ! ! self.assertAlmostEqual(complex("1+10j"), 1+10j) ! self.assertAlmostEqual(complex(10), 10+0j) ! self.assertAlmostEqual(complex(10.0), 10+0j) ! self.assertAlmostEqual(complex(10L), 10+0j) ! self.assertAlmostEqual(complex(10+0j), 10+0j) ! self.assertAlmostEqual(complex(1,10), 1+10j) ! self.assertAlmostEqual(complex(1,10L), 1+10j) ! self.assertAlmostEqual(complex(1,10.0), 1+10j) ! self.assertAlmostEqual(complex(1L,10), 1+10j) ! self.assertAlmostEqual(complex(1L,10L), 1+10j) ! self.assertAlmostEqual(complex(1L,10.0), 1+10j) ! self.assertAlmostEqual(complex(1.0,10), 1+10j) ! self.assertAlmostEqual(complex(1.0,10L), 1+10j) ! self.assertAlmostEqual(complex(1.0,10.0), 1+10j) ! self.assertAlmostEqual(complex(3.14+0j), 3.14+0j) ! self.assertAlmostEqual(complex(3.14), 3.14+0j) ! self.assertAlmostEqual(complex(314), 314.0+0j) ! self.assertAlmostEqual(complex(314L), 314.0+0j) ! self.assertAlmostEqual(complex(3.14+0j, 0j), 3.14+0j) ! self.assertAlmostEqual(complex(3.14, 0.0), 3.14+0j) ! self.assertAlmostEqual(complex(314, 0), 314.0+0j) ! self.assertAlmostEqual(complex(314L, 0L), 314.0+0j) ! self.assertAlmostEqual(complex(0j, 3.14j), -3.14+0j) ! self.assertAlmostEqual(complex(0.0, 3.14j), -3.14+0j) ! self.assertAlmostEqual(complex(0j, 3.14), 3.14j) ! self.assertAlmostEqual(complex(0.0, 3.14), 3.14j) ! self.assertAlmostEqual(complex("1"), 1+0j) ! self.assertAlmostEqual(complex("1j"), 1j) ! self.assertAlmostEqual(complex(), 0) ! self.assertAlmostEqual(complex("-1"), -1) ! self.assertAlmostEqual(complex("+1"), +1) ! ! class complex2(complex): pass ! self.assertAlmostEqual(complex(complex2(1+1j)), 1+1j) ! self.assertAlmostEqual(complex(real=17, imag=23), 17+23j) ! self.assertAlmostEqual(complex(real=17+23j), 17+23j) ! self.assertAlmostEqual(complex(real=17+23j, imag=23), 17+46j) ! self.assertAlmostEqual(complex(real=1+2j, imag=3+4j), -3+5j) ! ! c = 3.14 + 1j ! self.assert_(complex(c) is c) ! del c ! ! self.assertRaises(TypeError, complex, "1", "1") ! self.assertRaises(TypeError, complex, 1, "1") ! ! self.assertEqual(complex(" 3.14+J "), 3.14+1j) ! if test_support.have_unicode: ! self.assertEqual(complex(unicode(" 3.14+J ")), 3.14+1j) ! ! # SF bug 543840: complex(string) accepts strings with \0 ! # Fixed in 2.3. ! self.assertRaises(ValueError, complex, '1+1j\0j') ! ! self.assertRaises(TypeError, int, 5+3j) ! self.assertRaises(TypeError, long, 5+3j) ! self.assertRaises(TypeError, float, 5+3j) ! self.assertRaises(ValueError, complex, "") ! self.assertRaises(TypeError, complex, None) ! self.assertRaises(ValueError, complex, "\0") ! self.assertRaises(TypeError, complex, "1", "2") ! self.assertRaises(TypeError, complex, "1", 42) ! self.assertRaises(TypeError, complex, 1, "2") ! self.assertRaises(ValueError, complex, "1+") ! self.assertRaises(ValueError, complex, "1+1j+1j") ! self.assertRaises(ValueError, complex, "--") ! if test_support.have_unicode: ! self.assertRaises(ValueError, complex, unicode("1"*500)) ! self.assertRaises(ValueError, complex, unicode("x")) ! ! class EvilExc(Exception): ! pass ! ! class evilcomplex: ! def __complex__(self): ! raise EvilExc ! ! self.assertRaises(EvilExc, complex, evilcomplex()) ! ! class float2: ! def __init__(self, value): ! self.value = value ! def __float__(self): ! return self.value ! ! self.assertAlmostEqual(complex(float2(42.)), 42) ! self.assertAlmostEqual(complex(real=float2(17.), imag=float2(23.)), 17+23j) ! self.assertRaises(TypeError, complex, float2(None)) ! ! def test_hash(self): ! for x in xrange(-30, 30): ! self.assertEqual(hash(x), hash(complex(x, 0))) ! x /= 3.0 # now check against floating point ! self.assertEqual(hash(x), hash(complex(x, 0.))) ! ! def test_abs(self): ! nums = [complex(x/3., y/7.) for x in xrange(-9,9) for y in xrange(-9,9)] ! for num in nums: ! self.assertAlmostEqual((num.real**2 + num.imag**2) ** 0.5, abs(num)) ! ! def test_repr(self): ! self.assertEqual(repr(1+6j), '(1+6j)') ! ! def test_neg(self): ! self.assertEqual(-(1+6j), -1-6j) ! ! ! def test_main(): ! test_support.run_unittest(ComplexTest) ! ! if __name__ == "__main__": ! test_main() From fdrake@users.sourceforge.net Wed Jun 18 18:14:31 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 18 Jun 2003 10:14:31 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.185,1.186 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv28400 Modified Files: tut.tex Log Message: Include "instances of most classes" in a warning about mutable objects as default values of function/method parameters. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.185 retrieving revision 1.186 diff -C2 -d -r1.185 -r1.186 *** tut.tex 20 May 2003 15:28:58 -0000 1.185 --- tut.tex 18 Jun 2003 17:14:29 -0000 1.186 *************** *** 1389,1394 **** \strong{Important warning:} The default value is evaluated only once. This makes a difference when the default is a mutable object such as a ! list or dictionary. For example, the following function accumulates ! the arguments passed to it on subsequent calls: \begin{verbatim} --- 1389,1395 ---- \strong{Important warning:} The default value is evaluated only once. This makes a difference when the default is a mutable object such as a ! list, dictionary, or instances of most classes. For example, the ! following function accumulates the arguments passed to it on ! subsequent calls: \begin{verbatim} From fdrake@users.sourceforge.net Wed Jun 18 18:17:13 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 18 Jun 2003 10:17:13 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.156.4.1.2.17,1.156.4.1.2.18 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv28751 Modified Files: Tag: release22-maint tut.tex Log Message: Include "instances of most classes" in a warning about mutable objects as default values of function/method parameters. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.156.4.1.2.17 retrieving revision 1.156.4.1.2.18 diff -C2 -d -r1.156.4.1.2.17 -r1.156.4.1.2.18 *** tut.tex 7 May 2003 16:02:06 -0000 1.156.4.1.2.17 --- tut.tex 18 Jun 2003 17:17:10 -0000 1.156.4.1.2.18 *************** *** 1389,1394 **** \strong{Important warning:} The default value is evaluated only once. This makes a difference when the default is a mutable object such as a ! list or dictionary. For example, the following function accumulates ! the arguments passed to it on subsequent calls: \begin{verbatim} --- 1389,1395 ---- \strong{Important warning:} The default value is evaluated only once. This makes a difference when the default is a mutable object such as a ! list, dictionary, or instances of most classes. For example, the ! following function accumulates the arguments passed to it on ! subsequent calls: \begin{verbatim} From rhettinger@users.sourceforge.net Wed Jun 18 20:25:39 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 18 Jun 2003 12:25:39 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libitertools.tex,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv15836/Doc/lib Modified Files: libitertools.tex Log Message: Minor updates: * Updated comment on design of imap() * Added untraversed object in izip() structure * Replaced the pairwise() example with a more general window() example Index: libitertools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libitertools.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** libitertools.tex 2 May 2003 19:44:20 -0000 1.9 --- libitertools.tex 18 Jun 2003 19:25:37 -0000 1.10 *************** *** 359,366 **** ... return not nth(ifilter(pred, seq), 0) - >>> def pairwise(seq): - ... "s -> (s0,s1), (s1,s2), (s2, s3), ..." - ... return izip(seq, islice(seq,1,None)) - >>> def padnone(seq): ... "Returns the sequence elements and then returns None indefinitely" --- 359,362 ---- *************** *** 373,376 **** --- 369,383 ---- >>> def dotproduct(vec1, vec2): ... return sum(imap(operator.mul, vec1, vec2)) + + >>> def window(seq, n=2): + ... "Returns a sliding window (of width n) over data from the iterable" + ... " s -> (s0,s1,...s[n-1]), (s1,s2,...,sn), ... " + ... it = iter(seq) + ... result = tuple(islice(it, n)) + ... if len(result) == n: + ... yield result + ... for elem in it: + ... result = result[1:] + (elem,) + ... yield result \end{verbatim} From rhettinger@users.sourceforge.net Wed Jun 18 20:25:39 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 18 Jun 2003 12:25:39 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_itertools.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv15836/Lib/test Modified Files: test_itertools.py Log Message: Minor updates: * Updated comment on design of imap() * Added untraversed object in izip() structure * Replaced the pairwise() example with a more general window() example Index: test_itertools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_itertools.py 29 May 2003 07:18:57 -0000 1.12 --- test_itertools.py 18 Jun 2003 19:25:37 -0000 1.13 *************** *** 428,435 **** ... return not nth(ifilter(pred, seq), 0) - >>> def pairwise(seq): - ... "s -> (s0,s1), (s1,s2), (s2, s3), ..." - ... return izip(seq, islice(seq,1,len(seq))) - >>> def padnone(seq): ... "Returns the sequence elements and then returns None indefinitely" --- 428,431 ---- *************** *** 443,446 **** --- 439,452 ---- ... return sum(imap(operator.mul, vec1, vec2)) + >>> def window(seq, n=2): + ... "Returns a sliding window (of width n) over data from the iterable" + ... " s -> (s0,s1,...s[n-1]), (s1,s2,...,sn), ... " + ... it = iter(seq) + ... result = tuple(islice(it, n)) + ... if len(result) == n: + ... yield result + ... for elem in it: + ... result = result[1:] + (elem,) + ... yield result This is not part of the examples but it tests to make sure the definitions *************** *** 474,479 **** False ! >>> list(pairwise('abc')) [('a', 'b'), ('b', 'c')] >>> list(islice(padnone('abc'), 0, 6)) --- 480,488 ---- False ! >>> list(window('abc')) [('a', 'b'), ('b', 'c')] + + >>> list(window('abc',5)) + [] >>> list(islice(padnone('abc'), 0, 6)) From rhettinger@users.sourceforge.net Wed Jun 18 20:25:39 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 18 Jun 2003 12:25:39 -0700 Subject: [Python-checkins] python/dist/src/Modules itertoolsmodule.c,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv15836/Modules Modified Files: itertoolsmodule.c Log Message: Minor updates: * Updated comment on design of imap() * Added untraversed object in izip() structure * Replaced the pairwise() example with a more general window() example Index: itertoolsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** itertoolsmodule.c 17 Jun 2003 23:14:40 -0000 1.16 --- itertoolsmodule.c 18 Jun 2003 19:25:34 -0000 1.17 *************** *** 883,887 **** 4) If a need does arise, it can be met by __builtins__.map() or by ! writing a generator. 5) Similar toolsets in Haskell and SML do not have automatic None fill-in. --- 883,887 ---- 4) If a need does arise, it can be met by __builtins__.map() or by ! writing: chain(iterable, repeat(None)). 5) Similar toolsets in Haskell and SML do not have automatic None fill-in. *************** *** 1575,1580 **** izip_traverse(izipobject *lz, visitproc visit, void *arg) { ! if (lz->ittuple) ! return visit(lz->ittuple, arg); return 0; } --- 1575,1590 ---- izip_traverse(izipobject *lz, visitproc visit, void *arg) { ! int err; ! ! if (lz->ittuple) { ! err = visit(lz->ittuple, arg); ! if (err) ! return err; ! } ! if (lz->result) { ! err = visit(lz->result, arg); ! if (err) ! return err; ! } return 0; } From jackjansen@users.sourceforge.net Wed Jun 18 22:28:46 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 18 Jun 2003 14:28:46 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/Dist build,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist In directory sc8-pr-cvs1:/tmp/cvs-serv3901 Modified Files: build Log Message: - Create TMPDIR only if it doesn't exist yet - Set the installer to use our permissions, not influenced by the umask. Index: build =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Dist/build,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** build 17 Jun 2003 14:36:54 -0000 1.6 --- build 18 Jun 2003 21:28:44 -0000 1.7 *************** *** 49,53 **** fi rm -rf $DMGDIR ! mkdir $TMPDIR chgrp admin $TMPDIR mkdir -p $DMGDIR/root --- 49,55 ---- fi rm -rf $DMGDIR ! if [ ! -e $TMPDIR ]; then ! mkdir $TMPDIR ! fi chgrp admin $TMPDIR mkdir -p $DMGDIR/root *************** *** 119,122 **** --- 121,125 ---- --Relocatable="NO" \ --InstallOnly="YES" \ + --UseUserMask="NO" \ $INSTALLROOT \ $RESOURCEDIR From jackjansen@users.sourceforge.net Wed Jun 18 23:10:29 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 18 Jun 2003 15:10:29 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial index.html,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial In directory sc8-pr-cvs1:/tmp/cvs-serv11756/macpython_ide_tutorial Modified Files: index.html Log Message: - Added a "community" section. - Cleaned up the HTML. Index: index.html =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/macpython_ide_tutorial/index.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** index.html 16 Mar 2003 20:41:58 -0000 1.2 --- index.html 18 Jun 2003 22:10:27 -0000 1.3 *************** *** 1,3 **** ! One Day of MacPython IDE Toying --- 1,5 ---- ! ! One Day of MacPython IDE Toying *************** *** 10,14 **** ! --- 12,16 ---- ! *************** *** 35,48 **** We can do this by opening up the IDE, which should be in Applications under the newly-created MacPython program folder:



The IDE starts up and shows an interactive window:

!

If the window does not show up (because you have run the IDE before ! and closed it: it remembers that between runs) open it with the Windows->Python Interactive ! menu entry.

This is the interactive window to the IDE, it allows us to enter --- 37,50 ---- We can do this by opening up the IDE, which should be in Applications under the newly-created MacPython program folder:

image of IDE icon



The IDE starts up and shows an interactive window:

!

image of new window

If the window does not show up (because you have run the IDE before ! and closed it: it remembers that between runs) open it with the Windows->Python Interactive ! menu entry.

This is the interactive window to the IDE, it allows us to enter *************** *** 57,61 ****

Let's try something now! As per tradition, let's get Python to say the immortal words, "Hello World".

Those '>>>' signs act as a prompt for us: Python is ready to read in a new command by giving us that visual cue. Also, we notice that as we enter commands, Python will --- 59,63 ----

Let's try something now! As per tradition, let's get Python to say the immortal words, "Hello World". image of hello world program

Those '>>>' signs act as a prompt for us: Python is ready to read in a new command by giving us that visual cue. Also, we notice that as we enter commands, Python will *************** *** 68,72 **** commands. If we look below:

!

we'll see the result of running a few more commands. Don't worry --- 70,74 ---- commands. If we look below:

!

image of command window

we'll see the result of running a few more commands. Don't worry *************** *** 98,106 **** up a new window.

!

Here's the result of that menu command:

!

We notice that there's nothing in this new window. What this means --- 100,108 ---- up a new window.

!

image of making new window

Here's the result of that menu command:

!

image of new window

We notice that there's nothing in this new window. What this means *************** *** 115,119 **** tried out on the interpreter window. Let's do that by typing (or copy/pasting) those commands into our edit window.

!

Ok, we're done with copying and pasting. --- 117,121 ---- tried out on the interpreter window. Let's do that by typing (or copy/pasting) those commands into our edit window.

!

image of entering commands

Ok, we're done with copying and pasting. *************** *** 130,135 ****



!

Let's save the file now. The Save command is located under the File menu: !

--- 132,137 ----

!

Let's save the file now. The Save command is located under the File menu:

!

image of saving file

*************** *** 138,142 ****

Now that we've saved the program, how do we run the program? Use the Run All button at the top of the editing window, or the equivalent ! menu command Python->Run Window. The output will appear in a new window called Output Window.

--- 140,144 ----

Now that we've saved the program, how do we run the program? Use the Run All button at the top of the editing window, or the equivalent ! menu command Python->Run Window. The output will appear in a new window called Output Window.

*************** *** 145,149 **** before. Does this affect things?

!

Ooops. Here is an example of what Python calls a "syntax error". --- 147,151 ---- before. Does this affect things?

!

image of syntax error

Ooops. Here is an example of what Python calls a "syntax error". *************** *** 169,173 **** program again. This gives us a new window, the Output window, showing the output of our program:

!



--- 171,175 ---- program again. This gives us a new window, the Output window, showing the output of our program:

!

image of output window



*************** *** 199,203 **** is also nifty: it shows you where your program is spending its time. !
  • The module browser (Python->Module Browser) shows you all Python modules currently loaded. You can look at the contents of the module with Browse... and (for modules written in Python) at the source with Source...
  • --- 201,205 ---- is also nifty: it shows you where your program is spending its time. !
  • The module browser (Python->Module Browser) shows you all Python modules currently loaded. You can look at the contents of the module with Browse... and (for modules written in Python) at the source with Source...
  • *************** *** 212,216 **** documentation. !
  • The File->Save as Applet menu command saves your script as a MacOSX application. This allows you to create a script that you can drop files on, and much more. The IDE itself is such an applet, completely written in Python.
  • --- 214,218 ---- documentation. !
  • The File->Save as Applet menu command saves your script as a MacOSX application. This allows you to create a script that you can drop files on, and much more. The IDE itself is such an applet, completely written in Python.
  • From jackjansen@users.sourceforge.net Wed Jun 18 23:10:29 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 18 Jun 2003 15:10:29 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation community.html,NONE,1.1 finder.html,1.1,1.2 gui.html,1.1,1.2 index.html,1.3,1.4 intro.html,1.1,1.2 packman.html,1.2,1.3 scripting.html,1.3,1.4 shell.html,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation In directory sc8-pr-cvs1:/tmp/cvs-serv11756 Modified Files: finder.html gui.html index.html intro.html packman.html scripting.html shell.html Added Files: community.html Log Message: - Added a "community" section. - Cleaned up the HTML. --- NEW FILE: community.html --- What is MacPython?

    MacPython Community


    Web Sites

    The MacPython homepage, www.cwi.nl/~jack/macpython.html is where you can find installers, documents, links to useful packages and more. And, of course, www.python.org has a much larger collection of material on Python that is not Mac-specific.

    News groups and Mailing lists

    There are a lot of mailing lists on Python. Some of the more interesting ones are:

    • python-help@python.org where you can send questions for individual support. Please check the websites mentioned above first, though!
    • The comp.lang.python newsgroup for general discussion. Also available as a mailing list.
    • The comp.lang.python.announce newsgroup for announcements. Low-volume and moderated. Also available as a mailing list.
    • Last but not least, the pythonmac-sig mailing list is specifically for MacPython. Discussions on the implementation of new features, but beginners questions are welcome too.

    In addition there are Python Special Interest Group mailing lists on a wide variety of topics such as image processing, numerical algorithms and more.

    More

    An index of conferences, Wiki's, bookshops and more can be found at the Community section of the Python website.

    Index: finder.html =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/finder.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** finder.html 11 Mar 2003 22:59:16 -0000 1.1 --- finder.html 18 Jun 2003 22:10:27 -0000 1.2 *************** *** 1 **** ! Python and the Finder

    Running Python scripts from the Finder

    The application PythonLauncher will start a Python interpreter when you drop a Python source file onto it, any file with a .py or .pyw extension. If you set PythonLauncher as the default application to open a file ( tell me more) this also works when you double click a Python script.

    PythonLauncher has preferences per filetype for selecting the interpreter to use, and how to launch it: in a Terminal window or not, etc. Holding the Option key while launching your script will bring up a window that allows changing these settings for a single run.


    \ No newline at end of file --- 1 ---- ! Python and the Finder

    Running Python scripts from the Finder

    The application PythonLauncher will start a Python interpreter when you drop a Python source file onto it, any file with a .py or .pyw extension. If you set PythonLauncher as the default application to open a file ( tell me more) this also works when you double click a Python script.

    PythonLauncher has preferences per filetype for selecting the interpreter to use, and how to launch it: in a Terminal window or not, etc. Holding the Option key while launching your script will bring up a window that allows changing these settings for a single run.


    \ No newline at end of file Index: gui.html =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/gui.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gui.html 31 Mar 2003 15:10:41 -0000 1.1 --- gui.html 18 Jun 2003 22:10:27 -0000 1.2 *************** *** 22,31 **** documentation and the Human Interface Toolbox section of Apple's Carbon Documentation. ! This solution is compatible with MacPython-OS9. !
  • The W framework is built on top of this, and easier to use. The MacPython IDE uses W. Some documentation is available on Corran Webster's website. ! Compatible with MacPython-OS9. --- 22,30 ---- documentation and the Human Interface Toolbox section of Apple's Carbon Documentation. ! This solution is compatible with MacPython-OS9.
  • The W framework is built on top of this, and easier to use. The MacPython IDE uses W. Some documentation is available on Corran Webster's website. ! Compatible with MacPython-OS9.
  • *************** *** 39,47 **** bidirectional bridge between Python and Objectve-C, similar to Apple's Java bridge. Probably the best choice for Mac OS X-only applications, but at the ! time of this writing PyObjC is still in beta.
  • wxPython gives Python programs access to the wxWindows GUI toolkit. Many people consider this ! the best open source cross-platform GUI solution available today.
  • Tkinter is the oldest cross-platform GUI toolkit for Python, bridging Python --- 38,46 ---- bidirectional bridge between Python and Objectve-C, similar to Apple's Java bridge. Probably the best choice for Mac OS X-only applications, but at the ! time of this writing PyObjC is still in beta.
  • wxPython gives Python programs access to the wxWindows GUI toolkit. Many people consider this ! the best open source cross-platform GUI solution available today.
  • Tkinter is the oldest cross-platform GUI toolkit for Python, bridging Python *************** *** 49,53 **** Documented in the Library section, Tkinter subsection of the Python Language and runtime documentation. Tkinter ! is not available for MacPython-OS9. --- 48,52 ---- Documented in the Library section, Tkinter subsection of the Python Language and runtime documentation. Tkinter ! is not available for MacPython-OS9.
  • Index: index.html =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/index.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** index.html 31 Mar 2003 15:10:44 -0000 1.3 --- index.html 18 Jun 2003 22:10:27 -0000 1.4 *************** *** 16,20 **** ! --- 16,20 ---- ! *************** *** 31,38 **** --- 31,43 ----
  • Running Python scripts from the Unix Shell +
  • Creating a User Interface with MacPython +
  • Controlling other Applications from MacPython +
  • Installing additional functionality with the Package Manager +
  • +
  • MacPython community
  • Index: intro.html =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/intro.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** intro.html 11 Mar 2003 22:59:16 -0000 1.1 --- intro.html 18 Jun 2003 22:10:27 -0000 1.2 *************** *** 14,22 **** !

    Python is a programming language. MacPython is a package containing ! that programming language plus Mac-specific tools and extensions.

    --- 14,22 ---- !

    Python is a programming language. MacPython is a package containing ! that programming language plus Mac-specific tools and extensions.

    *************** *** 36,40 **** the language and a comparison of Python ! to other languages. Or read the (rather longwinded) Python Tutorial in the Python Language and runtime documentation.

    --- 36,40 ---- the language and a comparison of Python ! to other languages. Or read the (rather longwinded) Python Tutorial in the Python Language and runtime documentation.

    Index: packman.html =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/packman.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** packman.html 16 Apr 2003 12:39:03 -0000 1.2 --- packman.html 18 Jun 2003 22:10:27 -0000 1.3 *************** *** 14,18 **** ! --- 14,18 ---- ! *************** *** 36,40 ****

    PackageManager is available as a separate application and also ! as a function of the IDE, through the File->Package Manager menu entry.

    --- 36,40 ----

    PackageManager is available as a separate application and also ! as a function of the IDE, through the File->Package Manager menu entry.

    *************** *** 45,49 **** could be that there is no database (yet?) for your version of Mac OS X. In the standalone Package Manager you can open an alternative database ! with the File->Open URL... command, but you should realize that you are now on untested ground.

    --- 45,49 ---- could be that there is no database (yet?) for your version of Mac OS X. In the standalone Package Manager you can open an alternative database ! with the File->Open URL... command, but you should realize that you are now on untested ground.

    Index: scripting.html =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/scripting.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** scripting.html 13 Jun 2003 14:32:49 -0000 1.3 --- scripting.html 18 Jun 2003 22:10:27 -0000 1.4 *************** *** 18,40 **** Python:

    !
      import Finder
      
      f = Finder.Finder()
      print f.get(f.window(1).name)
    ! 

    is identical to the following piece of AppleScript:

    !
      tell application "Finder"
      	get name of window 1
      end tell
    ! 

    To send AppleEvents to an application you must first create the Python modules interfacing to the terminology of the application (what Script Editor calls the "Dictionary"). Use the IDE menu command ! File->Generate OSA Suite... for this. For more control run

    --- 18,40 ---- Python:

    !
    
      import Finder
      
      f = Finder.Finder()
      print f.get(f.window(1).name)
    ! 

    is identical to the following piece of AppleScript:

    !
    
      tell application "Finder"
      	get name of window 1
      end tell
    ! 

    To send AppleEvents to an application you must first create the Python modules interfacing to the terminology of the application (what Script Editor calls the "Dictionary"). Use the IDE menu command ! File->Generate OSA Suite... for this. For more control run

    Index: shell.html =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/shell.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** shell.html 11 Mar 2003 22:59:16 -0000 1.1 --- shell.html 18 Jun 2003 22:10:27 -0000 1.2 *************** *** 14,18 **** ! --- 14,18 ---- ! *************** *** 27,31 ****
    setenv PATH /usr/local/bin:$PATH !

    If you use bash or zsh --- 27,31 ----
    setenv PATH /usr/local/bin:$PATH !

    If you use bash or zsh *************** *** 34,37 **** --- 34,38 ----
    export PATH=/usr/local/bin:$PATH +

    GUI scripts

    From tim_one@users.sourceforge.net Thu Jun 19 04:23:08 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 18 Jun 2003 20:23:08 -0700 Subject: [Python-checkins] python/dist/src/Lib random.py,1.48,1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv27526/Lib Modified Files: random.py Log Message: randrange(): 2.3 can no longer raises OverflowError on an int() call, so some of this code because useless, and (worse) could return a long instead of int (in Zope that's important, because a long can't be used as a key in an IOBTree or IIBTree). Index: random.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/random.py,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** random.py 13 Jun 2003 07:01:51 -0000 1.48 --- random.py 19 Jun 2003 03:23:06 -0000 1.49 *************** *** 149,162 **** raise ValueError, "non-integer stop for randrange()" if step == 1 and istart < istop: ! try: ! return istart + int(self.random()*(istop - istart)) ! except OverflowError: ! # This can happen if istop-istart > sys.maxint + 1, and ! # multiplying by random() doesn't reduce it to something ! # <= sys.maxint. We know that the overall result fits ! # in an int, and can still do it correctly via math.floor(). ! # But that adds another function call, so for speed we ! # avoided that whenever possible. ! return int(istart + _floor(self.random()*(istop - istart))) if step == 1: raise ValueError, "empty range for randrange()" --- 149,153 ---- raise ValueError, "non-integer stop for randrange()" if step == 1 and istart < istop: ! return int(istart + self.random()*(istop - istart)) if step == 1: raise ValueError, "empty range for randrange()" From tim_one@users.sourceforge.net Thu Jun 19 04:46:48 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 18 Jun 2003 20:46:48 -0700 Subject: [Python-checkins] python/dist/src/Lib random.py,1.49,1.50 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv31462/Lib Modified Files: random.py Log Message: randrange(): Repaired my overly optimistic rewrite, and added comments explaining what's wrong with the two simpler variants. Index: random.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/random.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** random.py 19 Jun 2003 03:23:06 -0000 1.49 --- random.py 19 Jun 2003 03:46:46 -0000 1.50 *************** *** 149,153 **** raise ValueError, "non-integer stop for randrange()" if step == 1 and istart < istop: ! return int(istart + self.random()*(istop - istart)) if step == 1: raise ValueError, "empty range for randrange()" --- 149,165 ---- raise ValueError, "non-integer stop for randrange()" if step == 1 and istart < istop: ! # Note that ! # int(istart + self.random()*(istop - istart)) ! # instead would be incorrect. For example, consider istart ! # = -2 and istop = 0. Then the guts would be in ! # -2.0 to 0.0 exclusive on both ends (ignoring that random() ! # might return 0.0), and because int() truncates toward 0, the ! # final result would be -1 or 0 (instead of -2 or -1). ! # istart + int(self.random()*(istop - istart)) ! # would also be incorrect, for a subtler reason: the RHS ! # can return a long, and then randrange() would also return ! # a long, but we're supposed to return an int (for backward ! # compatibility). ! return int(istart + int(self.random()*(istop - istart))) if step == 1: raise ValueError, "empty range for randrange()" From doerwalter@users.sourceforge.net Thu Jun 19 11:21:16 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 19 Jun 2003 03:21:16 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_posixpath.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14238/Lib/test Modified Files: test_posixpath.py Log Message: Use find() instead of looping over the string in expanduser(). >From SF patch #757058. Index: test_posixpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_posixpath.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_posixpath.py 16 Jun 2003 21:54:50 -0000 1.6 --- test_posixpath.py 19 Jun 2003 10:21:14 -0000 1.7 *************** *** 333,337 **** def test_expanduser(self): self.assertEqual(posixpath.expanduser("foo"), "foo") - self.assert_(isinstance(posixpath.expanduser("~/"), basestring)) try: import pwd --- 333,336 ---- *************** *** 339,342 **** --- 338,346 ---- pass else: + self.assert_(isinstance(posixpath.expanduser("~/"), basestring)) + self.assertEqual( + posixpath.expanduser("~") + "/", + posixpath.expanduser("~/") + ) self.assert_(isinstance(posixpath.expanduser("~root/"), basestring)) self.assert_(isinstance(posixpath.expanduser("~foo/"), basestring)) From doerwalter@users.sourceforge.net Thu Jun 19 11:21:16 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 19 Jun 2003 03:21:16 -0700 Subject: [Python-checkins] python/dist/src/Lib posixpath.py,1.59,1.60 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv14238/Lib Modified Files: posixpath.py Log Message: Use find() instead of looping over the string in expanduser(). >From SF patch #757058. Index: posixpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/posixpath.py,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** posixpath.py 17 Jun 2003 13:13:40 -0000 1.59 --- posixpath.py 19 Jun 2003 10:21:13 -0000 1.60 *************** *** 304,312 **** if not path.startswith('~'): return path ! i, n = 1, len(path) ! while i < n and path[i] != '/': ! i += 1 if i == 1: ! if not 'HOME' in os.environ: import pwd userhome = pwd.getpwuid(os.getuid()).pw_dir --- 304,312 ---- if not path.startswith('~'): return path ! i = path.find('/', 1) ! if i < 0: ! i = len(path) if i == 1: ! if 'HOME' not in os.environ: import pwd userhome = pwd.getpwuid(os.getuid()).pw_dir From doerwalter@users.sourceforge.net Thu Jun 19 11:36:19 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 19 Jun 2003 03:36:19 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts trace.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv15782/Tools/scripts Modified Files: trace.py Log Message: Make the comment prefix 7 character long, so the lines are properly aligned. Index: trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/trace.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** trace.py 24 Apr 2003 16:02:54 -0000 1.14 --- trace.py 19 Jun 2003 10:36:17 -0000 1.15 *************** *** 305,309 **** elif blank.match(line): # blank lines and comments are preceded by dots ! outfile.write(' . ') else: # lines preceded by no marks weren't hit --- 305,309 ---- elif blank.match(line): # blank lines and comments are preceded by dots ! outfile.write(' . ') else: # lines preceded by no marks weren't hit From montanaro@users.sourceforge.net Thu Jun 19 19:10:39 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 19 Jun 2003 11:10:39 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstat.tex,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv23692 Modified Files: libstat.tex Log Message: Avoid using 'dir' as a variable name and use os.path.join() to create paths. Index: libstat.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstat.tex,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** libstat.tex 28 Nov 2001 07:26:15 -0000 1.22 --- libstat.tex 19 Jun 2003 18:10:37 -0000 1.23 *************** *** 130,139 **** from stat import * ! def walktree(dir, callback): ! '''recursively descend the directory rooted at dir, calling the callback function for each regular file''' ! for f in os.listdir(dir): ! pathname = '%s/%s' % (dir, f) mode = os.stat(pathname)[ST_MODE] if S_ISDIR(mode): --- 130,139 ---- from stat import * ! def walktree(top, callback): ! '''recursively descend the directory tree rooted at top, calling the callback function for each regular file''' ! for f in os.listdir(top): ! pathname = os.path.join(top, f) mode = os.stat(pathname)[ST_MODE] if S_ISDIR(mode): From montanaro@users.sourceforge.net Thu Jun 19 19:14:04 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 19 Jun 2003 11:14:04 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstat.tex,1.22,1.22.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv24312 Modified Files: Tag: release22-maint libstat.tex Log Message: Avoid 'dir' as a variable name. Use os.path.join() to join path elements together. Index: libstat.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstat.tex,v retrieving revision 1.22 retrieving revision 1.22.6.1 diff -C2 -d -r1.22 -r1.22.6.1 *** libstat.tex 28 Nov 2001 07:26:15 -0000 1.22 --- libstat.tex 19 Jun 2003 18:14:02 -0000 1.22.6.1 *************** *** 130,139 **** from stat import * ! def walktree(dir, callback): ! '''recursively descend the directory rooted at dir, calling the callback function for each regular file''' ! for f in os.listdir(dir): ! pathname = '%s/%s' % (dir, f) mode = os.stat(pathname)[ST_MODE] if S_ISDIR(mode): --- 130,139 ---- from stat import * ! def walktree(top, callback): ! '''recursively descend the directory tree rooted at top, calling the callback function for each regular file''' ! for f in os.listdir(top): ! pathname = os.path.join(top, f) mode = os.stat(pathname)[ST_MODE] if S_ISDIR(mode): From jackjansen@users.sourceforge.net Thu Jun 19 22:25:46 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 19 Jun 2003 14:25:46 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation community.html,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation In directory sc8-pr-cvs1:/tmp/cvs-serv27392 Modified Files: community.html Log Message: dded notes on reporting bugs and becoming an active developer. Index: community.html =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/community.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** community.html 18 Jun 2003 22:10:27 -0000 1.1 --- community.html 19 Jun 2003 21:25:44 -0000 1.2 *************** *** 57,61 ****

    An index of conferences, Wiki's, bookshops and more can be found at the ! Community section of the Python website.

    --- 57,68 ----

    An index of conferences, Wiki's, bookshops and more can be found at the ! Community section of the Python website.

    ! !

    If you find a bug you are kindly requested to report it, preferrably through the ! automatic bug tracker at www.python.org

    ! !

    If you want to become an active developer you are very welcome! Join the ! pythonmac-sig mailing list mentioned above, and read the ! Developer section on the Python website.

    From jackjansen@users.sourceforge.net Thu Jun 19 23:35:22 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 19 Jun 2003 15:35:22 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.131,1.132 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv6430 Modified Files: Makefile.pre.in Log Message: Added a target frameworkinstallextras (OSX framework build specific, and not part of a normal frameworkinstall) that installs Demo and Tools and a readme file into /Applications/MacPython-2.3/Extras. This will give people access to the demos and tools if they instal Python through the binary installer. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.131 retrieving revision 1.132 diff -C2 -d -r1.131 -r1.132 *** Makefile.pre.in 14 Jun 2003 13:11:24 -0000 1.131 --- Makefile.pre.in 19 Jun 2003 22:35:19 -0000 1.132 *************** *** 871,874 **** --- 871,881 ---- srcdir=$(srcdir) builddir=. DESTDIR=$(DESTDIR) + # This installs the Demos and Tools into the applications directory. + # It is not part of a normal frameworkinstall + frameworkinstallextras: + $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installextras \ + BUILDPYTHON=./$(BUILDPYTHON) DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \ + srcdir=$(srcdir) builddir=. DESTDIR=$(DESTDIR) + # This installs a few of the useful scripts in Tools/scripts scriptsinstall: From jackjansen@users.sourceforge.net Thu Jun 19 23:35:22 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 19 Jun 2003 15:35:22 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Extras.ReadMe.txt,NONE,1.1 Extras.install.py,NONE,1.1 Makefile,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1:/tmp/cvs-serv6430/Mac/OSX Modified Files: Makefile Added Files: Extras.ReadMe.txt Extras.install.py Log Message: Added a target frameworkinstallextras (OSX framework build specific, and not part of a normal frameworkinstall) that installs Demo and Tools and a readme file into /Applications/MacPython-2.3/Extras. This will give people access to the demos and tools if they instal Python through the binary installer. --- NEW FILE: Extras.ReadMe.txt --- This folder contains examples of Python usage and useful scripts and tools. You should be aware that these are not Macintosh-specific but are shared among Python on all platforms, so there are some that only run on Windows or Unix or another platform, and/or make little sense on a Macintosh. Some examples can be run from within the PythonIDE, but many will require that you start them from the command line, or supply command-line arguments by holding down the "alt" key when double-clicking them. --- NEW FILE: Extras.install.py --- """Recursively copy a directory but skip undesired files and directories (CVS, backup files, pyc files, etc)""" import sys import os import shutil verbose = 1 debug = 0 def isclean(name): if name == 'CVS': return 0 if name == '.cvsignore': return 0 if name == '.DS_store': return 0 if name.endswith('~'): return 0 if name.endswith('.BAK'): return 0 if name.endswith('.pyc'): return 0 if name.endswith('.pyo'): return 0 if name.endswith('.orig'): return 0 return 1 def copycleandir(src, dst): for cursrc, dirs, files in os.walk(src): assert cursrc.startswith(src) curdst = dst + cursrc[len(src):] if verbose: print "mkdir", curdst if not debug: if not os.path.exists(curdst): os.makedirs(curdst) for fn in files: if isclean(fn): if verbose: print "copy", os.path.join(cursrc, fn), os.path.join(curdst, fn) if not debug: shutil.copy2(os.path.join(cursrc, fn), os.path.join(curdst, fn)) else: if verbose: print "skipfile", os.path.join(cursrc, fn) for i in range(len(dirs)-1, -1, -1): if not isclean(dirs[i]): if verbose: print "skipdir", os.path.join(cursrc, dirs[i]) del dirs[i] def main(): if len(sys.argv) != 3: sys.stderr.write("Usage: %s srcdir dstdir\n" % sys.argv[0]) sys.exit(1) copycleandir(sys.argv[1], sys.argv[2]) if __name__ == '__main__': main() Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** Makefile 16 Jun 2003 09:47:25 -0000 1.42 --- Makefile 19 Jun 2003 22:35:20 -0000 1.43 *************** *** 244,245 **** --- 244,253 ---- $(INSTALL) pythonw.sh $(DESTDIR)$(bindir)/pythonw$(VERSION) $(INSTALL_SYMLINK) pythonw$(VERSION) $(DESTDIR)$(bindir)/pythonw + + installextras: + $(INSTALL) -d $(DESTDIR)$(PYTHONAPPSDIR)/Extras + $(INSTALL) $(srcdir)/Mac/OSX/Extras.ReadMe.txt $(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe + $(BUILDPYTHON) $(srcdir)/Mac/OSX/Extras.install.py $(srcdir)/Demo \ + $(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo + $(BUILDPYTHON) $(srcdir)/Mac/OSX/Extras.install.py $(srcdir)/Tools \ + $(DESTDIR)$(PYTHONAPPSDIR)/Extras/Tools \ No newline at end of file From jackjansen@users.sourceforge.net Thu Jun 19 23:44:59 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 19 Jun 2003 15:44:59 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile.jaguar,1.4,NONE README.JAGUAR,1.1,NONE setup.jaguar.py,1.3,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1:/tmp/cvs-serv7863 Removed Files: Makefile.jaguar README.JAGUAR setup.jaguar.py Log Message: MacPython-2.3 has progressed so far that building a set of Mac 2.3 extensions on top of Python 2.2 no longer seems feasible. --- Makefile.jaguar DELETED --- --- README.JAGUAR DELETED --- --- setup.jaguar.py DELETED --- From jackjansen@users.sourceforge.net Thu Jun 19 23:45:39 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 19 Jun 2003 15:45:39 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/Dist build,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist In directory sc8-pr-cvs1:/tmp/cvs-serv8061/Dist Modified Files: build Log Message: Install Demo and Tools too. Index: build =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Dist/build,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** build 18 Jun 2003 21:28:44 -0000 1.7 --- build 19 Jun 2003 22:45:37 -0000 1.8 *************** *** 90,93 **** --- 90,94 ---- make make DIRMODE=775 EXEMODE=775 FILEMODE=664 DESTDIR=$INSTALLROOT frameworkinstall + make DIRMODE=775 EXEMODE=775 FILEMODE=664 DESTDIR=$INSTALLROOT frameworkinstallextras if [ "$builddocs" = "y" -o "$builddocs" = "Y" ]; then From niemeyer@users.sourceforge.net Fri Jun 20 01:25:16 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Thu, 19 Jun 2003 17:25:16 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_re.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv23662 Modified Files: test_re.py Log Message: Many new tests, based on gcov's coverage information. >From gcov's output (based on a locally changed _sre.c): 82.07% of 1372 source lines executed in file ./Modules/_sre.c Index: test_re.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** test_re.py 1 May 2003 17:45:47 -0000 1.42 --- test_re.py 20 Jun 2003 00:25:14 -0000 1.43 *************** *** 9,12 **** --- 9,16 ---- # Misc tests from Tim Peters' re.doc + # WARNING: Don't change deteails in these tests if you don't know + # what you're doing. Some of these tests were carefuly modeled to + # cover most of the code. + import unittest *************** *** 165,168 **** --- 169,338 ---- self.assertEqual(pat.match('ac').group(1, 'b2', 3), ('a', None, 'c')) + def test_re_groupref_exists(self): + return # not yet + self.assertEqual(re.match('^(\()?([^()]+)(?(1)\))$', '(a)').groups(), + ('(', 'a')) + self.assertEqual(re.match('^(\()?([^()]+)(?(1)\))$', 'a').groups(), + (None, 'a')) + self.assertEqual(re.match('^(\()?([^()]+)(?(1)\))$', 'a)'), None) + self.assertEqual(re.match('^(\()?([^()]+)(?(1)\))$', '(a'), None) + self.assertEqual(re.match('^(?:(a)|c)((?(1)b|d))$', 'ab').groups(), + ('a', 'b')) + self.assertEqual(re.match('^(?:(a)|c)((?(1)b|d))$', 'cd').groups(), + (None, 'd')) + self.assertEqual(re.match('^(?:(a)|c)((?(1)|d))$', 'cd').groups(), + (None, 'd')) + self.assertEqual(re.match('^(?:(a)|c)((?(1)|d))$', 'a').groups(), + ('a', '')) + + def test_re_groupref(self): + self.assertEqual(re.match(r'^(\|)?([^()]+)\1$', '|a|').groups(), + ('|', 'a')) + self.assertEqual(re.match(r'^(\|)?([^()]+)\1?$', 'a').groups(), + (None, 'a')) + self.assertEqual(re.match(r'^(\|)?([^()]+)\1$', 'a|'), None) + self.assertEqual(re.match(r'^(\|)?([^()]+)\1$', '|a'), None) + self.assertEqual(re.match(r'^(?:(a)|c)(\1)$', 'aa').groups(), + ('a', 'a')) + self.assertEqual(re.match(r'^(?:(a)|c)(\1)?$', 'c').groups(), + (None, None)) + + def test_groupdict(self): + self.assertEqual(re.match('(?Pfirst) (?Psecond)', + 'first second').groupdict(), + {'first':'first', 'second':'second'}) + + def test_expand(self): + self.assertEqual(re.match("(?Pfirst) (?Psecond)", + "first second") + .expand(r"\2 \1 \g \g"), + "second first second first") + + def test_repeat_minmax(self): + self.assertEqual(re.match("^(\w){1}$", "abc"), None) + self.assertEqual(re.match("^(\w){1}?$", "abc"), None) + self.assertEqual(re.match("^(\w){1,2}$", "abc"), None) + self.assertEqual(re.match("^(\w){1,2}?$", "abc"), None) + + self.assertEqual(re.match("^(\w){3}$", "abc").group(1), "c") + self.assertEqual(re.match("^(\w){1,3}$", "abc").group(1), "c") + self.assertEqual(re.match("^(\w){1,4}$", "abc").group(1), "c") + self.assertEqual(re.match("^(\w){3,4}?$", "abc").group(1), "c") + self.assertEqual(re.match("^(\w){3}?$", "abc").group(1), "c") + self.assertEqual(re.match("^(\w){1,3}?$", "abc").group(1), "c") + self.assertEqual(re.match("^(\w){1,4}?$", "abc").group(1), "c") + self.assertEqual(re.match("^(\w){3,4}?$", "abc").group(1), "c") + + self.assertEqual(re.match("^x{1}$", "xxx"), None) + self.assertEqual(re.match("^x{1}?$", "xxx"), None) + self.assertEqual(re.match("^x{1,2}$", "xxx"), None) + self.assertEqual(re.match("^x{1,2}?$", "xxx"), None) + + self.assertNotEqual(re.match("^x{3}$", "xxx"), None) + self.assertNotEqual(re.match("^x{1,3}$", "xxx"), None) + self.assertNotEqual(re.match("^x{1,4}$", "xxx"), None) + self.assertNotEqual(re.match("^x{3,4}?$", "xxx"), None) + self.assertNotEqual(re.match("^x{3}?$", "xxx"), None) + self.assertNotEqual(re.match("^x{1,3}?$", "xxx"), None) + self.assertNotEqual(re.match("^x{1,4}?$", "xxx"), None) + self.assertNotEqual(re.match("^x{3,4}?$", "xxx"), None) + + def test_getattr(self): + self.assertEqual(re.match("(a)", "a").pos, 0) + self.assertEqual(re.match("(a)", "a").endpos, 1) + self.assertEqual(re.match("(a)", "a").string, "a") + self.assertEqual(re.match("(a)", "a").regs, ((0, 1), (0, 1))) + self.assertNotEqual(re.match("(a)", "a").re, None) + + def test_special_escapes(self): + self.assertEqual(re.search(r"\b(b.)\b", + "abcd abc bcd bx").group(1), "bx") + self.assertEqual(re.search(r"\B(b.)\B", + "abc bcd bc abxd").group(1), "bx") + self.assertEqual(re.search(r"\b(b.)\b", + "abcd abc bcd bx", re.LOCALE).group(1), "bx") + self.assertEqual(re.search(r"\B(b.)\B", + "abc bcd bc abxd", re.LOCALE).group(1), "bx") + self.assertEqual(re.search(r"\b(b.)\b", + "abcd abc bcd bx", re.UNICODE).group(1), "bx") + self.assertEqual(re.search(r"\B(b.)\B", + "abc bcd bc abxd", re.UNICODE).group(1), "bx") + self.assertEqual(re.search(r"^abc$", "\nabc\n", re.M).group(0), "abc") + self.assertEqual(re.search(r"^\Aabc\Z$", "abc", re.M).group(0), "abc") + self.assertEqual(re.search(r"^\Aabc\Z$", "\nabc\n", re.M), None) + self.assertEqual(re.search(r"\b(b.)\b", + u"abcd abc bcd bx").group(1), "bx") + self.assertEqual(re.search(r"\B(b.)\B", + u"abc bcd bc abxd").group(1), "bx") + self.assertEqual(re.search(r"^abc$", u"\nabc\n", re.M).group(0), "abc") + self.assertEqual(re.search(r"^\Aabc\Z$", u"abc", re.M).group(0), "abc") + self.assertEqual(re.search(r"^\Aabc\Z$", u"\nabc\n", re.M), None) + self.assertEqual(re.search(r"\d\D\w\W\s\S", + "1aa! a").group(0), "1aa! a") + self.assertEqual(re.search(r"\d\D\w\W\s\S", + "1aa! a", re.LOCALE).group(0), "1aa! a") + self.assertEqual(re.search(r"\d\D\w\W\s\S", + "1aa! a", re.UNICODE).group(0), "1aa! a") + + def test_ignore_case(self): + self.assertEqual(re.match("abc", "ABC", re.I).group(0), "ABC") + self.assertEqual(re.match("abc", u"ABC", re.I).group(0), "ABC") + + def test_bigcharset(self): + self.assertEqual(re.match(u"([\u2222\u2223])", + u"\u2222").group(1), u"\u2222") + self.assertEqual(re.match(u"([\u2222\u2223])", + u"\u2222", re.UNICODE).group(1), u"\u2222") + + def test_anyall(self): + self.assertEqual(re.match("a.b", "a\nb", re.DOTALL).group(0), + "a\nb") + self.assertEqual(re.match("a.*b", "a\n\nb", re.DOTALL).group(0), + "a\n\nb") + + def test_non_consuming(self): + self.assertEqual(re.match("(a(?=\s[^a]))", "a b").group(1), "a") + self.assertEqual(re.match("(a(?=\s[^a]*))", "a b").group(1), "a") + self.assertEqual(re.match("(a(?=\s[abc]))", "a b").group(1), "a") + self.assertEqual(re.match("(a(?=\s[abc]*))", "a bc").group(1), "a") + self.assertEqual(re.match(r"(a)(?=\s\1)", "a a").group(1), "a") + self.assertEqual(re.match(r"(a)(?=\s\1*)", "a aa").group(1), "a") + self.assertEqual(re.match(r"(a)(?=\s(abc|a))", "a a").group(1), "a") + + self.assertEqual(re.match(r"(a(?!\s[^a]))", "a a").group(1), "a") + self.assertEqual(re.match(r"(a(?!\s[abc]))", "a d").group(1), "a") + self.assertEqual(re.match(r"(a)(?!\s\1)", "a b").group(1), "a") + self.assertEqual(re.match(r"(a)(?!\s(abc|a))", "a b").group(1), "a") + + def test_ignore_case(self): + self.assertEqual(re.match(r"(a\s[^a])", "a b", re.I).group(1), "a b") + self.assertEqual(re.match(r"(a\s[^a]*)", "a bb", re.I).group(1), "a bb") + self.assertEqual(re.match(r"(a\s[abc])", "a b", re.I).group(1), "a b") + self.assertEqual(re.match(r"(a\s[abc]*)", "a bb", re.I).group(1), "a bb") + self.assertEqual(re.match(r"((a)\s\2)", "a a", re.I).group(1), "a a") + self.assertEqual(re.match(r"((a)\s\2*)", "a aa", re.I).group(1), "a aa") + self.assertEqual(re.match(r"((a)\s(abc|a))", "a a", re.I).group(1), "a a") + self.assertEqual(re.match(r"((a)\s(abc|a)*)", "a aa", re.I).group(1), "a aa") + + def test_category(self): + self.assertEqual(re.match(r"(\s)", " ").group(1), " ") + + def test_getlower(self): + import _sre + self.assertEqual(_sre.getlower(ord('A'), 0), ord('a')) + self.assertEqual(_sre.getlower(ord('A'), re.LOCALE), ord('a')) + self.assertEqual(_sre.getlower(ord('A'), re.UNICODE), ord('a')) + + self.assertEqual(re.match("abc", "ABC", re.I).group(0), "ABC") + self.assertEqual(re.match("abc", u"ABC", re.I).group(0), "ABC") + + def test_not_literal(self): + self.assertEqual(re.search("\s([^a])", " b").group(1), "b") + self.assertEqual(re.search("\s([^a]*)", " bb").group(1), "bb") + + def test_search_coverage(self): + self.assertEqual(re.search("\s(b)", " b").group(1), "b") + self.assertEqual(re.search("a\s", "a ").group(0), "a ") + def test_re_escape(self): p="" *************** *** 263,266 **** --- 433,438 ---- (r"\s+", None), ]) + + self.assertNotEqual(scanner.scanner.scanner("").pattern, None) self.assertEqual(scanner.scan("sum = 3*foo + 312.50 + bar"), From montanaro@users.sourceforge.net Fri Jun 20 02:00:22 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 19 Jun 2003 18:00:22 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts db2pickle.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv29113 Modified Files: db2pickle.py Log Message: typo Index: db2pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/db2pickle.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** db2pickle.py 24 Apr 2003 16:02:54 -0000 1.3 --- db2pickle.py 20 Jun 2003 01:00:20 -0000 1.4 *************** *** 4,8 **** Synopsis: %(prog)s [-h|-b|-r] dbfile [ picklefile ] ! Convert the bsddb database file given on the command like to a pickle representation. The optional flags indicate the type of the database (hash, btree, recno). The default is hash. If a pickle file is named it is opened --- 4,8 ---- Synopsis: %(prog)s [-h|-b|-r] dbfile [ picklefile ] ! Convert the database file given on the command line to a pickle representation. The optional flags indicate the type of the database (hash, btree, recno). The default is hash. If a pickle file is named it is opened From montanaro@users.sourceforge.net Fri Jun 20 02:01:21 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu, 19 Jun 2003 18:01:21 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts pickle2db.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv29320 Modified Files: pickle2db.py Log Message: minor __doc__ string tweakage Index: pickle2db.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/pickle2db.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pickle2db.py 24 Apr 2003 16:02:54 -0000 1.4 --- pickle2db.py 20 Jun 2003 01:01:19 -0000 1.5 *************** *** 5,13 **** Read the given picklefile as a series of key/value pairs and write to a new ! bsddb database. If the database already exists, any contents are deleted. ! The optional flags indicate the type of the database (bsddb hash, bsddb ! btree, bsddb recno, anydbm, dbm). The default is hash. If a pickle file is ! named it is opened for read access. If no pickle file is named, the pickle ! input is read from standard input. Note that recno databases can only contain numeric keys, so you can't dump a --- 5,13 ---- Read the given picklefile as a series of key/value pairs and write to a new ! database. If the database already exists, any contents are deleted. The ! optional flags indicate the type of the database (bsddb hash, bsddb btree, ! bsddb recno, anydbm, dbm). The default is hash. If a pickle file is named ! it is opened for read access. If no pickle file is named, the pickle input ! is read from standard input. Note that recno databases can only contain numeric keys, so you can't dump a From fdrake@users.sourceforge.net Fri Jun 20 15:00:34 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 20 Jun 2003 07:00:34 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools getpagecounts,1.7.26.1,1.7.26.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1:/tmp/cvs-serv25136 Modified Files: Tag: release22-maint getpagecounts Log Message: Update link to Python book information. Index: getpagecounts =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/getpagecounts,v retrieving revision 1.7.26.1 retrieving revision 1.7.26.2 diff -C2 -d -r1.7.26.1 -r1.7.26.2 *** getpagecounts 17 Apr 2002 03:29:26 -0000 1.7.26.1 --- getpagecounts 20 Jun 2003 14:00:31 -0000 1.7.26.2 *************** *** 66,70 **** Python reference material, consult the Python Bookstore at: ! http://www.amk.ca/bookstore/ The following manuals are included in this package: --- 66,70 ---- Python reference material, consult the Python Bookstore at: ! http://www.python.org/cgi-bin/moinmoin/PythonBooks The following manuals are included in this package: From fdrake@users.sourceforge.net Fri Jun 20 15:00:52 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 20 Jun 2003 07:00:52 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools getpagecounts,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1:/tmp/cvs-serv25177 Modified Files: getpagecounts Log Message: Update link to Python book information. Index: getpagecounts =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/getpagecounts,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** getpagecounts 17 Apr 2002 03:29:40 -0000 1.8 --- getpagecounts 20 Jun 2003 14:00:49 -0000 1.9 *************** *** 66,70 **** Python reference material, consult the Python Bookstore at: ! http://www.amk.ca/bookstore/ The following manuals are included in this package: --- 66,70 ---- Python reference material, consult the Python Bookstore at: ! http://www.python.org/cgi-bin/moinmoin/PythonBooks The following manuals are included in this package: From fdrake@users.sourceforge.net Fri Jun 20 15:27:29 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 20 Jun 2003 07:27:29 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.186,1.187 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv29267 Modified Files: tut.tex Log Message: Remove heading from orphan section. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.186 retrieving revision 1.187 diff -C2 -d -r1.186 -r1.187 *** tut.tex 18 Jun 2003 17:14:29 -0000 1.186 --- tut.tex 20 Jun 2003 14:27:27 -0000 1.187 *************** *** 142,146 **** it is encouraged! ! \section{Where From Here \label{where}} Now that you are all excited about Python, you'll want to examine it --- 142,146 ---- it is encouraged! ! %\section{Where From Here \label{where}} Now that you are all excited about Python, you'll want to examine it From fdrake@users.sourceforge.net Fri Jun 20 15:28:07 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 20 Jun 2003 07:28:07 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.156.4.1.2.18,1.156.4.1.2.19 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv29502 Modified Files: Tag: release22-maint tut.tex Log Message: Remove heading from orphan section. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.156.4.1.2.18 retrieving revision 1.156.4.1.2.19 diff -C2 -d -r1.156.4.1.2.18 -r1.156.4.1.2.19 *** tut.tex 18 Jun 2003 17:17:10 -0000 1.156.4.1.2.18 --- tut.tex 20 Jun 2003 14:28:05 -0000 1.156.4.1.2.19 *************** *** 142,146 **** it is encouraged! ! \section{Where From Here \label{where}} Now that you are all excited about Python, you'll want to examine it --- 142,146 ---- it is encouraged! ! %\section{Where From Here \label{where}} Now that you are all excited about Python, you'll want to examine it From fdrake@users.sourceforge.net Fri Jun 20 15:32:07 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 20 Jun 2003 07:32:07 -0700 Subject: [Python-checkins] python/dist/src/Doc/texinputs boilerplate.tex,1.70.2.1.2.11,1.70.2.1.2.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory sc8-pr-cvs1:/tmp/cvs-serv30479/texinputs Modified Files: Tag: release22-maint boilerplate.tex Log Message: Bump version info. Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/boilerplate.tex,v retrieving revision 1.70.2.1.2.11 retrieving revision 1.70.2.1.2.12 diff -C2 -d -r1.70.2.1.2.11 -r1.70.2.1.2.12 *** boilerplate.tex 29 May 2003 18:49:32 -0000 1.70.2.1.2.11 --- boilerplate.tex 20 Jun 2003 14:32:05 -0000 1.70.2.1.2.12 *************** *** 6,11 **** } ! \date{30 May 2003} % XXX update before final release! ! \release{2.2.3} % software release, not documentation \setreleaseinfo{} % empty for final release \setshortversion{2.2} % major.minor only for software --- 6,11 ---- } ! \date{\today} % XXX update before final release! ! \release{2.2.3+} % software release, not documentation \setreleaseinfo{} % empty for final release \setshortversion{2.2} % major.minor only for software From fdrake@users.sourceforge.net Fri Jun 20 15:32:07 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 20 Jun 2003 07:32:07 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile,1.235.2.1.2.20,1.235.2.1.2.21 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv30479 Modified Files: Tag: release22-maint Makefile Log Message: Bump version info. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.235.2.1.2.20 retrieving revision 1.235.2.1.2.21 diff -C2 -d -r1.235.2.1.2.20 -r1.235.2.1.2.21 *** Makefile 29 May 2003 18:49:32 -0000 1.235.2.1.2.20 --- Makefile 20 Jun 2003 14:32:05 -0000 1.235.2.1.2.21 *************** *** 67,71 **** # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.2.3 PYTHON= python --- 67,71 ---- # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.2.3+ PYTHON= python From jackjansen@users.sourceforge.net Fri Jun 20 15:33:40 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 20 Jun 2003 07:33:40 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1:/tmp/cvs-serv30934a Modified Files: Makefile Log Message: Installation of PythonLauncher has been failing silently, probably since the DESTDIR patch. Fixed. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** Makefile 19 Jun 2003 22:35:20 -0000 1.43 --- Makefile 20 Jun 2003 14:33:38 -0000 1.44 *************** *** 59,64 **** install_PythonLauncher: cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \ ! pbxbuild -target PythonLauncher -buildstyle Deployment \ ! DSTROOT=$(DESTDIR) INSTALL_PATH=$(PYTHONAPPSPATH) install install_Python: --- 59,64 ---- install_PythonLauncher: cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \ ! pbxbuild -target PythonLauncher -buildstyle Deployment install \ ! DSTROOT=$(DESTDIR)/ INSTALL_PATH=$(PYTHONAPPSPATH) install_Python: From jackjansen@users.sourceforge.net Fri Jun 20 15:37:00 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 20 Jun 2003 07:37:00 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj project.pbxproj,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj In directory sc8-pr-cvs1:/tmp/cvs-serv31425/PythonLauncher/PythonLauncher.pbproj Modified Files: project.pbxproj Log Message: At startup, test that PythonLauncher is the default application for files of type .py, .pyw and .pyc. If not, post a warning. Index: project.pbxproj =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj/project.pbxproj,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** project.pbxproj 17 Feb 2003 15:40:00 -0000 1.9 --- project.pbxproj 20 Jun 2003 14:36:58 -0000 1.10 *************** *** 321,342 **** CFBundleTypeExtensions - ???? - - CFBundleTypeIconFile - - CFBundleTypeName - DocumentType - CFBundleTypeOSTypes - - ???? - - CFBundleTypeRole - Editor - NSDocumentClass - MyDocument - - - CFBundleTypeExtensions - py --- 321,324 ---- From jackjansen@users.sourceforge.net Fri Jun 20 15:37:00 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 20 Jun 2003 07:37:00 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher MyAppDelegate.h,1.1,1.2 MyAppDelegate.m,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher In directory sc8-pr-cvs1:/tmp/cvs-serv31425/PythonLauncher Modified Files: MyAppDelegate.h MyAppDelegate.m Log Message: At startup, test that PythonLauncher is the default application for files of type .py, .pyw and .pyc. If not, post a warning. Index: MyAppDelegate.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/MyAppDelegate.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MyAppDelegate.h 29 Jul 2002 21:36:35 -0000 1.1 --- MyAppDelegate.h 20 Jun 2003 14:36:58 -0000 1.2 *************** *** 12,14 **** --- 12,15 ---- - (BOOL)shouldShowUI; - (BOOL)shouldTerminate; + - (void)testFileTypeBinding; @end Index: MyAppDelegate.m =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/MyAppDelegate.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MyAppDelegate.m 1 Aug 2002 15:07:00 -0000 1.2 --- MyAppDelegate.m 20 Jun 2003 14:36:58 -0000 1.3 *************** *** 2,5 **** --- 2,6 ---- #import "PreferencesWindowController.h" #import + #import @implementation MyAppDelegate *************** *** 20,23 **** --- 21,26 ---- - (void)applicationDidFinishLaunching:(NSNotification *)notification { + // Test that the file mappings are correct + [self testFileTypeBinding]; // If we were opened because of a file drag or doubleclick // we've set initial_action_done in shouldShowUI *************** *** 51,53 **** --- 54,96 ---- } + - (void)testFileTypeBinding + { + NSURL *ourUrl; + OSStatus err; + FSRef appRef; + NSURL *appUrl; + static NSString *extensions[] = { @"py", @"pyw", @"pyc", NULL}; + NSString **ext_p; + int i; + + if ([[NSUserDefaults standardUserDefaults] boolForKey: @"SkipFileBindingTest"]) + return; + ourUrl = [NSURL fileURLWithPath: [[NSBundle mainBundle] bundlePath]]; + for( ext_p = extensions; *ext_p; ext_p++ ) { + err = LSGetApplicationForInfo( + kLSUnknownType, + kLSUnknownCreator, + (CFStringRef)*ext_p, + kLSRolesViewer, + &appRef, + (CFURLRef *)&appUrl); + if (err || ![appUrl isEqual: ourUrl] ) { + i = NSRunAlertPanel(@"File type binding", + @"PythonLauncher is not the default application for all " \ + @"Python script types. You should fix this with the " \ + @"Finder's \"Get Info\" command.\n\n" \ + @"See \"Changing the application that opens a file\" in " \ + @"Mac Help for details.", + @"OK", + @"Don't show this warning again", + NULL); + if ( i == 0 ) { // Don't show again + [[NSUserDefaults standardUserDefaults] + setObject:@"YES" forKey:@"SkipFileBindingTest"]; + } + return; + } + } + } + @end From jackjansen@users.sourceforge.net Fri Jun 20 16:14:10 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 20 Jun 2003 08:14:10 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX README,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1:/tmp/cvs-serv5268 Modified Files: README Log Message: Updated. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/README,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** README 16 Sep 2002 20:18:27 -0000 1.10 --- README 20 Jun 2003 15:14:08 -0000 1.11 *************** *** 2,7 **** -------------------------------------------------------- ! This document provides a quick introduction to framework-based Python. ! It is rather terse and probably incomplete, please send me feedback. 1. Why would I want a framework Python in stead of a normal static Python? --- 2,7 ---- -------------------------------------------------------- ! This document provides a quick introduction to framework-based Python, its ! advantages, and how to build it. 1. Why would I want a framework Python in stead of a normal static Python? *************** *** 16,20 **** A second reason for using frameworks is that they put Python-related items in ! only two places: /Library/Framework/Python.framework and /Applications/Python. This simplifies matters for users installing Python from a binary distribution if they want to get rid of it again. Moreover, due to the way frameworks work --- 16,20 ---- A second reason for using frameworks is that they put Python-related items in ! only two places: /Library/Framework/Python.framework and /Applications/MacPython-2.3. This simplifies matters for users installing Python from a binary distribution if they want to get rid of it again. Moreover, due to the way frameworks work *************** *** 22,25 **** --- 22,29 ---- her home directory without recompilation. + Incidentally, the procedure described here is also the procedure that is + used to create the MacPython binary installer, so the information here + should theoretically allow you to rebuild that. + 2. How does a framework Python differ from a normal static Python? ------------------------------------------------------------------ *************** *** 52,56 **** This directory contains a Makefile that will create a couple of python-related applications (fullblown OSX .app applications, that is) in ! /Applications/Python, and a hidden helper application Python.app inside the Python.framework, and unix tools "python" and "pythonw" into /usr/local/bin. In addition it has a target "installmacsubtree" that installs the relevant --- 56,60 ---- This directory contains a Makefile that will create a couple of python-related applications (fullblown OSX .app applications, that is) in ! /Applications/MacPython-2.3, and a hidden helper application Python.app inside the Python.framework, and unix tools "python" and "pythonw" into /usr/local/bin. In addition it has a target "installmacsubtree" that installs the relevant *************** *** 66,73 **** the applications in /Applications/Python and the unix tools in /usr/local/bin. ! Building in another place, for instance $HOME/Library/Frameworks if you have no admin privileges on your machine, has only been tested very lightly. This can be done by configuring with --enable-framework=$HOME/Library/Frameworks. ! The other two directories, /Applications/Python and /usr/local/bin, will then also be deposited in $HOME. This is sub-optimal for the unix tools, which you would want in $HOME/bin, but there is no easy way to fix this right now. --- 70,77 ---- the applications in /Applications/Python and the unix tools in /usr/local/bin. ! Installing in another place, for instance $HOME/Library/Frameworks if you have no admin privileges on your machine, has only been tested very lightly. This can be done by configuring with --enable-framework=$HOME/Library/Frameworks. ! The other two directories, /Applications/MacPython-2.3 and /usr/local/bin, will then also be deposited in $HOME. This is sub-optimal for the unix tools, which you would want in $HOME/bin, but there is no easy way to fix this right now. *************** *** 82,85 **** --- 86,93 ---- framework itself, the Mac subtree, the applications and the unix tools. + There is an extra target frameworkinstallextras that is not part of the + normal frameworkinstall which installs the Demo and Tools directories + into /Applications/MacPython-2.3, this is useful for binary distributions. + If you want to run the Makefile here directly, in stead of through the main Makefile, you will have to pass various variable-assignments. Read the *************** *** 112,153 **** ----------------------------------------- ! Note: this section is work-in-progress. ! ! First, to make sure there's no contamination, it is best to remove your ! existing Python installation (clear out /Library/Frameworks/Python.framework ! and /Applications/Python). Also, after build/install is finished check that ! nothing has shown up in those two locations. ! Create a subdirectory of the main python directory, say build-pythondist. In ! there, run ! ../configure --enable-framework=/tmp/pythondist/Library/Frameworks \ ! LDFLAGS=-Wl,-x ! make ! make frameworkinstall ! This installs a complete distribution set in /tmp/pythondist: in a framework ! build all other pathnames are computed from the framework pathname. ! Optionally you may want to include the full documentation in the binary installer. ! To this end, execute the following commands: ! python.exe ../Mac/OSX/setupDocs.py build ! python.exe ../Mac/OSX/setupDocs.py install \ ! --prefix=/tmp/python/Library/Frameworks/Python.framework/Versions/Current ! ! Note that the unix tools in /tmp/pythondist are wrong, these have to be ! removed, and the installer post-install script should recreate them on the ! target system. Also, the .pyc and .pyo files need to be removed: ! rm -rf /tmp/pythondist/usr ! python.exe ../Mac/script/zappycfiles.py /tmp/pythondist ! Finally, create the .pkg file with a commandline like ! python ../Mac/scripts/buildpkg.py \ ! --Title=MacPython-X \ ! --Version=2.3a0 \ ! --Description="Python for Mac OS X, framework based" \ ! /tmp/pythondist ! This creates a MacPython-X.pkg in the current directory. ! TBD: provide postinstall scripts to precompile .pyc/.pyo files, and to recreate ! the unix programs. 7. Odds and ends. --- 120,145 ---- ----------------------------------------- ! Go to the Mac/OSX/Dist directory. There you find a script "build" that ! does all the work: it configures and builds a framework Python, installs ! it, creates the installer package file and packs this in a DMG image. ! All of this is normally done completely isolated in /tmp/_py, so it does not ! use your normal build directory nor does it install into /. ! Because the build script locates the Python source tree relative to its own ! pathname you may have to run it with a full pathname. If you are debugging your ! install you can pass one argument: the pathname where the build directory ! is located (i.e. where configure and make will be run), then this directory ! will be saved between runs of the build script. Do *not* specify your normal ! build directory here. ! build will ask you whether you have updated the readme file, and it will offer ! to include the full documentation in the installer. That option has not ! been used for a while, and it may not work. ! If you need to execute code on the client machine after installing Python ! you can add this to resources/postflight. If you need to do even stranger things ! you have to read Apple's documentation on PackageMaker and read the source ! of Mac/scripts/buildpkg.py. 7. Odds and ends. *************** *** 165,167 **** files. ! Jack Jansen, jack@oratrix.com, 06-Sep-02 \ No newline at end of file --- 157,159 ---- files. ! Jack Jansen, Jack.Jansen@cwi.nl, 20-Jun-2003. \ No newline at end of file From rhettinger@users.sourceforge.net Fri Jun 20 17:13:20 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 20 Jun 2003 09:13:20 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.289,2.290 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv15592 Modified Files: compile.c Log Message: Removed bytecode transformation for sequence packing/unpacking. It depended on the previously removed basic block checker to prevent a jump into the middle of the transformed block. Clears SF 757818: tuple assignment -- SystemError: unknown opcode Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.289 retrieving revision 2.290 diff -C2 -d -r2.289 -r2.290 *** compile.c 22 May 2003 22:00:04 -0000 2.289 --- compile.c 20 Jun 2003 16:13:17 -0000 2.290 *************** *** 364,395 **** break; - /* Replace BUILD_SEQN 2 UNPACK_SEQN 2 with ROT2 JMP+2. - Replace BUILD_SEQN 3 UNPACK_SEQN 3 with ROT3 ROT2 JMP+1. - Note, these opcodes occur together only in assignment - statements. Accordingly, the unpack opcode is never - a jump target. */ - case BUILD_TUPLE: - case BUILD_LIST: - if (codestr[i+3] != UNPACK_SEQUENCE) - continue; - if (GETARG(codestr, i) == 2 && \ - GETARG(codestr, i+3) == 2) { - codestr[i] = ROT_TWO; - codestr[i+1] = JUMP_FORWARD; - SETARG(codestr, i+1, 2); - codestr[i+4] = DUP_TOP; /* Filler codes used as NOPs */ - codestr[i+5] = POP_TOP; - continue; - } - if (GETARG(codestr, i) == 3 && \ - GETARG(codestr, i+3) == 3) { - codestr[i] = ROT_THREE; - codestr[i+1] = ROT_TWO; - codestr[i+2] = JUMP_FORWARD; - SETARG(codestr, i+2, 1); - codestr[i+5] = DUP_TOP; - } - break; - /* Replace jumps to unconditional jumps */ case FOR_ITER: --- 364,367 ---- From tim_one@users.sourceforge.net Fri Jun 20 18:07:12 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 20 Jun 2003 10:07:12 -0700 Subject: [Python-checkins] python/nondist/peps pep-0042.txt,1.72,1.73 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv24667/peps Modified Files: pep-0042.txt Log Message: Added a new "Non-accidental IEEE-754 support" report. Index: pep-0042.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0042.txt,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** pep-0042.txt 15 May 2003 01:44:01 -0000 1.72 --- pep-0042.txt 20 Jun 2003 17:07:09 -0000 1.73 *************** *** 40,44 **** 2a) BDFL would really like to see some code! ! 2b) BDFL is never going to be enthusiastic about this, but will work it in when it's easy. ) --- 40,44 ---- 2a) BDFL would really like to see some code! ! 2b) BDFL is never going to be enthusiastic about this, but will work it in when it's easy. ) *************** *** 75,81 **** http://www.python.org/sf/445484 ! Error on handling nan http://www.python.org/sf/737648 - Windows: Trying to create (or even access) files with certain magic names can hang or crash Windows systems. This is really a bug in the --- 75,84 ---- http://www.python.org/sf/445484 ! Error on handling nan http://www.python.org/sf/737648 + Infinite floats don't work in compiled modules on windows + http://www.python.org/sf/757815 + - Windows: Trying to create (or even access) files with certain magic names can hang or crash Windows systems. This is really a bug in the *************** *** 240,244 **** http://www.python.org/sf/415694 ! - pydoc should be integrated with the HTML docs, or at least be able to link to them. --- 243,247 ---- http://www.python.org/sf/415694 ! - pydoc should be integrated with the HTML docs, or at least be able to link to them. *************** *** 249,253 **** http://www.python.org/sf/472881 ! - asynchat is buggy in the face of multithreading. http://www.python.org/sf/595217 --- 252,256 ---- http://www.python.org/sf/472881 ! - asynchat is buggy in the face of multithreading. http://www.python.org/sf/595217 *************** *** 282,287 **** you would want to break that). However, here's one idea: ! 'I' - unsigned int (consistent with H and B) ! 'p' - unsigned long ('p' is for positive) 'P' - unsigned long long --- 285,290 ---- you would want to break that). However, here's one idea: ! 'I' - unsigned int (consistent with H and B) ! 'p' - unsigned long ('p' is for positive) 'P' - unsigned long long From nnorwitz@users.sourceforge.net Fri Jun 20 18:11:41 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 20 Jun 2003 10:11:41 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libsocket.tex,1.73,1.74 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv25580 Modified Files: libsocket.tex Log Message: SF #757229, fix libsocket.tex typo Index: libsocket.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsocket.tex,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** libsocket.tex 25 Apr 2003 16:16:02 -0000 1.73 --- libsocket.tex 20 Jun 2003 17:11:39 -0000 1.74 *************** *** 584,588 **** operation has completed. Setting a timeout of \code{None} disables timeouts on socket operations. ! \code{s.settimeout(0.0)} is equivalent to \code{s.blocking(0)}; \code{s.settimeout(None)} is equivalent to \code{s.setblocking(1)}. \versionadded{2.3} --- 584,588 ---- operation has completed. Setting a timeout of \code{None} disables timeouts on socket operations. ! \code{s.settimeout(0.0)} is equivalent to \code{s.setblocking(0)}; \code{s.settimeout(None)} is equivalent to \code{s.setblocking(1)}. \versionadded{2.3} From rhettinger@users.sourceforge.net Fri Jun 20 19:41:29 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 20 Jun 2003 11:41:29 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_compile.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv9926 Modified Files: test_compile.py Log Message: Added regression test for SF #757818 Index: test_compile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_compile.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_compile.py 18 Feb 2003 15:22:09 -0000 1.17 --- test_compile.py 20 Jun 2003 18:41:26 -0000 1.18 *************** *** 157,158 **** --- 157,163 ---- expect_same("-" + all_one_bits, 1) """ + + # Verify sequence packing/unpacking with "or". SF bug #757818 + i,j = (1, -1) or (-1, 1) + if i != 1 or j != -1: + raise TestFailed, "Sequence packing/unpacking" From jvr@users.sourceforge.net Fri Jun 20 19:56:12 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 20 Jun 2003 11:56:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac bundlebuilder.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv12462 Modified Files: bundlebuilder.py Log Message: Add initial standalone support for Python.framework Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/bundlebuilder.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** bundlebuilder.py 25 May 2003 22:00:16 -0000 1.26 --- bundlebuilder.py 20 Jun 2003 18:56:10 -0000 1.27 *************** *** 285,288 **** --- 285,289 ---- os.environ["PYTHONEXECUTABLE"] = executable os.environ["DYLD_LIBRARY_PATH"] = libdir + os.environ["DYLD_FRAMEWORK_PATH"] = libdir os.execve(executable, sys.argv, os.environ) """ *************** *** 299,302 **** --- 300,315 ---- """ + # + # When building a standalone app with Python.framework, we need to copy + # a subset from Python.framework to the bundle. The following list + # specifies exactly what items we'll copy. + # + PYTHONFRAMEWORKGOODIES = [ + "Python", # the Python core library + "Resources/English.lproj", + "Resources/Info.plist", + "Resources/version.plist", + ] + class AppBuilder(BundleBuilder): *************** *** 332,339 **** # If True, build standalone app. standalone = 0 ! # If set, use this for #! lines in stead of sys.executable python = None ! # If True, add a real main program that emulates sys.argv before calling # mainprogram --- 345,352 ---- # If True, build standalone app. standalone = 0 ! # If set, use this for #! lines in stead of sys.executable python = None ! # If True, add a real main program that emulates sys.argv before calling # mainprogram *************** *** 393,396 **** --- 406,412 ---- self.plist.NSPrincipalClass = "NSApplication" + if self.standalone and "Python.framework" in sys.exec_prefix: + self.addPythonFramework() + BundleBuilder.setup(self) *************** *** 474,477 **** --- 490,507 ---- if self.missingModules or self.maybeMissingModules: self.reportMissing() + + def addPythonFramework(self): + # If we're building a standalone app with Python.framework, + # include a minimal subset of Python.framework + frameworkpath = sys.exec_prefix[:sys.exec_prefix.find( + "Python.framework") + len("Python.framework")] + version = sys.version[:3] + frameworkpath = pathjoin(frameworkpath, "Versions", version) + destbase = pathjoin("Contents", "Frameworks", "Python.framework", + "Versions", version) + for item in PYTHONFRAMEWORKGOODIES: + src = pathjoin(frameworkpath, item) + dst = pathjoin(destbase, item) + self.files.append((src, dst)) def addPythonModules(self): From jvr@users.sourceforge.net Fri Jun 20 21:05:42 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 20 Jun 2003 13:05:42 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac bundlebuilder.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv25032 Modified Files: bundlebuilder.py Log Message: register the library inside Python.framework as eligable for stripping Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/bundlebuilder.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** bundlebuilder.py 20 Jun 2003 18:56:10 -0000 1.27 --- bundlebuilder.py 20 Jun 2003 20:05:40 -0000 1.28 *************** *** 503,506 **** --- 503,508 ---- src = pathjoin(frameworkpath, item) dst = pathjoin(destbase, item) + if item == "Python": + self.binaries.append(dst) self.files.append((src, dst)) *************** *** 549,554 **** self.message("Stripping %s" % relpath, 2) abspath = pathjoin(self.bundlepath, relpath) ! assert not os.path.islink(abspath) ! rv = os.system("%s -S \"%s\"" % (STRIP_EXEC, abspath)) def findDependencies(self): --- 551,556 ---- self.message("Stripping %s" % relpath, 2) abspath = pathjoin(self.bundlepath, relpath) ! if not os.path.islink(abspath): ! rv = os.system("%s -S \"%s\"" % (STRIP_EXEC, abspath)) def findDependencies(self): From jackjansen@users.sourceforge.net Fri Jun 20 21:36:55 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 20 Jun 2003 13:36:55 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.132,1.133 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv30041 Modified Files: Makefile.pre.in Log Message: Set the executable bits when installing the shared library in a MacOSX framework. Fixes #758112. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.132 retrieving revision 1.133 diff -C2 -d -r1.132 -r1.133 *** Makefile.pre.in 19 Jun 2003 22:35:19 -0000 1.132 --- Makefile.pre.in 20 Jun 2003 20:36:53 -0000 1.133 *************** *** 850,854 **** $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources ! $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY) # This installs Mac/Lib into the framework --- 850,854 ---- $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources ! $(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY) # This installs Mac/Lib into the framework From jvr@users.sourceforge.net Fri Jun 20 22:18:24 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 20 Jun 2003 14:18:24 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac bundlebuilder.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv4278 Modified Files: bundlebuilder.py Log Message: Reworked --strip option: it will now look at _any_ file that's marked executable in the bundle. Therefore got rid of the "binaries" attribute. Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/bundlebuilder.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** bundlebuilder.py 20 Jun 2003 20:05:40 -0000 1.28 --- bundlebuilder.py 20 Jun 2003 21:18:22 -0000 1.29 *************** *** 364,368 **** includePackages = [] ! # Strip binaries. strip = 0 --- 364,368 ---- includePackages = [] ! # Strip binaries from debug info. strip = 0 *************** *** 374,380 **** maybeMissingModules = [] - # List of all binaries (executables or shared libs), for stripping purposes - binaries = [] - def setup(self): if self.standalone and self.mainprogram is None: --- 374,377 ---- *************** *** 426,430 **** if not self.symlink_exec: self.files.append((self.executable, execpath)) - self.binaries.append(execpath) self.execpath = execpath --- 423,426 ---- *************** *** 503,508 **** src = pathjoin(frameworkpath, item) dst = pathjoin(destbase, item) - if item == "Python": - self.binaries.append(dst) self.files.append((src, dst)) --- 499,502 ---- *************** *** 547,556 **** "%s" % STRIP_EXEC, 0) else: self.message("Stripping binaries", 1) ! for relpath in self.binaries: ! self.message("Stripping %s" % relpath, 2) ! abspath = pathjoin(self.bundlepath, relpath) ! if not os.path.islink(abspath): ! rv = os.system("%s -S \"%s\"" % (STRIP_EXEC, abspath)) def findDependencies(self): --- 541,568 ---- "%s" % STRIP_EXEC, 0) else: + import stat self.message("Stripping binaries", 1) ! def walk(top): ! for name in os.listdir(top): ! path = pathjoin(top, name) ! if os.path.islink(path): ! continue ! if os.path.isdir(path): ! walk(path) ! else: ! mod = os.stat(path)[stat.ST_MODE] ! if not (mod & 0100): ! continue ! relpath = path[len(self.bundlepath):] ! self.message("Stripping %s" % relpath, 2) ! inf, outf = os.popen4("%s -S \"%s\"" % ! (STRIP_EXEC, path)) ! output = outf.read().strip() ! if output: ! # usually not a real problem, like when we're ! # trying to strip a script ! self.message("Problem stripping %s:" % relpath, 3) ! self.message(output, 3) ! walk(self.bundlepath) def findDependencies(self): *************** *** 599,603 **** dstpath = pathjoin("Contents", "Resources", *dstpath) self.files.append((path, dstpath)) - self.binaries.append(dstpath) if mod.__code__ is not None: ispkg = mod.__path__ is not None --- 611,614 ---- From jvr@users.sourceforge.net Fri Jun 20 22:26:58 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 20 Jun 2003 14:26:58 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac bundlebuilder.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv5464 Modified Files: bundlebuilder.py Log Message: make sure paths to dirs don't end in a / Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/bundlebuilder.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** bundlebuilder.py 20 Jun 2003 21:18:22 -0000 1.29 --- bundlebuilder.py 20 Jun 2003 21:26:55 -0000 1.30 *************** *** 172,179 **** for path in self.resources: files.append((path, pathjoin("Contents", "Resources", ! os.path.basename(path)))) for path in self.libs: files.append((path, pathjoin("Contents", "Frameworks", ! os.path.basename(path)))) if self.symlink: self.message("Making symbolic links", 1) --- 172,179 ---- for path in self.resources: files.append((path, pathjoin("Contents", "Resources", ! os.path.basename(os.path.normpath(path))))) for path in self.libs: files.append((path, pathjoin("Contents", "Frameworks", ! os.path.basename(os.path.normpath(path))))) if self.symlink: self.message("Making symbolic links", 1) From jackjansen@users.sourceforge.net Fri Jun 20 22:40:59 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 20 Jun 2003 14:40:59 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/Dist/resources Welcome.txt,1.2,1.3 postflight,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist/resources In directory sc8-pr-cvs1:/tmp/cvs-serv7309/resources Modified Files: Welcome.txt postflight Log Message: Cop out, and set things to be group-writeable recursively. The various xxxMODE flags don't cut it. Also set the umask to 2 before doing the compileall on the destination system. Index: Welcome.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Dist/resources/Welcome.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Welcome.txt 7 May 2003 09:41:56 -0000 1.2 --- Welcome.txt 20 Jun 2003 21:40:57 -0000 1.3 *************** *** 1,3 **** ! This program will install MacPython 2.3b1 for Mac OS X. MacPython consists of the Python programming language interpreter, plus --- 1,3 ---- ! This program will install MacPython 2.3b1+ for Mac OS X. MacPython consists of the Python programming language interpreter, plus Index: postflight =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Dist/resources/postflight,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** postflight 16 Jun 2003 15:10:47 -0000 1.5 --- postflight 20 Jun 2003 21:40:57 -0000 1.6 *************** *** 10,13 **** --- 10,15 ---- DEST=$2 + # Make sure things are group-writeable + umask 2 # if destination is / then use usr/local/bin, otherwise just bin From jackjansen@users.sourceforge.net Fri Jun 20 22:40:59 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 20 Jun 2003 14:40:59 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/Dist build,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist In directory sc8-pr-cvs1:/tmp/cvs-serv7309 Modified Files: build Log Message: Cop out, and set things to be group-writeable recursively. The various xxxMODE flags don't cut it. Also set the umask to 2 before doing the compileall on the destination system. Index: build =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Dist/build,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** build 19 Jun 2003 22:45:37 -0000 1.8 --- build 20 Jun 2003 21:40:57 -0000 1.9 *************** *** 92,95 **** --- 92,99 ---- make DIRMODE=775 EXEMODE=775 FILEMODE=664 DESTDIR=$INSTALLROOT frameworkinstallextras + # Unfortunately all the ...MODE arguments above still don't do the trick. + # Cop out, and recursively set everything group-writeable. + chmod -R ug+w $INSTALLROOT + if [ "$builddocs" = "y" -o "$builddocs" = "Y" ]; then ./python.exe $PYTHONSRC/Mac/OSX/setupDocs.py build From jvr@users.sourceforge.net Fri Jun 20 22:43:39 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 20 Jun 2003 14:43:39 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac bundlebuilder.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv7697 Modified Files: bundlebuilder.py Log Message: - do the right thing with symlinks inside directories we're copying - move the normpath stuff around a bit - added dubious special case to addPythonFramework() Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/bundlebuilder.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** bundlebuilder.py 20 Jun 2003 21:26:55 -0000 1.30 --- bundlebuilder.py 20 Jun 2003 21:43:36 -0000 1.31 *************** *** 172,179 **** for path in self.resources: files.append((path, pathjoin("Contents", "Resources", ! os.path.basename(os.path.normpath(path))))) for path in self.libs: files.append((path, pathjoin("Contents", "Frameworks", ! os.path.basename(os.path.normpath(path))))) if self.symlink: self.message("Making symbolic links", 1) --- 172,179 ---- for path in self.resources: files.append((path, pathjoin("Contents", "Resources", ! os.path.basename(path)))) for path in self.libs: files.append((path, pathjoin("Contents", "Frameworks", ! os.path.basename(path)))) if self.symlink: self.message("Making symbolic links", 1) *************** *** 489,495 **** def addPythonFramework(self): # If we're building a standalone app with Python.framework, ! # include a minimal subset of Python.framework frameworkpath = sys.exec_prefix[:sys.exec_prefix.find( "Python.framework") + len("Python.framework")] version = sys.version[:3] frameworkpath = pathjoin(frameworkpath, "Versions", version) --- 489,502 ---- def addPythonFramework(self): # If we're building a standalone app with Python.framework, ! # include a minimal subset of Python.framework, *unless* ! # Python.framework was specified manually in self.libs. ! for lib in self.libs: ! if os.path.basename(lib) == "Python.framework": ! # a Python.framework was specified as a library ! return ! frameworkpath = sys.exec_prefix[:sys.exec_prefix.find( "Python.framework") + len("Python.framework")] + version = sys.version[:3] frameworkpath = pathjoin(frameworkpath, "Versions", version) *************** *** 694,698 **** makedirs(os.path.dirname(dst)) if os.path.isdir(src): ! shutil.copytree(src, dst) else: shutil.copy2(src, dst) --- 701,705 ---- makedirs(os.path.dirname(dst)) if os.path.isdir(src): ! shutil.copytree(src, dst, symlinks=1) else: shutil.copy2(src, dst) *************** *** 795,799 **** builder.name = arg elif opt in ('-r', '--resource'): ! builder.resources.append(arg) elif opt in ('-f', '--file'): srcdst = arg.split(':') --- 802,806 ---- builder.name = arg elif opt in ('-r', '--resource'): ! builder.resources.append(os.path.normpath(arg)) elif opt in ('-f', '--file'): srcdst = arg.split(':') *************** *** 813,817 **** builder.iconfile = arg elif opt == "--lib": ! builder.libs.append(arg) elif opt == "--nib": builder.nibname = arg --- 820,824 ---- builder.iconfile = arg elif opt == "--lib": ! builder.libs.append(os.path.normpath(arg)) elif opt == "--nib": builder.nibname = arg From bwarsaw@users.sourceforge.net Fri Jun 20 23:04:05 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 20 Jun 2003 15:04:05 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libmailbox.tex,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv10646 Modified Files: libmailbox.tex Log Message: Add some documentation which describes how to use the email package instead of rfc822 as the Message factory. Index: libmailbox.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmailbox.tex,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** libmailbox.tex 23 Sep 2002 19:32:42 -0000 1.25 --- libmailbox.tex 20 Jun 2003 22:04:03 -0000 1.26 *************** *** 17,21 **** argument, \var{fp} by the \method{next()} method of the mailbox object. The default is the \class{rfc822.Message} class (see the ! \refmodule{rfc822} module). For maximum portability, messages in a \UNIX-style mailbox are --- 17,21 ---- argument, \var{fp} by the \method{next()} method of the mailbox object. The default is the \class{rfc822.Message} class (see the ! \refmodule{rfc822} module -- and the note below). For maximum portability, messages in a \UNIX-style mailbox are *************** *** 84,87 **** --- 84,121 ---- \end{classdesc} + Note that because the \refmodule{rfc822} module is deprecated, it is + recommended that you use the \refmodule{email} package to create + message objects from a mailbox. (The default can't be changed for + backwards compatibility reasons.) The safest way to do this is with + bit of code: + + \begin{verbatim} + import email + import email.Errors + import mailbox + + def msgfactory(fp): + try: + return email.message_from_file(fp) + except email.Errors.MessageParseError: + # Don't return None since that will + # stop the mailbox iterator + return '' + + mbox = mailbox.UnixMailbox(fp, msgfactory) + \end{verbatim} + + The above wrapper is defensive against ill-formed MIME messages in the + mailbox, but you have to be prepared to receive the empty string from + the mailbox's \function{next()} method. On the other hand, if you + know your mailbox contains only well-formed MIME messages, you can + simplify this to: + + \begin{verbatim} + import email + import mailbox + + mbox = mailbox.UnixMailbox(fp, email.message_from_file) + \end{verbatim} \begin{seealso} From jackjansen@users.sourceforge.net Fri Jun 20 23:21:06 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 20 Jun 2003 15:21:06 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib classes.nib,1.2,1.3 info.nib,1.2,1.3 objects.nib,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib In directory sc8-pr-cvs1:/tmp/cvs-serv13341/English.lproj/MyDocument.nib Modified Files: classes.nib info.nib objects.nib Log Message: Added a field that allows the user to set sys.argv-style arguments to the script. Fixes #757544. Index: classes.nib =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/classes.nib,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** classes.nib 17 Feb 2003 15:40:00 -0000 1.2 --- classes.nib 20 Jun 2003 22:21:03 -0000 1.3 *************** *** 15,18 **** --- 15,19 ---- optimize = NSButton; others = NSTextField; + scriptargs = NSTextField; tabs = NSButton; verbose = NSButton; Index: info.nib =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/info.nib,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** info.nib 17 Feb 2003 15:40:00 -0000 1.2 --- info.nib 20 Jun 2003 22:21:03 -0000 1.3 *************** *** 4,10 **** IBDocumentLocation ! 551 90 356 240 0 0 1280 1002 IBFramework Version ! 286.0 IBOpenObjects --- 4,10 ---- IBDocumentLocation ! 398 60 356 240 0 0 1024 746 IBFramework Version ! 291.0 IBOpenObjects *************** *** 12,16 **** IBSystem Version ! 6I32 --- 12,16 ---- IBSystem Version ! 6L60 Index: objects.nib =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/English.lproj/MyDocument.nib/objects.nib,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsRor1id and /tmp/cvsgWAnlg differ From jackjansen@users.sourceforge.net Fri Jun 20 23:21:06 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 20 Jun 2003 15:21:06 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj project.pbxproj,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj In directory sc8-pr-cvs1:/tmp/cvs-serv13341/PythonLauncher.pbproj Modified Files: project.pbxproj Log Message: Added a field that allows the user to set sys.argv-style arguments to the script. Fixes #757544. Index: project.pbxproj =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PythonLauncher.pbproj/project.pbxproj,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** project.pbxproj 20 Jun 2003 14:36:58 -0000 1.10 --- project.pbxproj 20 Jun 2003 22:21:03 -0000 1.11 *************** *** 133,136 **** --- 133,137 ---- 4A9504D1FFE6A4CB11CA0CBA, ); + hasScannedForEncodings = 1; isa = PBXProject; mainGroup = 2A37F4AAFDCFA73011CA2CEA; *************** *** 386,390 **** "; - shouldUseHeadermap = 0; }; 2A37F4C7FDCFA73011CA2CEA = { --- 387,390 ---- From jackjansen@users.sourceforge.net Fri Jun 20 23:21:05 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 20 Jun 2003 15:21:05 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher FileSettings.h,1.4,1.5 FileSettings.m,1.6,1.7 MyDocument.h,1.2,1.3 MyDocument.m,1.4,1.5 PreferencesWindowController.m,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher In directory sc8-pr-cvs1:/tmp/cvs-serv13341 Modified Files: FileSettings.h FileSettings.m MyDocument.h MyDocument.m PreferencesWindowController.m Log Message: Added a field that allows the user to set sys.argv-style arguments to the script. Fixes #757544. Index: FileSettings.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/FileSettings.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FileSettings.h 17 Feb 2003 15:39:59 -0000 1.4 --- FileSettings.h 20 Jun 2003 22:21:03 -0000 1.5 *************** *** 20,23 **** --- 20,24 ---- - (NSString *) others; - (BOOL) with_terminal; + - (NSString *) scriptargs; @end *************** *** 34,37 **** --- 35,39 ---- BOOL tabs; // -t option: warn about inconsistent tabs NSString *others; // other options + NSString *scriptargs; // script arguments (not for preferences) BOOL with_terminal; // Run in terminal window Index: FileSettings.m =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/FileSettings.m,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FileSettings.m 17 Feb 2003 15:39:59 -0000 1.6 --- FileSettings.m 20 Jun 2003 22:21:03 -0000 1.7 *************** *** 78,81 **** --- 78,82 ---- tabs = source->tabs; others = [source->others retain]; + scriptargs = [source->scriptargs retain]; with_terminal = source->with_terminal; prefskey = source->prefskey; *************** *** 165,168 **** --- 166,170 ---- if (!self) return self; interpreters = [fsdefaults->interpreters retain]; + scriptargs = [@"" retain]; [self applyUserDefaults: filetype]; prefskey = [filetype retain]; *************** *** 192,195 **** --- 194,198 ---- tabs = [source tabs]; others = [[source others] retain]; + scriptargs = [[source scriptargs] retain]; with_terminal = [source with_terminal]; // And if this is a user defaults object we also save the *************** *** 207,210 **** --- 210,214 ---- [NSNumber numberWithBool: nosite], @"nosite", others, @"others", + scriptargs, @"scriptargs", [NSNumber numberWithBool: with_terminal], @"with_terminal", nil]; *************** *** 236,239 **** --- 240,245 ---- value = [dict objectForKey: @"others"]; if (value) others = [value retain]; + value = [dict objectForKey: @"scriptargs"]; + if (value) scriptargs = [value retain]; value = [dict objectForKey: @"with_terminal"]; if (value) with_terminal = [value boolValue]; *************** *** 261,265 **** return [NSString stringWithFormat: ! @"\"%@\"%s%s%s%s%s%s %@ \"%@\" %s", cur_interp, debug?" -d":"", --- 267,271 ---- return [NSString stringWithFormat: ! @"\"%@\"%s%s%s%s%s%s %@ \"%@\" %@ %s", cur_interp, debug?" -d":"", *************** *** 271,274 **** --- 277,281 ---- others, script, + scriptargs, with_terminal? "&& echo Exit status: $? && exit 1" : " &"]; } *************** *** 286,289 **** --- 293,297 ---- - (BOOL) tabs { return tabs;}; - (NSString *) others { return others;}; + - (NSString *) scriptargs { return scriptargs;}; - (BOOL) with_terminal { return with_terminal;}; Index: MyDocument.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/MyDocument.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MyDocument.h 17 Feb 2003 15:39:59 -0000 1.2 --- MyDocument.h 20 Jun 2003 22:21:03 -0000 1.3 *************** *** 24,27 **** --- 24,28 ---- IBOutlet NSTextField *others; IBOutlet NSButton *with_terminal; + IBOutlet NSTextField *scriptargs; IBOutlet NSTextField *commandline; Index: MyDocument.m =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/MyDocument.m,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MyDocument.m 17 Feb 2003 15:39:59 -0000 1.4 --- MyDocument.m 20 Jun 2003 22:21:03 -0000 1.5 *************** *** 61,64 **** --- 61,65 ---- [tabs setState: [settings tabs]]; [others setStringValue: [settings others]]; + [scriptargs setStringValue: [settings scriptargs]]; [with_terminal setState: [settings with_terminal]]; *************** *** 162,165 **** --- 163,167 ---- - (BOOL) tabs { return [tabs state];}; - (NSString *) others { return [others stringValue];}; + - (NSString *) scriptargs { return [scriptargs stringValue];}; - (BOOL) with_terminal { return [with_terminal state];}; Index: PreferencesWindowController.m =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/PreferencesWindowController.m,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PreferencesWindowController.m 17 Feb 2003 15:39:59 -0000 1.4 --- PreferencesWindowController.m 20 Jun 2003 22:21:03 -0000 1.5 *************** *** 40,43 **** --- 40,44 ---- [others setStringValue: [settings others]]; [with_terminal setState: [settings with_terminal]]; + // Not scriptargs, it isn't for preferences [commandline setStringValue: [settings commandLineForScript: @""]]; *************** *** 85,88 **** --- 86,90 ---- - (NSString *) others { return [others stringValue];}; - (BOOL) with_terminal { return [with_terminal state];}; + - (NSString *) scriptargs { return @"";}; // Delegates From loewis@users.sourceforge.net Sat Jun 21 14:26:30 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 21 Jun 2003 06:26:30 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.133,1.134 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv7644 Modified Files: Makefile.pre.in Log Message: Set -d in compileall, to get proper path in case DESTDIR is not empty. Also add force, to recompile string.pyc in DESTDIR (which would normally compiled by running compileall.py). Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.133 retrieving revision 1.134 diff -C2 -d -r1.133 -r1.134 *** Makefile.pre.in 20 Jun 2003 20:36:53 -0000 1.133 --- Makefile.pre.in 21 Jun 2003 13:26:28 -0000 1.134 *************** *** 704,716 **** --- 704,720 ---- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST) -f \ -x 'badsyntax|site-packages' $(DESTDIR)$(LIBDEST) PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST) -f \ -x 'badsyntax|site-packages' $(DESTDIR)$(LIBDEST) PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST)/site-packages -f \ -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ + -d $(LIBDEST)/site-packages -f \ -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages From loewis@users.sourceforge.net Sat Jun 21 14:40:04 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 21 Jun 2003 06:40:04 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref2.tex,1.47,1.48 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv9196 Modified Files: ref2.tex Log Message: Patch #755683: Document that there might be a maximum indentation limit. Fixes #700827 Index: ref2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref2.tex,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** ref2.tex 19 Jan 2003 13:08:18 -0000 1.47 --- ref2.tex 21 Jun 2003 13:40:02 -0000 1.48 *************** *** 186,190 **** \strong{Cross-platform compatibility note:} because of the nature of text editors on non-UNIX platforms, it is unwise to use a mixture of ! spaces and tabs for the indentation in a single source file. A formfeed character may be present at the start of the line; it will --- 186,192 ---- \strong{Cross-platform compatibility note:} because of the nature of text editors on non-UNIX platforms, it is unwise to use a mixture of ! spaces and tabs for the indentation in a single source file. It ! should also be noted that different platforms may explicitly limit the ! maximum indentation level. A formfeed character may be present at the start of the line; it will From loewis@users.sourceforge.net Sat Jun 21 14:54:57 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 21 Jun 2003 06:54:57 -0700 Subject: [Python-checkins] python/dist/src/Lib whichdb.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv10663 Modified Files: whichdb.py Log Message: Patch #755087: Deal with emptied dumbdbm files correctly. Index: whichdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/whichdb.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** whichdb.py 14 Jun 2003 08:16:33 -0000 1.15 --- whichdb.py 21 Jun 2003 13:54:55 -0000 1.16 *************** *** 52,59 **** try: # First check for presence of files ! sizes = os.stat(filename + os.extsep + "dat").st_size, \ ! os.stat(filename + os.extsep + "dir").st_size # dumbdbm files with no keys are empty ! if sizes == (0, 0): return "dumbdbm" f = open(filename + os.extsep + "dir", "rb") --- 52,59 ---- try: # First check for presence of files ! os.stat(filename + os.extsep + "dat") ! size = os.stat(filename + os.extsep + "dir").st_size # dumbdbm files with no keys are empty ! if size == 0: return "dumbdbm" f = open(filename + os.extsep + "dir", "rb") From loewis@users.sourceforge.net Sat Jun 21 15:15:27 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 21 Jun 2003 07:15:27 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libzlib.tex,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv12845 Modified Files: libzlib.tex Log Message: Patch #640236: Better eplain unused data. Index: libzlib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libzlib.tex,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** libzlib.tex 16 Oct 2001 20:39:49 -0000 1.27 --- libzlib.tex 21 Jun 2003 14:15:25 -0000 1.28 *************** *** 124,137 **** \begin{memberdesc}{unused_data} ! A string which contains any unused data from the last string fed to ! this decompression object. If the whole string turned out to contain ! compressed data, this is \code{""}, the empty string. The only way to determine where a string of compressed data ends is by actually decompressing it. This means that when compressed data is contained part of a larger file, you can only find the end of it by ! reading data and feeding it into a decompression object's ! \method{decompress} method until the \member{unused_data} attribute is ! no longer the empty string. \end{memberdesc} --- 124,138 ---- \begin{memberdesc}{unused_data} ! A string which contains any bytes past the end of the compressed data. ! That is, this remains \code{""} until the last byte that contains ! compression data is available. If the whole string turned out to ! contain compressed data, this is \code{""}, the empty string. The only way to determine where a string of compressed data ends is by actually decompressing it. This means that when compressed data is contained part of a larger file, you can only find the end of it by ! reading data and feeding it followed by some non-empty string into a ! decompression object's \method{decompress} method until the ! \member{unused_data} attribute is no longer the empty string. \end{memberdesc} *************** *** 139,144 **** A string that contains any data that was not consumed by the last \method{decompress} call because it exceeded the limit for the ! uncompressed data buffer. \end{memberdesc} \begin{methoddesc}[Decompress]{decompress}{string}{\optional{max_length}} --- 140,149 ---- A string that contains any data that was not consumed by the last \method{decompress} call because it exceeded the limit for the ! uncompressed data buffer. This data has not yet been seen by the zlib ! machinery, so you must feed it (possibly with further data ! concatenated to it) back to a subsequent \method{decompress} method ! call in order to get correct output. \end{memberdesc} + \begin{methoddesc}[Decompress]{decompress}{string}{\optional{max_length}} From jvr@users.sourceforge.net Sat Jun 21 15:41:35 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Sat, 21 Jun 2003 07:41:35 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac EasyDialogs.py,1.13,1.14 FrameWork.py,1.4,1.5 MiniAEFrame.py,1.2,1.3 argvemulator.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv16652 Modified Files: EasyDialogs.py FrameWork.py MiniAEFrame.py argvemulator.py Log Message: changed 8-space indentation to 4 Index: EasyDialogs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/EasyDialogs.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** EasyDialogs.py 20 May 2003 12:07:19 -0000 1.13 --- EasyDialogs.py 21 Jun 2003 14:41:32 -0000 1.14 *************** *** 39,241 **** __all__ = ['Message', 'AskString', 'AskPassword', 'AskYesNoCancel', ! 'GetArgv', 'AskFileForOpen', 'AskFileForSave', 'AskFolder', ! 'ProgressBar'] _initialized = 0 def _initialize(): ! global _initialized ! if _initialized: return [...1545 lines suppressed...] ! time.sleep(0.05) ! bar.set(0,100) ! for i in xrange(100): ! bar.set(i) ! time.sleep(0.05) ! if i % 10 == 0: ! bar.label(text[(i/10) % 4]) ! bar.label("Done.") ! time.sleep(1.0) # give'em a chance to see "Done." ! finally: ! del bar ! if hasattr(MacOS, 'SchedParams'): ! MacOS.SchedParams(*appsw) if __name__ == '__main__': ! try: ! test() ! except KeyboardInterrupt: ! Message("Operation Canceled.") Index: FrameWork.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/FrameWork.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FrameWork.py 6 Apr 2003 09:00:59 -0000 1.4 --- FrameWork.py 21 Jun 2003 14:41:32 -0000 1.5 *************** *** 30,39 **** try: ! MyFrontWindow = FrontNonFloatingWindow except NameError: ! MyFrontWindow = FrontWindow kHighLevelEvent = 23 # Don't know what header file this should come from ! SCROLLBARWIDTH = 16 # Again, not a clue... # Trick to forestall a set of SIOUX menus being added to our menubar [...2101 lines suppressed...] ! def enablehelp(self, *args): ! hm = self.gethelpmenu() ! self.nohelpitem = MenuItem(hm, "There isn't any", None, self.nohelp) ! def nohelp(self, *args): ! print "I told you there isn't any!" ! def debug(self, *args): ! import pdb ! pdb.set_trace() def test(): ! "Test program" ! app = TestApp() ! app.mainloop() if __name__ == '__main__': ! test() Index: MiniAEFrame.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/MiniAEFrame.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MiniAEFrame.py 6 Apr 2003 09:01:00 -0000 1.2 --- MiniAEFrame.py 21 Jun 2003 14:41:32 -0000 1.3 *************** *** 2,8 **** There are two classes: ! AEServer -- a mixin class offering nice AE handling. ! MiniApplication -- a very minimal alternative to FrameWork.py, ! only suitable for the simplest of AppleEvent servers. """ --- 2,8 ---- There are two classes: ! AEServer -- a mixin class offering nice AE handling. ! MiniApplication -- a very minimal alternative to FrameWork.py, ! only suitable for the simplest of AppleEvent servers. """ *************** *** 22,199 **** import EasyDialogs ! kHighLevelEvent = 23 # Not defined anywhere for Python yet? class MiniApplication: ! """A minimal FrameWork.Application-like class""" ! def __init__(self): ! self.quitting = 0 ! # Initialize menu ! self.appleid = 1 ! self.quitid = 2 ! Menu.ClearMenuBar() ! self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024") ! applemenu.AppendMenu("%s;(-" % self.getaboutmenutext()) ! if MacOS.runtimemodel == 'ppc': ! applemenu.AppendResMenu('DRVR') ! applemenu.InsertMenu(0) ! self.quitmenu = Menu.NewMenu(self.quitid, "File") ! self.quitmenu.AppendMenu("Quit") ! self.quitmenu.SetItemCmd(1, ord("Q")) ! self.quitmenu.InsertMenu(0) ! Menu.DrawMenuBar() ! def __del__(self): ! self.close() ! def close(self): ! pass ! def mainloop(self, mask = everyEvent, timeout = 60*60): ! while not self.quitting: ! self.dooneevent(mask, timeout) ! def _quit(self): ! self.quitting = 1 ! def dooneevent(self, mask = everyEvent, timeout = 60*60): ! got, event = Evt.WaitNextEvent(mask, timeout) ! if got: ! self.lowlevelhandler(event) ! def lowlevelhandler(self, event): ! what, message, when, where, modifiers = event ! h, v = where ! if what == kHighLevelEvent: ! msg = "High Level Event: %s %s" % \ ! (`code(message)`, `code(h | (v<<16))`) ! try: ! AE.AEProcessAppleEvent(event) ! except AE.Error, err: ! print 'AE error: ', err ! print 'in', msg ! traceback.print_exc() ! return ! elif what == keyDown: ! c = chr(message & charCodeMask) ! if modifiers & cmdKey: ! if c == '.': ! raise KeyboardInterrupt, "Command-period" ! if c == 'q': ! if hasattr(MacOS, 'OutputSeen'): ! MacOS.OutputSeen() ! self.quitting = 1 ! return ! elif what == mouseDown: ! partcode, window = Win.FindWindow(where) ! if partcode == inMenuBar: ! result = Menu.MenuSelect(where) ! id = (result>>16) & 0xffff # Hi word ! item = result & 0xffff # Lo word ! if id == self.appleid: ! if item == 1: ! EasyDialogs.Message(self.getabouttext()) ! elif item > 1 and hasattr(Menu, 'OpenDeskAcc'): ! name = self.applemenu.GetMenuItemText(item) ! Menu.OpenDeskAcc(name) ! elif id == self.quitid and item == 1: ! if hasattr(MacOS, 'OutputSeen'): ! MacOS.OutputSeen() ! self.quitting = 1 ! Menu.HiliteMenu(0) ! return ! # Anything not handled is passed to Python/SIOUX ! if hasattr(MacOS, 'HandleEvent'): ! MacOS.HandleEvent(event) ! else: ! print "Unhandled event:", event ! def getabouttext(self): ! return self.__class__.__name__ ! def getaboutmenutext(self): ! return "About %s\311" % self.__class__.__name__ class AEServer: ! def __init__(self): ! self.ae_handlers = {} ! def installaehandler(self, classe, type, callback): ! AE.AEInstallEventHandler(classe, type, self.callback_wrapper) ! self.ae_handlers[(classe, type)] = callback ! def close(self): ! for classe, type in self.ae_handlers.keys(): ! AE.AERemoveEventHandler(classe, type) ! def callback_wrapper(self, _request, _reply): ! _parameters, _attributes = aetools.unpackevent(_request) ! _class = _attributes['evcl'].type ! _type = _attributes['evid'].type ! if self.ae_handlers.has_key((_class, _type)): ! _function = self.ae_handlers[(_class, _type)] ! elif self.ae_handlers.has_key((_class, '****')): ! _function = self.ae_handlers[(_class, '****')] ! elif self.ae_handlers.has_key(('****', '****')): ! _function = self.ae_handlers[('****', '****')] ! else: ! raise 'Cannot happen: AE callback without handler', (_class, _type) ! # XXXX Do key-to-name mapping here ! _parameters['_attributes'] = _attributes ! _parameters['_class'] = _class ! _parameters['_type'] = _type ! if _parameters.has_key('----'): ! _object = _parameters['----'] ! del _parameters['----'] ! # The try/except that used to be here can mask programmer errors. ! # Let the program crash, the programmer can always add a **args ! # to the formal parameter list. ! rv = _function(_object, **_parameters) ! else: ! #Same try/except comment as above ! rv = _function(**_parameters) ! if rv == None: ! aetools.packevent(_reply, {}) ! else: ! aetools.packevent(_reply, {'----':rv}) def code(x): ! "Convert a long int to the 4-character code it really is" ! s = '' ! for i in range(4): ! x, c = divmod(x, 256) ! s = chr(c) + s ! return s class _Test(AEServer, MiniApplication): ! """Mini test application, handles required events""" ! def __init__(self): ! MiniApplication.__init__(self) ! AEServer.__init__(self) ! self.installaehandler('aevt', 'oapp', self.open_app) ! self.installaehandler('aevt', 'quit', self.quit) ! self.installaehandler('****', '****', self.other) ! self.mainloop() ! def quit(self, **args): ! self._quit() ! def open_app(self, **args): ! pass ! def other(self, _object=None, _class=None, _type=None, **args): ! print 'AppleEvent', (_class, _type), 'for', _object, 'Other args:', args if __name__ == '__main__': ! _Test() --- 22,199 ---- import EasyDialogs ! kHighLevelEvent = 23 # Not defined anywhere for Python yet? class MiniApplication: ! """A minimal FrameWork.Application-like class""" ! def __init__(self): ! self.quitting = 0 ! # Initialize menu ! self.appleid = 1 ! self.quitid = 2 ! Menu.ClearMenuBar() ! self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024") ! applemenu.AppendMenu("%s;(-" % self.getaboutmenutext()) ! if MacOS.runtimemodel == 'ppc': ! applemenu.AppendResMenu('DRVR') ! applemenu.InsertMenu(0) ! self.quitmenu = Menu.NewMenu(self.quitid, "File") ! self.quitmenu.AppendMenu("Quit") ! self.quitmenu.SetItemCmd(1, ord("Q")) ! self.quitmenu.InsertMenu(0) ! Menu.DrawMenuBar() ! def __del__(self): ! self.close() ! def close(self): ! pass ! def mainloop(self, mask = everyEvent, timeout = 60*60): ! while not self.quitting: ! self.dooneevent(mask, timeout) ! def _quit(self): ! self.quitting = 1 ! def dooneevent(self, mask = everyEvent, timeout = 60*60): ! got, event = Evt.WaitNextEvent(mask, timeout) ! if got: ! self.lowlevelhandler(event) ! def lowlevelhandler(self, event): ! what, message, when, where, modifiers = event ! h, v = where ! if what == kHighLevelEvent: ! msg = "High Level Event: %s %s" % \ ! (`code(message)`, `code(h | (v<<16))`) ! try: ! AE.AEProcessAppleEvent(event) ! except AE.Error, err: ! print 'AE error: ', err ! print 'in', msg ! traceback.print_exc() ! return ! elif what == keyDown: ! c = chr(message & charCodeMask) ! if modifiers & cmdKey: ! if c == '.': ! raise KeyboardInterrupt, "Command-period" ! if c == 'q': ! if hasattr(MacOS, 'OutputSeen'): ! MacOS.OutputSeen() ! self.quitting = 1 ! return ! elif what == mouseDown: ! partcode, window = Win.FindWindow(where) ! if partcode == inMenuBar: ! result = Menu.MenuSelect(where) ! id = (result>>16) & 0xffff # Hi word ! item = result & 0xffff # Lo word ! if id == self.appleid: ! if item == 1: ! EasyDialogs.Message(self.getabouttext()) ! elif item > 1 and hasattr(Menu, 'OpenDeskAcc'): ! name = self.applemenu.GetMenuItemText(item) ! Menu.OpenDeskAcc(name) ! elif id == self.quitid and item == 1: ! if hasattr(MacOS, 'OutputSeen'): ! MacOS.OutputSeen() ! self.quitting = 1 ! Menu.HiliteMenu(0) ! return ! # Anything not handled is passed to Python/SIOUX ! if hasattr(MacOS, 'HandleEvent'): ! MacOS.HandleEvent(event) ! else: ! print "Unhandled event:", event ! def getabouttext(self): ! return self.__class__.__name__ ! def getaboutmenutext(self): ! return "About %s\311" % self.__class__.__name__ class AEServer: ! def __init__(self): ! self.ae_handlers = {} ! def installaehandler(self, classe, type, callback): ! AE.AEInstallEventHandler(classe, type, self.callback_wrapper) ! self.ae_handlers[(classe, type)] = callback ! def close(self): ! for classe, type in self.ae_handlers.keys(): ! AE.AERemoveEventHandler(classe, type) ! def callback_wrapper(self, _request, _reply): ! _parameters, _attributes = aetools.unpackevent(_request) ! _class = _attributes['evcl'].type ! _type = _attributes['evid'].type ! if self.ae_handlers.has_key((_class, _type)): ! _function = self.ae_handlers[(_class, _type)] ! elif self.ae_handlers.has_key((_class, '****')): ! _function = self.ae_handlers[(_class, '****')] ! elif self.ae_handlers.has_key(('****', '****')): ! _function = self.ae_handlers[('****', '****')] ! else: ! raise 'Cannot happen: AE callback without handler', (_class, _type) ! # XXXX Do key-to-name mapping here ! _parameters['_attributes'] = _attributes ! _parameters['_class'] = _class ! _parameters['_type'] = _type ! if _parameters.has_key('----'): ! _object = _parameters['----'] ! del _parameters['----'] ! # The try/except that used to be here can mask programmer errors. ! # Let the program crash, the programmer can always add a **args ! # to the formal parameter list. ! rv = _function(_object, **_parameters) ! else: ! #Same try/except comment as above ! rv = _function(**_parameters) ! if rv == None: ! aetools.packevent(_reply, {}) ! else: ! aetools.packevent(_reply, {'----':rv}) def code(x): ! "Convert a long int to the 4-character code it really is" ! s = '' ! for i in range(4): ! x, c = divmod(x, 256) ! s = chr(c) + s ! return s class _Test(AEServer, MiniApplication): ! """Mini test application, handles required events""" ! def __init__(self): ! MiniApplication.__init__(self) ! AEServer.__init__(self) ! self.installaehandler('aevt', 'oapp', self.open_app) ! self.installaehandler('aevt', 'quit', self.quit) ! self.installaehandler('****', '****', self.other) ! self.mainloop() ! def quit(self, **args): ! self._quit() ! def open_app(self, **args): ! pass ! def other(self, _object=None, _class=None, _type=None, **args): ! print 'AppleEvent', (_class, _type), 'for', _object, 'Other args:', args if __name__ == '__main__': ! _Test() Index: argvemulator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/argvemulator.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** argvemulator.py 6 Apr 2003 09:01:01 -0000 1.3 --- argvemulator.py 21 Jun 2003 14:41:32 -0000 1.4 *************** *** 13,114 **** class ArgvCollector: ! """A minimal FrameWork.Application-like class""" ! def __init__(self): ! self.quitting = 0 ! self.ae_handlers = {} ! # Remove the funny -psn_xxx_xxx argument ! if len(sys.argv) > 1 and sys.argv[1][:4] == '-psn': ! del sys.argv[1] ! self.installaehandler('aevt', 'oapp', self.open_app) ! self.installaehandler('aevt', 'odoc', self.open_file) ! def installaehandler(self, classe, type, callback): ! AE.AEInstallEventHandler(classe, type, self.callback_wrapper) ! self.ae_handlers[(classe, type)] = callback ! def close(self): ! for classe, type in self.ae_handlers.keys(): ! AE.AERemoveEventHandler(classe, type) ! def mainloop(self, mask = highLevelEventMask, timeout = 1*60): ! stoptime = Evt.TickCount() + timeout ! while not self.quitting and Evt.TickCount() < stoptime: ! self.dooneevent(mask, timeout) ! self.close() ! def _quit(self): ! self.quitting = 1 ! def dooneevent(self, mask = highLevelEventMask, timeout = 1*60): ! got, event = Evt.WaitNextEvent(mask, timeout) ! if got: ! self.lowlevelhandler(event) ! def lowlevelhandler(self, event): ! what, message, when, where, modifiers = event ! h, v = where ! if what == kHighLevelEvent: ! try: ! AE.AEProcessAppleEvent(event) ! except AE.Error, err: ! msg = "High Level Event: %s %s" % \ ! (`hex(message)`, `hex(h | (v<<16))`) ! print 'AE error: ', err ! print 'in', msg ! traceback.print_exc() ! return ! else: ! print "Unhandled event:", event ! def callback_wrapper(self, _request, _reply): ! _parameters, _attributes = aetools.unpackevent(_request) ! _class = _attributes['evcl'].type ! _type = _attributes['evid'].type ! if self.ae_handlers.has_key((_class, _type)): ! _function = self.ae_handlers[(_class, _type)] ! elif self.ae_handlers.has_key((_class, '****')): ! _function = self.ae_handlers[(_class, '****')] ! elif self.ae_handlers.has_key(('****', '****')): ! _function = self.ae_handlers[('****', '****')] ! else: ! raise 'Cannot happen: AE callback without handler', (_class, _type) ! # XXXX Do key-to-name mapping here ! _parameters['_attributes'] = _attributes ! _parameters['_class'] = _class ! _parameters['_type'] = _type ! if _parameters.has_key('----'): ! _object = _parameters['----'] ! del _parameters['----'] ! # The try/except that used to be here can mask programmer errors. ! # Let the program crash, the programmer can always add a **args ! # to the formal parameter list. ! rv = _function(_object, **_parameters) ! else: ! #Same try/except comment as above ! rv = _function(**_parameters) ! if rv == None: ! aetools.packevent(_reply, {}) ! else: ! aetools.packevent(_reply, {'----':rv}) ! def open_app(self, **args): ! self._quit() ! def open_file(self, _object=None, **args): ! for alias in _object: ! fsr = alias.FSResolveAlias(None)[0] ! pathname = fsr.as_pathname() ! sys.argv.append(pathname) ! self._quit() ! def other(self, _object=None, _class=None, _type=None, **args): ! print 'Ignore AppleEvent', (_class, _type), 'for', _object, 'Other args:', args if __name__ == '__main__': ! ArgvCollector().mainloop() ! print "sys.argv=", sys.argv --- 13,114 ---- class ArgvCollector: ! """A minimal FrameWork.Application-like class""" ! def __init__(self): ! self.quitting = 0 ! self.ae_handlers = {} ! # Remove the funny -psn_xxx_xxx argument ! if len(sys.argv) > 1 and sys.argv[1][:4] == '-psn': ! del sys.argv[1] ! self.installaehandler('aevt', 'oapp', self.open_app) ! self.installaehandler('aevt', 'odoc', self.open_file) ! def installaehandler(self, classe, type, callback): ! AE.AEInstallEventHandler(classe, type, self.callback_wrapper) ! self.ae_handlers[(classe, type)] = callback ! def close(self): ! for classe, type in self.ae_handlers.keys(): ! AE.AERemoveEventHandler(classe, type) ! def mainloop(self, mask = highLevelEventMask, timeout = 1*60): ! stoptime = Evt.TickCount() + timeout ! while not self.quitting and Evt.TickCount() < stoptime: ! self.dooneevent(mask, timeout) ! self.close() ! def _quit(self): ! self.quitting = 1 ! def dooneevent(self, mask = highLevelEventMask, timeout = 1*60): ! got, event = Evt.WaitNextEvent(mask, timeout) ! if got: ! self.lowlevelhandler(event) ! def lowlevelhandler(self, event): ! what, message, when, where, modifiers = event ! h, v = where ! if what == kHighLevelEvent: ! try: ! AE.AEProcessAppleEvent(event) ! except AE.Error, err: ! msg = "High Level Event: %s %s" % \ ! (`hex(message)`, `hex(h | (v<<16))`) ! print 'AE error: ', err ! print 'in', msg ! traceback.print_exc() ! return ! else: ! print "Unhandled event:", event ! def callback_wrapper(self, _request, _reply): ! _parameters, _attributes = aetools.unpackevent(_request) ! _class = _attributes['evcl'].type ! _type = _attributes['evid'].type ! if self.ae_handlers.has_key((_class, _type)): ! _function = self.ae_handlers[(_class, _type)] ! elif self.ae_handlers.has_key((_class, '****')): ! _function = self.ae_handlers[(_class, '****')] ! elif self.ae_handlers.has_key(('****', '****')): ! _function = self.ae_handlers[('****', '****')] ! else: ! raise 'Cannot happen: AE callback without handler', (_class, _type) ! # XXXX Do key-to-name mapping here ! _parameters['_attributes'] = _attributes ! _parameters['_class'] = _class ! _parameters['_type'] = _type ! if _parameters.has_key('----'): ! _object = _parameters['----'] ! del _parameters['----'] ! # The try/except that used to be here can mask programmer errors. ! # Let the program crash, the programmer can always add a **args ! # to the formal parameter list. ! rv = _function(_object, **_parameters) ! else: ! #Same try/except comment as above ! rv = _function(**_parameters) ! if rv == None: ! aetools.packevent(_reply, {}) ! else: ! aetools.packevent(_reply, {'----':rv}) ! def open_app(self, **args): ! self._quit() ! def open_file(self, _object=None, **args): ! for alias in _object: ! fsr = alias.FSResolveAlias(None)[0] ! pathname = fsr.as_pathname() ! sys.argv.append(pathname) ! self._quit() ! def other(self, _object=None, _class=None, _type=None, **args): ! print 'Ignore AppleEvent', (_class, _type), 'for', _object, 'Other args:', args if __name__ == '__main__': ! ArgvCollector().mainloop() ! print "sys.argv=", sys.argv From goodger@users.sourceforge.net Sat Jun 21 15:43:20 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Sat, 21 Jun 2003 07:43:20 -0700 Subject: [Python-checkins] python/nondist/peps pep-0258.txt,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv16983 Modified Files: pep-0258.txt Log Message: updated Index: pep-0258.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0258.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pep-0258.txt 8 Nov 2002 04:26:56 -0000 1.5 --- pep-0258.txt 21 Jun 2003 14:43:18 -0000 1.6 *************** *** 187,191 **** the document tree. Transforms change the document tree from one form to another, add to the tree, or prune it. Transforms resolve ! references and footnote numbers, processing interpreted text, and do other context-sensitive processing. --- 187,191 ---- the document tree. Transforms change the document tree from one form to another, add to the tree, or prune it. Transforms resolve ! references and footnote numbers, process interpreted text, and do other context-sensitive processing. *************** *** 367,377 **** classes. See `Document Tree`_ below. - - Module "docutils.optik" provides option parsing and command-line - help; from Greg Ward's http://optik.sf.net/ project, included for - convenience. - - - Module "docutils.roman" contains Roman numeral conversion - routines. - - Module "docutils.statemachine" contains a finite state machine specialized for regular-expression-based text filters and parsers. --- 367,370 ---- *************** *** 451,464 **** language-dependent strings and mappings. They are named for their language identifier (as defined in `Choice of Docstring Format`_ ! above), converting dashes to underscores. - Function "get_language(language_code)", returns matching language module. (``docutils/languages/__init__.py``) ! - Modules: en.py (English), de.py (German), fr.py (French), sk.py ! (Slovak), sv.py (Swedish). - Other languages to be added. Front-End Tools --- 444,467 ---- language-dependent strings and mappings. They are named for their language identifier (as defined in `Choice of Docstring Format`_ ! below), converting dashes to underscores. - Function "get_language(language_code)", returns matching language module. (``docutils/languages/__init__.py``) ! - Modules: en.py (English), de.py (German), fr.py (French), it.py ! (Italian), sk.py (Slovak), sv.py (Swedish). - Other languages to be added. + * Third-party modules: "extras" directory. These modules are + installed only if they're not already present in the Python + installation. + + - ``extras/optparse.py`` and ``extras/textwrap.py`` provide + option parsing and command-line help; from Greg Ward's + http://optik.sf.net/ project, included for convenience. + + - ``extras/roman.py`` contains Roman numeral conversion routines. + Front-End Tools *************** *** 714,718 **** c) At the top level of the "``__init__``" method definition of a ! class: an instance attribute. (@@@ ``__new__`` methods?) Since each of the above contexts are at the top level (i.e., in the --- 717,726 ---- c) At the top level of the "``__init__``" method definition of a ! class: an instance attribute. Instance attributes assigned in ! other methods are assumed to be implementation details. (@@@ ! ``__new__`` methods?) ! ! d) A function attribute assignment at the top level of a module or ! class definition. Since each of the above contexts are at the top level (i.e., in the *************** *** 735,738 **** --- 743,751 ---- is a simple identifier as in 3a. + c) For context 1d above, the target must be of the form + "``name.attrib``", where "``name``" matches an already-defined + function or method name and "attrib" is a simple identifier as + in 3a. + Blank lines may be used after attribute docstrings to emphasize the connection between the assignment and the docstring. *************** *** 749,754 **** --- 762,776 ---- def __init__(self): + """Method __init__'s docstring.""" + self.i = 'instance attribute' """This is self.i's docstring.""" + + def f(x): + """Function f's docstring.""" + return x**2 + + f.a = 1 + """Function attribute f.a's docstring.""" From jvr@users.sourceforge.net Sat Jun 21 15:49:16 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Sat, 21 Jun 2003 07:49:16 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac terminalcommand.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv17982 Modified Files: terminalcommand.py Log Message: some old changes to this unused module Index: terminalcommand.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/terminalcommand.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** terminalcommand.py 4 Jan 2003 21:44:21 -0000 1.1 --- terminalcommand.py 21 Jun 2003 14:49:14 -0000 1.2 *************** *** 29,39 **** """Run a shell command in a new Terminal.app window.""" termAddress = AE.AECreateDesc(typeApplSignature, TERMINAL_SIG) ! theEvent = AE.AECreateAppleEvent(kAEMiscStandards, kAEActivate, ! termAddress, kAutoGenerateReturnID, ! kAnyTransactionID) try: ! theEvent.AESend(SEND_MODE, kAENormalPriority, ! kAEDefaultTimeout) except AE.Error, why: if why[0] != -600: # Terminal.app not yet running --- 29,39 ---- """Run a shell command in a new Terminal.app window.""" termAddress = AE.AECreateDesc(typeApplSignature, TERMINAL_SIG) ! theEvent = AE.AECreateAppleEvent(kAECoreSuite, kAEDoScript, termAddress, ! kAutoGenerateReturnID, kAnyTransactionID) ! commandDesc = AE.AECreateDesc(typeChar, command) ! theEvent.AEPutParamDesc(kAECommandClass, commandDesc) try: ! theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout) except AE.Error, why: if why[0] != -600: # Terminal.app not yet running *************** *** 41,52 **** os.system(START_TERMINAL) time.sleep(1) ! theEvent.AESend(SEND_MODE, kAENormalPriority, ! kAEDefaultTimeout) ! ! theEvent = AE.AECreateAppleEvent(kAECoreSuite, kAEDoScript, termAddress, ! kAutoGenerateReturnID, kAnyTransactionID) ! commandDesc = AE.AECreateDesc(typeChar, command) ! theEvent.AEPutParamDesc(kAECommandClass, commandDesc) ! theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout) --- 41,45 ---- os.system(START_TERMINAL) time.sleep(1) ! theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout) From montanaro@users.sourceforge.net Sat Jun 21 16:59:03 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sat, 21 Jun 2003 08:59:03 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.23,1.23.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv26430 Modified Files: Tag: release22-maint test_socket.py Log Message: check getservbyname with several protocols, not just telnet Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.23 retrieving revision 1.23.6.1 diff -C2 -d -r1.23 -r1.23.6.1 *** test_socket.py 9 Dec 2001 08:57:46 -0000 1.23 --- test_socket.py 21 Jun 2003 15:59:01 -0000 1.23.6.1 *************** *** 85,93 **** if hasattr(socket, 'getservbyname'): ! print socket.getservbyname('telnet', 'tcp') try: ! socket.getservbyname('telnet', 'udp') ! except socket.error: pass import sys --- 85,102 ---- if hasattr(socket, 'getservbyname'): ! # try a few protocols - not everyone has telnet enabled ! class Found(Exception): pass try: ! for proto in ("telnet", "ssh", "www", "ftp"): ! for how in ("tcp", "udp"): ! try: ! socket.getservbyname(proto, how) ! raise Found ! except socket.error: ! pass ! except Found: pass + else: + print "socket.error", "socket.getservbyname failed" import sys From montanaro@users.sourceforge.net Sat Jun 21 16:59:15 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sat, 21 Jun 2003 08:59:15 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_socket,1.2,1.2.30.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1:/tmp/cvs-serv26473 Modified Files: Tag: release22-maint test_socket Log Message: check getservbyname with several protocols, not just telnet Index: test_socket =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/Attic/test_socket,v retrieving revision 1.2 retrieving revision 1.2.30.1 diff -C2 -d -r1.2 -r1.2.30.1 *** test_socket 9 May 1997 01:54:45 -0000 1.2 --- test_socket 21 Jun 2003 15:59:13 -0000 1.2.30.1 *************** *** 1,3 **** test_socket socket.error - 23 --- 1,2 ---- From montanaro@users.sourceforge.net Sat Jun 21 17:13:51 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sat, 21 Jun 2003 09:13:51 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.70.4.5,1.70.4.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv28255 Modified Files: Tag: release22-maint regrtest.py Log Message: backport -uall,-resource stuff add sunos5 and hpux11 expected skips Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.70.4.5 retrieving revision 1.70.4.6 diff -C2 -d -r1.70.4.5 -r1.70.4.6 *** regrtest.py 7 Jun 2003 20:02:27 -0000 1.70.4.5 --- regrtest.py 21 Jun 2003 16:13:49 -0000 1.70.4.6 *************** *** 25,49 **** -v is incompatible with -g and does not compare test output files. ! -s means to run only a single test and exit. This is useful when doing memory ! analysis on the Python interpreter (which tend to consume to many resources to ! run the full regression test non-stop). The file /tmp/pynexttest is read to ! find the next test to run. If this file is missing, the first test_*.py file ! in testdir or on the command line is used. (actually tempfile.gettempdir() is ! used instead of /tmp). ! -u is used to specify which special resource intensive tests to run, such as ! those requiring large file support or network connectivity. The argument is a ! comma-separated list of words indicating the resources to test. Currently ! only the following are defined: curses - Tests that use curses and will modify the terminal's state and output modes. ! largefile - It is okay to run some test that may create huge files. These ! tests can take a long time and may consume >2GB of disk space ! temporarily. ! network - It is okay to run tests that use external network resource, ! e.g. testing SSL support for sockets. """ --- 25,56 ---- -v is incompatible with -g and does not compare test output files. ! -s means to run only a single test and exit. This is useful when ! doing memory analysis on the Python interpreter (which tend to consume ! too many resources to run the full regression test non-stop). The ! file /tmp/pynexttest is read to find the next test to run. If this ! file is missing, the first test_*.py file in testdir or on the command ! line is used. (actually tempfile.gettempdir() is used instead of ! /tmp). ! -u is used to specify which special resource intensive tests to run, ! such as those requiring large file support or network connectivity. ! The argument is a comma-separated list of words indicating the ! resources to test. Currently only the following are defined: ! ! all - Enable all special resources. curses - Tests that use curses and will modify the terminal's state and output modes. ! largefile - It is okay to run some test that may create huge ! files. These tests can take a long time and may ! consume >2GB of disk space temporarily. ! network - It is okay to run tests that use external network ! resource, e.g. testing SSL support for sockets. ! ! To enable all resources except one, use '-uall,-'. For ! example, to run all the tests except for the network tests, give the ! option '-uall,-network'. """ *************** *** 57,60 **** --- 64,70 ---- import test_support + RESOURCE_NAMES = ['curses', 'largefile', 'network'] + + def usage(code, msg=''): print __doc__ *************** *** 82,89 **** files beginning with test_ will be used. ! The other default arguments (verbose, quiet, generate, exclude, single, ! randomize, findleaks, and use_resources) allow programmers calling main() ! directly to set the values that would normally be set by flags on the ! command line. """ --- 92,99 ---- files beginning with test_ will be used. ! The other default arguments (verbose, quiet, generate, exclude, ! single, randomize, findleaks, and use_resources) allow programmers ! calling main() directly to set the values that would normally be ! set by flags on the command line. """ *************** *** 122,128 **** u = [x.lower() for x in a.split(',')] for r in u: ! if r not in ('curses', 'largefile', 'network'): ! usage(1, 'Invalid -u/--use option: %s' % a) ! use_resources.extend(u) if generate and verbose: usage(2, "-g and -v don't go together!") --- 132,149 ---- u = [x.lower() for x in a.split(',')] for r in u: ! if r == 'all': ! use_resources[:] = RESOURCE_NAMES ! continue ! remove = False ! if r[0] == '-': ! remove = True ! r = r[1:] ! if r not in RESOURCE_NAMES: ! usage(1, 'Invalid -u/--use option: ' + a) ! if remove: ! if r in use_resources: ! use_resources.remove(r) ! elif r not in use_resources: ! use_resources.append(r) if generate and verbose: usage(2, "-g and -v don't go together!") *************** *** 316,320 **** except (ImportError, test_support.TestSkipped), msg: if not quiet: ! print "test", test, "skipped --", msg sys.stdout.flush() return -1 --- 337,341 ---- except (ImportError, test_support.TestSkipped), msg: if not quiet: ! print test, "skipped --", msg sys.stdout.flush() return -1 *************** *** 526,530 **** test_winsound """, ! 'mac': """ test_al --- 547,551 ---- test_winsound """, ! 'mac': """ test_al *************** *** 715,718 **** --- 736,785 ---- test_winreg test_winsound + """, + 'sunos5': + """ + test_al + test_bsddb + test_cd + test_cl + test_curses + test_dbm + test_email_codecs + test_gdbm + test_gl + test_gzip + test_imgfile + test_linuxaudiodev + test_mpz + test_openpty + test_socketserver + test_zipfile + test_zlib + """, + 'hp-ux11': + """ + test_al + test_bsddb + test_cd + test_cl + test_curses + test_dl + test_gdbm + test_gl + test_gzip + test_imgfile + test_largefile + test_linuxaudiodev + test_locale + test_minidom + test_nis + test_ntpath + test_openpty + test_pyexpat + test_sax + test_socketserver + test_sunaudiodev + test_zipfile + test_zlib """, 'freebsd4': From jhylton@users.sourceforge.net Sat Jun 21 22:35:27 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sat, 21 Jun 2003 14:35:27 -0700 Subject: [Python-checkins] python/dist/src/Python modsupport.c,2.67,2.68 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv2511/Python Modified Files: modsupport.c Log Message: Better error message Index: modsupport.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/modsupport.c,v retrieving revision 2.67 retrieving revision 2.68 diff -C2 -d -r2.67 -r2.68 *** modsupport.c 17 Apr 2003 22:01:10 -0000 2.67 --- modsupport.c 21 Jun 2003 21:35:25 -0000 2.68 *************** *** 515,523 **** { PyObject *dict; ! if (!PyModule_Check(m) || o == NULL) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg"); return -1; } dict = PyModule_GetDict(m); if (dict == NULL) { --- 515,529 ---- { PyObject *dict; ! if (!PyModule_Check(m)) { PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg"); return -1; } + if (!o) { + PyErr_SetString(PyExc_TypeError, + "PyModule_AddObject() needs non-NULL value"); + return -1; + } + dict = PyModule_GetDict(m); if (dict == NULL) { From jackjansen@users.sourceforge.net Sat Jun 21 23:07:18 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat, 21 Jun 2003 15:07:18 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1:/tmp/cvs-serv6058 Modified Files: Makefile Log Message: Give compileall a -d option so it works correctly in the face of DESTDIR being non-null. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** Makefile 20 Jun 2003 14:33:38 -0000 1.44 --- Makefile 21 Jun 2003 22:07:16 -0000 1.45 *************** *** 224,229 **** $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST) ! $(BUILDPYTHON) -Wi -tt $(compileall) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) ! $(BUILDPYTHON) -O -Wi -tt $(compileall) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) # --- 224,229 ---- $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST) ! $(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) ! $(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) # From tim_one@users.sourceforge.net Sun Jun 22 02:42:22 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 21 Jun 2003 18:42:22 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.788,1.789 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv26456/Misc Modified Files: NEWS Log Message: 2.3b2 on Windows will ship with Tcl/Tk 8.4.3. Note: this still didn't fix the hangs on Win98SE when starting IDLE via "python" from a DOS box, but did appear to make them harder to provoke. I closed that bug report as being hopeless (and if someone wants to open it again, don't dare assign it to me again <0.1 wink>). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.788 retrieving revision 1.789 diff -C2 -d -r1.788 -r1.789 *** NEWS 17 Jun 2003 12:58:30 -0000 1.788 --- NEWS 22 Jun 2003 01:42:19 -0000 1.789 *************** *** 171,174 **** --- 171,176 ---- ------- + - The Windows installer ships with Tcl/Tk 8.4.3 (upgraded from 8.4.1). + - The installer always suggested that Python be installed on the C: drive, due to a hardcoded "C:" generated by the Wise installation From tim_one@users.sourceforge.net Sun Jun 22 02:42:22 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 21 Jun 2003 18:42:22 -0700 Subject: [Python-checkins] python/dist/src/PCbuild readme.txt,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv26456/PCbuild Modified Files: readme.txt Log Message: 2.3b2 on Windows will ship with Tcl/Tk 8.4.3. Note: this still didn't fix the hangs on Win98SE when starting IDLE via "python" from a DOS box, but did appear to make them harder to provoke. I closed that bug report as being hopeless (and if someone wants to open it again, don't dare assign it to me again <0.1 wink>). Index: readme.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/readme.txt,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** readme.txt 21 Mar 2003 01:55:41 -0000 1.41 --- readme.txt 22 Jun 2003 01:42:20 -0000 1.42 *************** *** 77,81 **** _tkinter Python wrapper for the Tk windowing system. Requires building ! Tcl/Tk first. Following are instructions for Tcl/Tk 8.4.1: Get source --- 77,81 ---- _tkinter Python wrapper for the Tk windowing system. Requires building ! Tcl/Tk first. Following are instructions for Tcl/Tk 8.4.3: Get source *************** *** 84,97 **** http://prdownloads.sourceforge.net/tcl/ and download ! tcl841-src.zip ! tk841-src.zip Unzip into ! dist\tcl8.4.1\ ! dist\tk8.4.1\ respectively. ! Build Tcl first (done here w/ MSVC 6 on Win2K; also Win98SE) --------------- ! cd dist\tcl8.4.1\win run vcvars32.bat [necessary even on Win2K] nmake -f makefile.vc --- 84,97 ---- http://prdownloads.sourceforge.net/tcl/ and download ! tcl843-src.zip ! tk843-src.zip Unzip into ! dist\tcl8.4.3\ ! dist\tk8.4.3\ respectively. ! Build Tcl first (done here w/ MSVC 6 on Win98SE) --------------- ! cd dist\tcl8.4.3\win run vcvars32.bat [necessary even on Win2K] nmake -f makefile.vc *************** *** 101,114 **** XXX Some tests failed in "nmake -f makefile.vc test". Build Tk -------- ! cd dist\tk8.4.1\win ! nmake -f makefile.vc TCLDIR=..\..\tcl8.4.1 ! nmake -f makefile.vc TCLDIR=..\..\tcl8.4.1 INSTALLDIR=..\..\tcl84 install XXX Should we compile with OPTS=threads? ! XXX Some tests failed in "nmake -f makefile.vc test". XXX Our installer copies a lot of stuff out of the Tcl/Tk install --- 101,117 ---- XXX Some tests failed in "nmake -f makefile.vc test". + XXX all.tcl: Total 10480 Passed 9743 Skipped 719 Failed 18 Build Tk -------- ! cd dist\tk8.4.3\win ! nmake -f makefile.vc TCLDIR=..\..\tcl8.4.3 ! nmake -f makefile.vc TCLDIR=..\..\tcl8.4.3 INSTALLDIR=..\..\tcl84 install XXX Should we compile with OPTS=threads? ! XXX I have no idea whether "nmake -f makefile.vc test" passed or ! XXX failed. It popped up tons of little windows, and did lots of ! XXX stuff, and nothing blew up. XXX Our installer copies a lot of stuff out of the Tcl/Tk install From loewis@users.sourceforge.net Sun Jun 22 08:52:58 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 22 Jun 2003 00:52:58 -0700 Subject: [Python-checkins] python/dist/src/Lib/idlelib PyShell.py,1.77,1.78 run.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv25987/Lib/idlelib Modified Files: PyShell.py run.py Log Message: Idlefork patch #682347: convert Unicode strings from readline to IOBinding.encoding. Also set sys.std{in,out,err}.encoding, for both the local and the subprocess case. Index: PyShell.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/PyShell.py,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** PyShell.py 15 Jun 2003 17:38:45 -0000 1.77 --- PyShell.py 22 Jun 2003 07:52:56 -0000 1.78 *************** *** 742,748 **** self.save_stderr = sys.stderr self.save_stdin = sys.stdin ! self.stdout = PseudoFile(self, "stdout") ! self.stderr = PseudoFile(self, "stderr") ! self.console = PseudoFile(self, "console") if not use_subprocess: sys.stdout = self.stdout --- 742,749 ---- self.save_stderr = sys.stderr self.save_stdin = sys.stdin ! import IOBinding ! self.stdout = PseudoFile(self, "stdout", IOBinding.encoding) ! self.stderr = PseudoFile(self, "stderr", IOBinding.encoding) ! self.console = PseudoFile(self, "console", IOBinding.encoding) if not use_subprocess: sys.stdout = self.stdout *************** *** 887,890 **** --- 888,897 ---- self.reading = save line = self.text.get("iomark", "end-1c") + if isinstance(line, unicode): + import IOBinding + try: + line = line.encode(IOBinding.encoding) + except UnicodeError: + pass self.resetoutput() if self.canceled: *************** *** 1091,1098 **** class PseudoFile: ! def __init__(self, shell, tags): self.shell = shell self.tags = tags self.softspace = 0 def write(self, s): --- 1098,1106 ---- class PseudoFile: ! def __init__(self, shell, tags, encoding=None): self.shell = shell self.tags = tags self.softspace = 0 + self.encoding = encoding def write(self, s): Index: run.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/run.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** run.py 14 Jun 2003 03:33:20 -0000 1.24 --- run.py 22 Jun 2003 07:52:56 -0000 1.25 *************** *** 211,214 **** --- 211,217 ---- sys.stdout = self.get_remote_proxy("stdout") sys.stderr = self.get_remote_proxy("stderr") + import IOBinding + sys.stdin.encoding = sys.stdout.encoding = \ + sys.stderr.encoding = IOBinding.encoding self.interp = self.get_remote_proxy("interp") rpc.RPCHandler.getresponse(self, myseq=None, wait=0.05) From rhettinger@users.sourceforge.net Mon Jun 23 14:36:59 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 23 Jun 2003 06:36:59 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_compile,1.3,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1:/tmp/cvs-serv25283/output Removed Files: test_compile Log Message: SF patch #736962. Converted test_compile to unittest format. --- test_compile DELETED --- From rhettinger@users.sourceforge.net Mon Jun 23 14:36:58 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 23 Jun 2003 06:36:58 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_compile.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv25283 Modified Files: test_compile.py Log Message: SF patch #736962. Converted test_compile to unittest format. Index: test_compile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_compile.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** test_compile.py 20 Jun 2003 18:41:26 -0000 1.18 --- test_compile.py 23 Jun 2003 13:36:55 -0000 1.19 *************** *** 1,163 **** ! from test.test_support import verbose, TestFailed ! ! if verbose: ! print "Testing whether compiler catches assignment to __debug__" ! ! try: ! compile('__debug__ = 1', '?', 'single') ! except SyntaxError: ! pass ! ! import __builtin__ ! prev = __builtin__.__debug__ ! setattr(__builtin__, '__debug__', 'sure') ! setattr(__builtin__, '__debug__', prev) ! ! if verbose: ! print 'Running tests on argument handling' ! ! try: ! exec 'def f(a, a): pass' ! raise TestFailed, "duplicate arguments" ! except SyntaxError: ! pass ! ! if verbose: ! print "compiling string with syntax error" ! ! try: ! compile("1+*3", "filename", "exec") ! except SyntaxError, detail: ! if not detail.filename == "filename": ! raise TestFailed, "expected 'filename', got %r" % detail.filename ! ! try: ! exec 'def f(a = 0, a = 1): pass' ! raise TestFailed, "duplicate keyword arguments" ! except SyntaxError: ! pass ! ! try: ! exec 'def f(a): global a; a = 1' ! raise TestFailed, "variable is global and local" ! except SyntaxError: ! pass ! ! if verbose: ! print "testing complex args" ! ! def comp_args((a, b)): ! print a,b ! comp_args((1, 2)) ! def comp_args((a, b)=(3, 4)): ! print a, b ! comp_args((1, 2)) ! comp_args() ! def comp_args(a, (b, c)): ! print a, b, c ! comp_args(1, (2, 3)) ! def comp_args(a=2, (b, c)=(3, 4)): ! print a, b, c ! comp_args(1, (2, 3)) ! comp_args() ! try: ! exec 'def f(a=1, (b, c)): pass' ! raise TestFailed, "non-default args after default" ! except SyntaxError: ! pass ! if verbose: ! print "testing bad float literals" ! def expect_error(s): ! try: ! eval(s) ! raise TestFailed("%r accepted" % s) ! except SyntaxError: ! pass ! expect_error("2e") ! expect_error("2.0e+") ! expect_error("1e-") ! expect_error("3-4e/21") ! if verbose: ! print "testing compile() of indented block w/o trailing newline" ! s = """ if 1: if 2: pass""" ! compile(s, "", "exec") ! if verbose: ! print "testing literals with leading zeroes" ! def expect_same(test_source, expected): ! got = eval(test_source) ! if got != expected: ! raise TestFailed("eval(%r) gave %r, but expected %r" % ! (test_source, got, expected)) ! expect_error("077787") ! expect_error("0xj") ! expect_error("0x.") ! expect_error("0e") ! expect_same("0777", 511) ! expect_same("0777L", 511) ! expect_same("000777", 511) ! expect_same("0xff", 255) ! expect_same("0xffL", 255) ! expect_same("0XfF", 255) ! expect_same("0777.", 777) ! expect_same("0777.0", 777) ! expect_same("000000000000000000000000000000000000000000000000000777e0", 777) ! expect_same("0777e1", 7770) ! expect_same("0e0", 0) ! expect_same("0000E-012", 0) ! expect_same("09.5", 9.5) ! expect_same("0777j", 777j) ! expect_same("00j", 0j) ! expect_same("00.0", 0) ! expect_same("0e3", 0) ! expect_same("090000000000000.", 90000000000000.) ! expect_same("090000000000000.0000000000000000000000", 90000000000000.) ! expect_same("090000000000000e0", 90000000000000.) ! expect_same("090000000000000e-0", 90000000000000.) ! expect_same("090000000000000j", 90000000000000j) ! expect_error("090000000000000") # plain octal literal w/ decimal digit ! expect_error("080000000000000") # plain octal literal w/ decimal digit ! expect_error("000000000000009") # plain octal literal w/ decimal digit ! expect_error("000000000000008") # plain octal literal w/ decimal digit ! expect_same("000000000000007", 7) ! expect_same("000000000000008.", 8.) ! expect_same("000000000000009.", 9.) - # Verify treatment of unary minus on negative numbers SF bug #660455 - import warnings - warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning) - warnings.filterwarnings("ignore", "hex.* of negative int", FutureWarning) - # XXX Of course the following test will have to be changed in Python 2.4 - # This test is in a so the filterwarnings() can affect it - import sys - all_one_bits = '0xffffffff' - if sys.maxint != 2147483647: - all_one_bits = '0xffffffffffffffff' - exec """ - expect_same(all_one_bits, -1) - expect_same("-" + all_one_bits, 1) - """ ! # Verify sequence packing/unpacking with "or". SF bug #757818 ! i,j = (1, -1) or (-1, 1) ! if i != 1 or j != -1: ! raise TestFailed, "Sequence packing/unpacking" --- 1,143 ---- ! import unittest ! import warnings ! import sys ! from test import test_support ! class TestSpecifics(unittest.TestCase): ! def test_debug_assignment(self): ! # catch assignments to __debug__ ! self.assertRaises(SyntaxError, compile, '__debug__ = 1', '?', 'single') ! import __builtin__ ! prev = __builtin__.__debug__ ! setattr(__builtin__, '__debug__', 'sure') ! setattr(__builtin__, '__debug__', prev) ! def test_argument_handling(self): ! # detect duplicate positional and keyword arguments ! self.assertRaises(SyntaxError, eval, 'lambda a,a:0') ! self.assertRaises(SyntaxError, eval, 'lambda a,a=1:0') ! self.assertRaises(SyntaxError, eval, 'lambda a=1,a=1:0') ! try: ! exec 'def f(a, a): pass' ! self.fail("duplicate arguments") ! except SyntaxError: ! pass ! try: ! exec 'def f(a = 0, a = 1): pass' ! self.fail("duplicate keyword arguments") ! except SyntaxError: ! pass ! try: ! exec 'def f(a): global a; a = 1' ! self.fail("variable is global and local") ! except SyntaxError: ! pass ! def test_syntax_error(self): ! self.assertRaises(SyntaxError, compile, "1+*3", "filename", "exec") ! def test_duplicate_global_local(self): ! try: ! exec 'def f(a): global a; a = 1' ! self.fail("variable is global and local") ! except SyntaxError: ! pass ! def test_complex_args(self): ! def comp_args((a, b)): ! return a,b ! self.assertEqual(comp_args((1, 2)), (1, 2)) ! def comp_args((a, b)=(3, 4)): ! return a, b ! self.assertEqual(comp_args((1, 2)), (1, 2)) ! self.assertEqual(comp_args(), (3, 4)) ! def comp_args(a, (b, c)): ! return a, b, c ! self.assertEqual(comp_args(1, (2, 3)), (1, 2, 3)) ! def comp_args(a=2, (b, c)=(3, 4)): ! return a, b, c ! self.assertEqual(comp_args(1, (2, 3)), (1, 2, 3)) ! self.assertEqual(comp_args(), (2, 3, 4)) ! def test_argument_order(self): ! try: ! exec 'def f(a=1, (b, c)): pass' ! self.fail("non-default args after default") ! except SyntaxError: ! pass ! def test_float_literals(self): ! # testing bad float literals ! self.assertRaises(SyntaxError, eval, "2e") ! self.assertRaises(SyntaxError, eval, "2.0e+") ! self.assertRaises(SyntaxError, eval, "1e-") ! self.assertRaises(SyntaxError, eval, "3-4e/21") ! def test_indentation(self): ! # testing compile() of indented block w/o trailing newline" ! s = """ if 1: if 2: pass""" ! compile(s, "", "exec") + def test_literals_with_leading_zeroes(self): + for arg in ["077787", "0xj", "0x.", "0e", "090000000000000", + "080000000000000", "000000000000009", "000000000000008"]: + self.assertRaises(SyntaxError, eval, arg) ! self.assertEqual(eval("0777"), 511) ! self.assertEqual(eval("0777L"), 511) ! self.assertEqual(eval("000777"), 511) ! self.assertEqual(eval("0xff"), 255) ! self.assertEqual(eval("0xffL"), 255) ! self.assertEqual(eval("0XfF"), 255) ! self.assertEqual(eval("0777."), 777) ! self.assertEqual(eval("0777.0"), 777) ! self.assertEqual(eval("000000000000000000000000000000000000000000000000000777e0"), 777) ! self.assertEqual(eval("0777e1"), 7770) ! self.assertEqual(eval("0e0"), 0) ! self.assertEqual(eval("0000E-012"), 0) ! self.assertEqual(eval("09.5"), 9.5) ! self.assertEqual(eval("0777j"), 777j) ! self.assertEqual(eval("00j"), 0j) ! self.assertEqual(eval("00.0"), 0) ! self.assertEqual(eval("0e3"), 0) ! self.assertEqual(eval("090000000000000."), 90000000000000.) ! self.assertEqual(eval("090000000000000.0000000000000000000000"), 90000000000000.) ! self.assertEqual(eval("090000000000000e0"), 90000000000000.) ! self.assertEqual(eval("090000000000000e-0"), 90000000000000.) ! self.assertEqual(eval("090000000000000j"), 90000000000000j) ! self.assertEqual(eval("000000000000007"), 7) ! self.assertEqual(eval("000000000000008."), 8.) ! self.assertEqual(eval("000000000000009."), 9.) ! def test_unary_minus(self): ! # Verify treatment of unary minus on negative numbers SF bug #660455 ! warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning) ! warnings.filterwarnings("ignore", "hex.* of negative int", FutureWarning) ! # XXX Of course the following test will have to be changed in Python 2.4 ! # This test is in a so the filterwarnings() can affect it ! all_one_bits = '0xffffffff' ! if sys.maxint != 2147483647: ! all_one_bits = '0xffffffffffffffff' ! self.assertEqual(eval(all_one_bits), -1) ! self.assertEqual(eval("-" + all_one_bits), 1) ! def test_sequence_unpacking_error(self): ! # Verify sequence packing/unpacking with "or". SF bug #757818 ! i,j = (1, -1) or (-1, 1) ! self.assertEqual(i, 1) ! self.assertEqual(j, -1) ! def test_main(): ! test_support.run_unittest(TestSpecifics) ! ! if __name__ == "__main__": ! test_main() From gstein@users.sourceforge.net Tue Jun 24 07:35:21 2003 From: gstein@users.sourceforge.net (gstein@users.sourceforge.net) Date: Mon, 23 Jun 2003 23:35:21 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.77,1.78 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv13801 Modified Files: httplib.py Log Message: Deal with a couple XXX comments which asked questions. In response to "shouldn't the client close the file?", the answer is "no". The original design behind HTTPConnection is that the client did not have to worry about it. The response would close itself when you read the last of the data from it. This closing also dealt with allowing the connection to perform another request/response (if it was a persistent connection). However... the auto-close behavior broke compatibility with the classic httplib.HTTP class' behavior when a zero-length response body was present. In that situation, the HTTPResponse object was auto-closing it since there was no data present, and for an HTTP/1.0 connection-close socket (or an HTTP/0.9 request) connection, that also ended up closing the socket. When an httplib.HTTP user went to read the socket... boom. A patch to correct the auto-close (for compat with old httplib users) was added in rev 1.22. But for non-zero-length *chunked* bodies, we should keep the auto-close behavior. The library user is not reading the socket (they can't cuz of the chunked response we just got done handling), so they should be immune to the response closing the socket. In fact, I would like to see (one day) the auto-close restored, and the HTTP subclass would simply have a flag to disable that behavior (for back-compat purposes). Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** httplib.py 14 Jun 2003 13:30:53 -0000 1.77 --- httplib.py 24 Jun 2003 06:35:19 -0000 1.78 *************** *** 450,454 **** # we read everything; close the "file" - # XXX Shouldn't the client close the file? self.close() --- 450,453 ---- *************** *** 601,606 **** """ ! # check if a prior response has been completed ! # XXX What if it hasn't? if self.__response and self.__response.isclosed(): self.__response = None --- 600,604 ---- """ ! # if a prior response has been completed, then forget about it. if self.__response and self.__response.isclosed(): self.__response = None *************** *** 744,748 **** "Get the response from the server." ! # check if a prior response has been completed if self.__response and self.__response.isclosed(): self.__response = None --- 742,746 ---- "Get the response from the server." ! # if a prior response has been completed, then forget about it. if self.__response and self.__response.isclosed(): self.__response = None From bwarsaw@users.sourceforge.net Tue Jun 24 21:19:36 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 24 Jun 2003 13:19:36 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Generator.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv1629 Modified Files: Generator.py Log Message: _make_boundary(): A minor optimization suggested by the Timbot. Index: Generator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Generator.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Generator.py 29 May 2003 19:39:33 -0000 1.20 --- Generator.py 24 Jun 2003 20:19:34 -0000 1.21 *************** *** 364,368 **** # Craft a random boundary. If text is given, ensure that the chosen # boundary doesn't appear in the text. ! token = random.randint(0, sys.maxint-1) boundary = ('=' * 15) + (_fmt % token) + '==' if text is None: --- 364,368 ---- # Craft a random boundary. If text is given, ensure that the chosen # boundary doesn't appear in the text. ! token = random.randrange(sys.maxint) boundary = ('=' * 15) + (_fmt % token) + '==' if text is None: From rhettinger@users.sourceforge.net Tue Jun 24 21:29:06 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 24 Jun 2003 13:29:06 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_random.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv2903/test Modified Files: test_random.py Log Message: SF bug #759889: Pickling of Random is broken * Implement __reduce__() to support pickling. * Add a test case to prove a successful roundtrip through pickle. Index: test_random.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_random.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_random.py 3 May 2003 03:38:01 -0000 1.11 --- test_random.py 24 Jun 2003 20:29:04 -0000 1.12 *************** *** 4,7 **** --- 4,8 ---- import random import time + import pickle from math import log, exp, sqrt, pi from sets import Set *************** *** 103,106 **** --- 104,113 ---- self.assertEqual(y1, y2) + def test_pickling(self): + state = pickle.dumps(self.gen) + origseq = [self.gen.random() for i in xrange(10)] + newgen = pickle.loads(state) + restoredseq = [newgen.random() for i in xrange(10)] + self.assertEqual(origseq, restoredseq) class WichmannHill_TestBasicOps(TestBasicOps): From rhettinger@users.sourceforge.net Tue Jun 24 21:29:06 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 24 Jun 2003 13:29:06 -0700 Subject: [Python-checkins] python/dist/src/Lib random.py,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv2903 Modified Files: random.py Log Message: SF bug #759889: Pickling of Random is broken * Implement __reduce__() to support pickling. * Add a test case to prove a successful roundtrip through pickle. Index: random.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/random.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** random.py 19 Jun 2003 03:46:46 -0000 1.50 --- random.py 24 Jun 2003 20:29:04 -0000 1.51 *************** *** 124,127 **** --- 124,130 ---- self.setstate(state) + def __reduce__(self): + return self.__class__, (), self.getstate() + ## -------------------- integer methods ------------------- From skip@pobox.com Tue Jun 24 22:00:26 2003 From: skip@pobox.com (Skip Montanaro) Date: Tue, 24 Jun 2003 16:00:26 -0500 Subject: [Python-checkins] python/dist/src/Lib/test test_random.py,1.11,1.12 In-Reply-To: References: Message-ID: <16120.48106.855357.95081@montanaro.dyndns.org> Raymond> Log Message: Raymond> SF bug #759889: Pickling of Random is broken Raymond> * Implement __reduce__() to support pickling. Raymond> * Add a test case to prove a successful roundtrip through Raymond> pickle. I'm confused. I looked at this briefly this morning and as far as I could tell, random.Random() objects already had a __reduce__ method: % python Python 2.3b1+ (#66, Jun 20 2003, 10:06:31) [GCC 3.1 20020420 (prerelease)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import random >>> r = random.Random() >>> r.__reduce__ >>> r.__reduce__()[0] What am I missing? Skip From python@rcn.com Tue Jun 24 22:13:18 2003 From: python@rcn.com (Raymond Hettinger) Date: Tue, 24 Jun 2003 17:13:18 -0400 Subject: [Python-checkins] python/dist/src/Lib/test test_random.py,1.11,1.12 References: <16120.48106.855357.95081@montanaro.dyndns.org> Message-ID: <005a01c33a95$85aab080$125ffea9@oemcomputer> > Raymond> Log Message: > Raymond> SF bug #759889: Pickling of Random is broken > > Raymond> * Implement __reduce__() to support pickling. > Raymond> * Add a test case to prove a successful roundtrip through > Raymond> pickle. [Skip] > I'm confused. I looked at this briefly this morning and as far as I could > tell, random.Random() objects already had a __reduce__ method: > > % python > Python 2.3b1+ (#66, Jun 20 2003, 10:06:31) > [GCC 3.1 20020420 (prerelease)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import random > >>> r = random.Random() > >>> r.__reduce__ > > >>> r.__reduce__()[0] > The method you are seeing is inherited from object and not only doesn't help, but will fail during pickling. Quoth pep 307: """ New-style classes, whether implemented in C or in Python, inherit a default __reduce__ implementation from the universal base class 'object'. . . . The default __reduce__ implementation will fail at pickling time for built-in types not mentioned above, and for new-style classes implemented in C: if they want to be picklable, they must supply a custom __reduce__ implementation under protocols 0 and 1. """ There is probably a good reason for this, but it would have been nice if object.__reduce__() honored existing implementations of __getstate__. Raymond Raymond Hettinger ################################################################# ################################################################# ################################################################# ##### ##### ##### ################################################################# ################################################################# ################################################################# From doerwalter@users.sourceforge.net Wed Jun 25 14:12:21 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed, 25 Jun 2003 06:12:21 -0700 Subject: [Python-checkins] python/dist/src/Objects iterobject.c,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv26534/Objects Modified Files: iterobject.c Log Message: Whitespace normalization. Index: iterobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/iterobject.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** iterobject.c 17 Mar 2003 19:46:10 -0000 1.15 --- iterobject.c 25 Jun 2003 13:12:18 -0000 1.16 *************** *** 212,218 **** 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ ! 0, /* tp_doc */ ! (traverseproc)calliter_traverse, /* tp_traverse */ ! 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ --- 212,218 ---- 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ ! 0, /* tp_doc */ ! (traverseproc)calliter_traverse, /* tp_traverse */ ! 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ From rhettinger@users.sourceforge.net Wed Jun 25 16:07:47 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 25 Jun 2003 08:07:47 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libpickle.tex,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv12533 Modified Files: libpickle.tex Log Message: SF bug #757822: Additional index items, other minor details * Minor grammatical fix. Index: libpickle.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpickle.tex,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** libpickle.tex 14 May 2003 16:51:46 -0000 1.41 --- libpickle.tex 25 Jun 2003 15:07:45 -0000 1.42 *************** *** 21,26 **** ``serialization'', ``marshalling,''\footnote{Don't confuse this with the \refmodule{marshal} module} or ``flattening'', ! however the preferred term used here is ``pickling'' and ! ``unpickling'' to avoid confusing. This documentation describes both the \module{pickle} module and the --- 21,26 ---- ``serialization'', ``marshalling,''\footnote{Don't confuse this with the \refmodule{marshal} module} or ``flattening'', ! however, to avoid confusion, the terms used here are ``pickling'' and ! ``unpickling''. This documentation describes both the \module{pickle} module and the From rhettinger@users.sourceforge.net Wed Jun 25 19:29:39 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 25 Jun 2003 11:29:39 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.104,1.105 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv21037 Modified Files: ref3.tex Log Message: * Document how descriptors are invoked. * Fix minor parenthesis matching errors in ref3.tex. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** ref3.tex 15 Jun 2003 22:57:44 -0000 1.104 --- ref3.tex 25 Jun 2003 18:29:36 -0000 1.105 *************** *** 482,487 **** Special read-only attributes: \member{im_self} is the class instance object, \member{im_func} is the function object; ! \member{im_class} is the class of \member{im_self} for bound methods, ! or the class that asked for the method for unbound methods); \member{__doc__} is the method's documentation (same as \code{im_func.__doc__}); \member{__name__} is the method name (same as --- 482,487 ---- Special read-only attributes: \member{im_self} is the class instance object, \member{im_func} is the function object; ! \member{im_class} is the class of \member{im_self} for bound methods ! or the class that asked for the method for unbound methods; \member{__doc__} is the method's documentation (same as \code{im_func.__doc__}); \member{__name__} is the method name (same as *************** *** 908,912 **** syntax} is used. This is a slice using two colons, or multiple slices or ellipses separated by commas, e.g., \code{a[i:j:step]}, \code{a[i:j, ! k:l]}, or \code{a[..., i:j])}. They are also created by the built-in \function{slice()}\bifuncindex{slice} function. --- 908,912 ---- syntax} is used. This is a slice using two colons, or multiple slices or ellipses separated by commas, e.g., \code{a[i:j:step]}, \code{a[i:j, ! k:l]}, or \code{a[..., i:j]}. They are also created by the built-in \function{slice()}\bifuncindex{slice} function. *************** *** 1248,1251 **** --- 1248,1311 ---- owner class. \end{methoddesc} + + + \subsubsection{Invoking Descriptors \label{descriptor_invocation}} + + In general, a descriptor is an object attribute with ``binding behavior'', + one whose attribute access has been overridden by methods in the descriptor + protocol: \method{__get__}, \method{__set__}, and \method{__delete__}. + If any of those methods are defined for an object, it is said to be a + descriptor. + + The default behavior for attribute access is to get, set, or delete the + attribute from an object's dictionary. For instance, \code{a.x} has a + lookup chain starting with \code{a.__dict__['x']}, then + \code{type(a).__dict__['x']}, and continuing + through the base classes of \code{type(a)} excluding metaclasses. + + However, if the looked-up value is an object defining one of the descriptor + methods, then Python may override the default behavior and invoke the + descriptor method instead. Where this occurs in the precedence chain depends + on which descriptor methods were defined and how they were called. Note that + descriptors are only invoked for new style objects or classes + (ones that subclass \class{object} or \class{type}). + + The starting point for descriptor invocation is a binding, \code{a.x}. + How the arguments are assembled depends on \code{a}: + + \begin{itemize} + + \item[Direct Call] The simplest and least common call is when user code + directly invokes a descriptor method: \code{x.__get__(a)}. + + \item[Instance Binding] If binding to a new-style object instance, + \code{a.x} is transformed into the call: + \code{type(a).__dict__['x'].__get__(a, type(a))}. + + \item[Class Binding] If binding to a new-style class, \code{A.x} + is transformed into the call: \code{A.__dict__['x'].__get__(None, A)}. + + \item[Super Binding] If \code{a} is an instance of \class{super}, + then the binding \code{super(B, obj).m()} searches + \code{obj.__class__.__mro__} for the base class \code{A} immediately + preceding \code{B} and then invokes the descriptor with the call: + \code{A.__dict__['m'].__get__(obj, A)}. + + \end{itemize} + + For instance bindings, the precedence of descriptor invocation depends + on the which descriptor methods are defined. Data descriptors define + both \method{__get__} and \method{__set__}. Non-data descriptors have + just the \method{__get__} method. Data descriptors always override + a redefinition in an instance dictionary. In contrast, non-data + descriptors can be overridden by instances. + + Python methods (including \function{staticmethod} and \function{classmethod}) + are implemented as non-data descriptors. Accordingly, instances can + redefine and override methods. This allows individual instances to acquire + behaviors that differ from other instances of the same class. + + The \function{property} function is implemented as a data descriptor. + Accordingly, instances cannot override the behavior a property. From rhettinger@users.sourceforge.net Wed Jun 25 20:03:24 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 25 Jun 2003 12:03:24 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.127,1.128 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv27633 Modified Files: libstdtypes.tex Log Message: SF bug #696777: How to make a class iterable using a member generator. * Added a note that a container class can implement the iterator protocol by defining its __iter__() method as a generator. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.127 retrieving revision 1.128 diff -C2 -d -r1.127 -r1.128 *** libstdtypes.tex 17 Jun 2003 16:19:56 -0000 1.127 --- libstdtypes.tex 25 Jun 2003 19:03:22 -0000 1.128 *************** *** 396,399 **** --- 396,405 ---- broken according to this rule.) + Python's generators provide a convenient way to implement the + iterator protocol. If a container object's \method{__iter__()} + method is implemented as a generator, it will automatically + return an iterator object (technically, a generator object) + supplying the \method{__iter__()} and \method{next()} methods. + \subsection{Sequence Types \label{typesseq}} From rhettinger@users.sourceforge.net Wed Jun 25 21:36:23 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 25 Jun 2003 13:36:23 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.137,1.138 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv13451 Modified Files: libfuncs.tex Log Message: Removed useless intra-section references which jump to the top of the section instead of the specific item being referenced. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.137 retrieving revision 1.138 diff -C2 -d -r1.137 -r1.138 *** libfuncs.tex 17 Jun 2003 02:37:06 -0000 1.137 --- libfuncs.tex 25 Jun 2003 20:36:20 -0000 1.138 *************** *** 124,128 **** \begin{funcdesc}{classmethod}{function} - \label{classmethod} Return a class method for \var{function}. --- 124,127 ---- *************** *** 144,148 **** Class methods are different than C++ or Java static methods. ! If you want those, see \ref{staticmethod}. \versionadded{2.2} \end{funcdesc} --- 143,147 ---- Class methods are different than C++ or Java static methods. ! If you want those, see \function{staticmethod} in this section. \versionadded{2.2} \end{funcdesc} *************** *** 903,907 **** \begin{funcdesc}{staticmethod}{function} - \label{staticmethod} Return a static method for \var{function}. --- 902,905 ---- *************** *** 920,924 **** Static methods in Python are similar to those found in Java or C++. ! For a more advanced concept, see \ref{classmethod}. \versionadded{2.2} \end{funcdesc} --- 918,922 ---- Static methods in Python are similar to those found in Java or C++. ! For a more advanced concept, see \function{classmethod} in this section. \versionadded{2.2} \end{funcdesc} From fdrake@users.sourceforge.net Thu Jun 26 04:11:23 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 25 Jun 2003 20:11:23 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.105,1.106 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv1730 Modified Files: ref3.tex Log Message: remove _ from label: LaTeX rejects this due to all the magic we use to get the _ character to format like a normal character Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** ref3.tex 25 Jun 2003 18:29:36 -0000 1.105 --- ref3.tex 26 Jun 2003 03:11:20 -0000 1.106 *************** *** 1250,1254 **** ! \subsubsection{Invoking Descriptors \label{descriptor_invocation}} In general, a descriptor is an object attribute with ``binding behavior'', --- 1250,1254 ---- ! \subsubsection{Invoking Descriptors \label{descriptor-invocation}} In general, a descriptor is an object attribute with ``binding behavior'', From fdrake@users.sourceforge.net Thu Jun 26 04:12:00 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 25 Jun 2003 20:12:00 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.138,1.139 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv1776 Modified Files: libfuncs.tex Log Message: markup consistency nits Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.138 retrieving revision 1.139 diff -C2 -d -r1.138 -r1.139 *** libfuncs.tex 25 Jun 2003 20:36:20 -0000 1.138 --- libfuncs.tex 26 Jun 2003 03:11:57 -0000 1.139 *************** *** 143,147 **** Class methods are different than C++ or Java static methods. ! If you want those, see \function{staticmethod} in this section. \versionadded{2.2} \end{funcdesc} --- 143,147 ---- Class methods are different than C++ or Java static methods. ! If you want those, see \function{staticmethod()} in this section. \versionadded{2.2} \end{funcdesc} *************** *** 682,692 **** \begin{funcdesc}{object}{} ! Return a new featureless object. \function{object} is a base ! for all new style classes. It has the methods that are common ! to all instances of new style classes. ! \versionadded{2.2} ! \versionchanged[This function does not accept any arguments. ! Formerly, it accepted arguments but ignored them]{2.3} \end{funcdesc} --- 682,692 ---- \begin{funcdesc}{object}{} ! Return a new featureless object. \function{object()} is a base ! for all new style classes. It has the methods that are common ! to all instances of new style classes. ! \versionadded{2.2} ! \versionchanged[This function does not accept any arguments. ! Formerly, it accepted arguments but ignored them]{2.3} \end{funcdesc} *************** *** 917,922 **** for its class. ! Static methods in Python are similar to those found in Java or C++. ! For a more advanced concept, see \function{classmethod} in this section. \versionadded{2.2} \end{funcdesc} --- 917,923 ---- for its class. ! Static methods in Python are similar to those found in Java or \Cpp. ! For a more advanced concept, see \function{classmethod()} in this ! section. \versionadded{2.2} \end{funcdesc} From niemeyer@users.sourceforge.net Thu Jun 26 15:41:11 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Thu, 26 Jun 2003 07:41:11 -0700 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.98,2.99 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv22024 Modified Files: _sre.c Log Message: Fixing bug described in patch #756032, where SRE reads invalid data due to a corrupted end pointer. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.98 retrieving revision 2.99 diff -C2 -d -r2.98 -r2.99 *** _sre.c 9 Jun 2003 08:22:11 -0000 2.98 --- _sre.c 26 Jun 2003 14:41:08 -0000 2.99 *************** *** 1298,1302 **** flags = pattern[2]; ! if (pattern[3] > 0) { /* adjust end point (but make sure we leave at least one character in there, so literal search will work) */ --- 1298,1302 ---- flags = pattern[2]; ! if (pattern[3] > 1) { /* adjust end point (but make sure we leave at least one character in there, so literal search will work) */ From jhylton@users.sourceforge.net Thu Jun 26 15:56:19 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 26 Jun 2003 07:56:19 -0700 Subject: [Python-checkins] python/dist/src/Lib trace.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv25714 Modified Files: trace.py Log Message: Enable tracing of multi-threaded applications. Fix bug in computation of coverage percentage: Only count a line if it was executed or if we print the >>>>>> marker. Index: trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/trace.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** trace.py 24 Apr 2003 16:02:43 -0000 1.7 --- trace.py 26 Jun 2003 14:56:17 -0000 1.8 *************** *** 51,54 **** --- 51,55 ---- import re import sys + import threading import token import tokenize *************** *** 318,324 **** if lineno in lnotab and not PRAGMA_NOCOVER in lines[i]: outfile.write(">>>>>> ") else: outfile.write(" ") - n_lines += 1 outfile.write(lines[i].expandtabs(8)) outfile.close() --- 319,325 ---- if lineno in lnotab and not PRAGMA_NOCOVER in lines[i]: outfile.write(">>>>>> ") + n_lines += 1 else: outfile.write(" ") outfile.write(lines[i].expandtabs(8)) outfile.close() *************** *** 438,441 **** --- 439,443 ---- if not self.donothing: sys.settrace(self.globaltrace) + threading.settrace(self.globaltrace) try: exec cmd in dict, dict *************** *** 443,446 **** --- 445,449 ---- if not self.donothing: sys.settrace(None) + threading.settrace(None) def runctx(self, cmd, globals=None, locals=None): *************** *** 449,452 **** --- 452,456 ---- if not self.donothing: sys.settrace(self.globaltrace) + threading.settrace(self.globaltrace) try: exec cmd in globals, locals *************** *** 454,457 **** --- 458,462 ---- if not self.donothing: sys.settrace(None) + threading.settrace(None) def runfunc(self, func, *args, **kw): From rhettinger@users.sourceforge.net Thu Jun 26 18:41:43 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 26 Jun 2003 10:41:43 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref5.tex,1.73,1.74 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv20082 Modified Files: ref5.tex Log Message: * Fixed an unmatched parenthesis early in the text. * Clarified the meaning of lexicographic sequence ordering as discussed on comp.lang.python: http://groups.google.com/groups?th=e163c9f9ba114493 Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** ref5.tex 6 Jun 2003 02:52:14 -0000 1.73 --- ref5.tex 26 Jun 2003 17:41:40 -0000 1.74 *************** *** 715,719 **** \code{divmod(x, y) == (x/y, x\%y)}. These identities don't hold for floating point numbers; there similar identities hold ! approximately where \code{x/y} is replaced by \code{floor(x/y)}) or \code{floor(x/y) - 1}\footnote{ If x is very close to an exact integer multiple of y, it's --- 715,719 ---- \code{divmod(x, y) == (x/y, x\%y)}. These identities don't hold for floating point numbers; there similar identities hold ! approximately where \code{x/y} is replaced by \code{floor(x/y)} or \code{floor(x/y) - 1}\footnote{ If x is very close to an exact integer multiple of y, it's *************** *** 868,872 **** \item Tuples and lists are compared lexicographically using comparison of ! corresponding items. \item --- 868,880 ---- \item Tuples and lists are compared lexicographically using comparison of ! corresponding elements. This means that to compare equal, each ! element must compare equal and the two sequences must be of the same ! type and have the same length. ! ! If not equal, the sequences are ordered the same as their first ! differing elements. For example, \code{cmp([1,2,x], [1,2,y])} returns ! the same as \code{cmp(x,y)}. If the corresponding element does not ! exist, the shorter sequence is ordered first (for example, ! \code{[1,2] < [1,2,3]}). \item From rhettinger@users.sourceforge.net Thu Jun 26 19:49:31 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 26 Jun 2003 11:49:31 -0700 Subject: [Python-checkins] python/dist/src/Lib sets.py,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv32231 Modified Files: sets.py Log Message: Portion of SF patch #761104. Fixes a minor docstring error. _TemporarilyImmutableSet is in fact a subclass of BaseSet Index: sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** sets.py 2 Mar 2003 00:19:49 -0000 1.43 --- sets.py 26 Jun 2003 18:49:28 -0000 1.44 *************** *** 26,33 **** An iterable argument is mandatory to create an ImmutableSet. ! _TemporarilyImmutableSet -- Not a subclass of BaseSet: just a wrapper ! around a Set, hashable, giving the same hash value as the ! immutable set equivalent would have. Do not use this class ! directly. Only hashable objects can be added to a Set. In particular, you cannot --- 26,32 ---- An iterable argument is mandatory to create an ImmutableSet. ! _TemporarilyImmutableSet -- A wrapper around a Set, hashable, ! giving the same hash value as the immutable set equivalent ! would have. Do not use this class directly. Only hashable objects can be added to a Set. In particular, you cannot From rhettinger@users.sourceforge.net Thu Jun 26 20:32:13 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 26 Jun 2003 12:32:13 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref5.tex,1.74,1.75 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv7818 Modified Files: ref5.tex Log Message: SF patch #760792: "wo" in "word" now valid but not documented as such Revised version of a contribution from Gerrit Holl. Update the docs for the extended behavior of __contains__ Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** ref5.tex 26 Jun 2003 17:41:40 -0000 1.74 --- ref5.tex 26 Jun 2003 19:32:10 -0000 1.75 *************** *** 914,921 **** For the Unicode and string types, \code{\var{x} in \var{y}} is true if ! and only if there exists an index \var{i} such that \code{\var{x} == ! \var{y}[\var{i}]} is true. If \code{\var{x}} is not a string or ! Unicode object of length \code{1}, a \exception{TypeError} exception ! is raised. For user-defined classes which define the \method{__contains__()} method, --- 914,924 ---- For the Unicode and string types, \code{\var{x} in \var{y}} is true if ! and only if \var{x} is a substring of \var{y}. An equivalent test is ! \code{y.find(x) != -1}. Note, \var{x} and \var{y} need not be the ! same type; consequently, \code{u'ab' in 'abc'} will return \code{True}. ! Empty strings are always considered to be a substring of any other string, ! so \code{"" in "abc"} will return \code{True}. ! \versionchanged[Previously, \var{x} was required to be a string of ! length \code{1}]{2.3} For user-defined classes which define the \method{__contains__()} method, From jhylton@users.sourceforge.net Fri Jun 27 00:20:22 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 26 Jun 2003 16:20:22 -0700 Subject: [Python-checkins] python/dist/src/Lib copy_reg.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv12558 Modified Files: copy_reg.py Log Message: Don't call constructor() from pickle(). The constructor() call only made sense when it registered the constructor as safe for unpickling. We should probably remove the module-global function, but need to worry about backwards compatibility. Index: copy_reg.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/copy_reg.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** copy_reg.py 7 Jun 2003 20:10:54 -0000 1.25 --- copy_reg.py 26 Jun 2003 23:20:20 -0000 1.26 *************** *** 13,16 **** --- 13,17 ---- def pickle(ob_type, pickle_function, constructor_ob=None): + # constructor_ob exists only for backwards compatibility. if type(ob_type) is _ClassType: raise TypeError("copy_reg is not intended for use with classes") *************** *** 20,27 **** dispatch_table[ob_type] = pickle_function - if constructor_ob is not None: - constructor(constructor_ob) - def constructor(object): if not callable(object): raise TypeError("constructors must be callable") --- 21,27 ---- dispatch_table[ob_type] = pickle_function def constructor(object): + # XXX This function should be deprecated. It is a vestige of + # the old __safe_for_unpickling__ code. if not callable(object): raise TypeError("constructors must be callable") From rhettinger@users.sourceforge.net Fri Jun 27 07:57:58 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 26 Jun 2003 23:57:58 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.106,1.107 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv29252 Modified Files: ref3.tex Log Message: * Markup nits for the Invoking Descriptors section * Documented __slots__ * Documented __metaclass__ Shamelessly plagarized from Guido's tutorial. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** ref3.tex 26 Jun 2003 03:11:20 -0000 1.106 --- ref3.tex 27 Jun 2003 06:57:56 -0000 1.107 *************** *** 1254,1258 **** In general, a descriptor is an object attribute with ``binding behavior'', one whose attribute access has been overridden by methods in the descriptor ! protocol: \method{__get__}, \method{__set__}, and \method{__delete__}. If any of those methods are defined for an object, it is said to be a descriptor. --- 1254,1258 ---- In general, a descriptor is an object attribute with ``binding behavior'', one whose attribute access has been overridden by methods in the descriptor ! protocol: \method{__get__()}, \method{__set__()}, and \method{__delete__()}. If any of those methods are defined for an object, it is said to be a descriptor. *************** *** 1269,1273 **** on which descriptor methods were defined and how they were called. Note that descriptors are only invoked for new style objects or classes ! (ones that subclass \class{object} or \class{type}). The starting point for descriptor invocation is a binding, \code{a.x}. --- 1269,1273 ---- on which descriptor methods were defined and how they were called. Note that descriptors are only invoked for new style objects or classes ! (ones that subclass \class{object()} or \class{type()}). The starting point for descriptor invocation is a binding, \code{a.x}. *************** *** 1296,1311 **** For instance bindings, the precedence of descriptor invocation depends on the which descriptor methods are defined. Data descriptors define ! both \method{__get__} and \method{__set__}. Non-data descriptors have ! just the \method{__get__} method. Data descriptors always override a redefinition in an instance dictionary. In contrast, non-data descriptors can be overridden by instances. ! Python methods (including \function{staticmethod} and \function{classmethod}) are implemented as non-data descriptors. Accordingly, instances can redefine and override methods. This allows individual instances to acquire behaviors that differ from other instances of the same class. ! The \function{property} function is implemented as a data descriptor. ! Accordingly, instances cannot override the behavior a property. --- 1296,1425 ---- For instance bindings, the precedence of descriptor invocation depends on the which descriptor methods are defined. Data descriptors define ! both \method{__get__()} and \method{__set__()}. Non-data descriptors have ! just the \method{__get__()} method. Data descriptors always override a redefinition in an instance dictionary. In contrast, non-data descriptors can be overridden by instances. ! Python methods (including \function{staticmethod()} and \function{classmethod()}) are implemented as non-data descriptors. Accordingly, instances can redefine and override methods. This allows individual instances to acquire behaviors that differ from other instances of the same class. ! The \function{property()} function is implemented as a data descriptor. ! Accordingly, instances cannot override the behavior of a property. ! ! ! \subsubsection{__slots__\label{slots}} ! ! By default, instances of both old and new-style classes have a dictionary ! for attribute storage. This wastes space for objects having very few instance ! variables. The space consumption can become acute when creating large numbers ! of instances. ! ! The default can be overridden by defining \var{__slots__} in a new-style class ! definition. The \var{__slots__} declaration takes a sequence of instance ! variables and reserves just enough space in each instance to hold a value ! for each variable. Space is saved because \var{__dict__} is not created for ! each instance. ! ! \begin{datadesc}{__slots__} ! This class variable can be assigned a string, iterable, or sequence of strings ! with variable names used by instances. If defined in a new-style class ! definition, \var{__slots__} reserves space for the declared variables ! and prevents the automatic creation of \var{__dict__} and \var{__weakref__} ! for each instance. ! \versionadded{2.2} ! \end{datadesc} ! ! \noindent ! Notes on Using \var{__slots__} ! ! \begin{itemize} ! ! \item Without a \var{__dict__} variable, instances cannot be assigned new ! variables not listed in the \var{__slots__} definition. Attempts to assign ! to an unlisted variable name raises \exception{AttributeError}. If dynamic ! assignment of new variables is desired, then add \code{'__dict__'} to the ! sequence of strings in the \var{__slots__} declaration. ! \versionchanged[Previously, adding \code{'__dict__'} to the \var{__slots__} ! declaration would not enable the assignment of new attributes not ! specifically listed in the sequence of instance variable names]{2.3} ! ! \item Without a \var{__weakref__} variable for each instance, classes ! defining \var{__slots__} do not support weak references to its instances. ! If weak reference support is needed, then add \code{'__weakref__'} to the ! sequence of strings in the \var{__slots__} declaration. ! \versionchanged[Previously, adding \code{__weakref__} to the \var{__slots__} ! declaration would not enable support for weak references]{2.3} ! ! \item \var{__slots__} are implemented at the class level by creating ! descriptors (\ref{descriptors}) for each variable name. As a result, ! class attributes cannot be used to set default values for instance ! variables defined by \var{__slots__}; otherwise, the class attribute would ! overwrite the descriptor assignment. ! ! \item If a class defines a slot also defined in a base class, the instance ! variable defined by the base class slot is inaccessible (except by retrieving ! its descriptor directly from the base class). This renders the meaning of the ! program undefined. In the future, a check may be added to prevent this. ! ! \item The action of a \var{__slots__} declaration is limited to the class ! where it is defined. As a result, subclasses will have a \var{__dict__} ! unless they also define \var{__slots__}. ! ! \item \var{__slots__} do not work for classes derived from ``variable-length'' ! built-in types such as \class{long}, \class{str} and \class{tuple}. ! ! \item Any non-string iterable may be assigned \var{__slots__}. ! Mappings may also be used; however, in the future, special meaning may ! be assigned to the values corresponding to each key. ! ! \end{itemize} ! ! ! \subsection{Customizing class creation\label{metaclasses}} ! ! By default, new-style classes are constructed using \function{type()}. ! A class definition is read into a separate namespace and the value ! of class name is bound to the result of \code{type(name, bases, dict)}. ! ! When the class definition is read, if \var{__metaclass__} is defined ! then the callable assigned to it will be called instead of \function{type()}. ! The allows classes or functions to be written which monitor or alter the class ! creation process: ! ! \begin{itemize} ! \item Modifying the class dictionary prior to the class being created. ! \item Returning an instance of another class -- essentially performing ! the role of a factory function. ! \end{itemize} ! ! \begin{datadesc}{__metaclass__} ! This variable can be any callable accepting arguments for \code{name}, ! \code{bases}, and \code{dict}. Upon class creation, the callable is ! used instead of the built-in \function{type()}. ! \versionadded{2.2} ! \end{datadesc} ! ! The appropriate metaclass is determined by the following precedence rules: ! ! \begin{itemize} ! ! \item If \code{dict['__metaclass__']} exists, it is used. ! ! \item Otherwise, if there is at least one base class, its metaclass is used ! (this looks for a \var{__class__} attribute first and if not found, uses its ! type). ! ! \item Otherwise, if a global variable named __metaclass__ exists, it is used. ! ! \item Otherwise, the old-style, classic metaclass (types.ClassType) is used. ! ! \end{itemize} ! ! The potential uses for metaclasses are boundless. Some ideas that have ! been explored including logging, interface checking, automatic delegation, ! automatic property creation, proxies, frameworks, and automatic resource ! locking/synchronization. From rhettinger@users.sourceforge.net Fri Jun 27 09:14:19 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 27 Jun 2003 01:14:19 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_datetime.py,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv5051/Lib/test Modified Files: test_datetime.py Log Message: SF bug #761337: datetime.strftime fails on trivial format string The interning of short strings violates the refcnt==1 assumption for _PyString_Resize(). A simple fix is to boost the initial value of "totalnew" by 1. Combined with an NULL argument to PyString_FromStringAndSize(), this assures that resulting format string is not interned. This will remain true even if the implementation of PyString_FromStringAndSize() changes because only the uninitialized strings that can be interned are those of zero length. Added a test case. Index: test_datetime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_datetime.py,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** test_datetime.py 17 May 2003 15:56:59 -0000 1.44 --- test_datetime.py 27 Jun 2003 08:14:17 -0000 1.45 *************** *** 832,835 **** --- 832,836 ---- t = self.theclass(2005, 3, 2) self.assertEqual(t.strftime("m:%m d:%d y:%y"), "m:03 d:02 y:05") + self.assertEqual(t.strftime(""), "") # SF bug #761337 self.assertRaises(TypeError, t.strftime) # needs an arg From rhettinger@users.sourceforge.net Fri Jun 27 09:14:19 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 27 Jun 2003 01:14:19 -0700 Subject: [Python-checkins] python/dist/src/Modules datetimemodule.c,1.66,1.67 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv5051/Modules Modified Files: datetimemodule.c Log Message: SF bug #761337: datetime.strftime fails on trivial format string The interning of short strings violates the refcnt==1 assumption for _PyString_Resize(). A simple fix is to boost the initial value of "totalnew" by 1. Combined with an NULL argument to PyString_FromStringAndSize(), this assures that resulting format string is not interned. This will remain true even if the implementation of PyString_FromStringAndSize() changes because only the uninitialized strings that can be interned are those of zero length. Added a test case. Index: datetimemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/datetimemodule.c,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** datetimemodule.c 18 May 2003 02:24:46 -0000 1.66 --- datetimemodule.c 27 Jun 2003 08:14:17 -0000 1.67 *************** *** 1176,1180 **** * is expensive, don't unless they're actually used. */ ! totalnew = PyString_Size(format); /* realistic if no %z/%Z */ newfmt = PyString_FromStringAndSize(NULL, totalnew); if (newfmt == NULL) goto Done; --- 1176,1180 ---- * is expensive, don't unless they're actually used. */ ! totalnew = PyString_Size(format) + 1; /* realistic if no %z/%Z */ newfmt = PyString_FromStringAndSize(NULL, totalnew); if (newfmt == NULL) goto Done; From mwh@users.sourceforge.net Fri Jun 27 13:32:41 2003 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 27 Jun 2003 05:32:41 -0700 Subject: [Python-checkins] python/dist/src/Lib/compiler pycodegen.py,1.64,1.65 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/compiler In directory sc8-pr-cvs1:/tmp/cvs-serv7781 Modified Files: pycodegen.py Log Message: Jacob Hallen cornered me here at EuroPython and got me to look at patch: [ 750008 ] 'compiler' module bug with 'import foo.bar as baz' which I'm now checking in. after import foo.bar as baz, baz would refer to foo. Index: pycodegen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/compiler/pycodegen.py,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** pycodegen.py 31 Dec 2002 18:26:17 -0000 1.64 --- pycodegen.py 27 Jun 2003 12:32:39 -0000 1.65 *************** *** 762,766 **** self.emit('IMPORT_NAME', name) mod = name.split(".")[0] ! self.storeName(alias or mod) def visitFrom(self, node): --- 762,770 ---- self.emit('IMPORT_NAME', name) mod = name.split(".")[0] ! if alias: ! self._resolveDots(name) ! self.storeName(alias) ! else: ! self.storeName(mod) def visitFrom(self, node): From neal@metaslash.com Fri Jun 27 14:54:05 2003 From: neal@metaslash.com (Neal Norwitz) Date: Fri, 27 Jun 2003 09:54:05 -0400 Subject: [Python-checkins] python/dist/src/Lib copy_reg.py,1.25,1.26 In-Reply-To: References: Message-ID: <20030627135405.GS1298@epoch.metaslash.com> This change broke the test_copy_reg. test test_copy_reg failed -- Traceback (most recent call last): File "/home/neal/build/python/2_3/Lib/test/test_copy_reg.py", line 23, in test_noncallable_constructor type(1), int, "not a callable") File "/home/neal/build/python/2_3/Lib/unittest.py", line 285, in failUnlessRaises raise self.failureException, excName AssertionError: TypeError Neal -- On Thu, Jun 26, 2003 at 04:20:22PM -0700, jhylton@users.sourceforge.net wrote: > Update of /cvsroot/python/python/dist/src/Lib > In directory sc8-pr-cvs1:/tmp/cvs-serv12558 > > Modified Files: > copy_reg.py > Log Message: > Don't call constructor() from pickle(). > > The constructor() call only made sense when it registered the > constructor as safe for unpickling. We should probably remove the > module-global function, but need to worry about backwards > compatibility. > > > > Index: copy_reg.py > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Lib/copy_reg.py,v > retrieving revision 1.25 > retrieving revision 1.26 > diff -C2 -d -r1.25 -r1.26 > *** copy_reg.py 7 Jun 2003 20:10:54 -0000 1.25 > --- copy_reg.py 26 Jun 2003 23:20:20 -0000 1.26 > *************** > *** 13,16 **** > --- 13,17 ---- > > def pickle(ob_type, pickle_function, constructor_ob=None): > + # constructor_ob exists only for backwards compatibility. > if type(ob_type) is _ClassType: > raise TypeError("copy_reg is not intended for use with classes") > *************** > *** 20,27 **** > dispatch_table[ob_type] = pickle_function > > - if constructor_ob is not None: > - constructor(constructor_ob) > - > def constructor(object): > if not callable(object): > raise TypeError("constructors must be callable") > --- 21,27 ---- > dispatch_table[ob_type] = pickle_function > > def constructor(object): > + # XXX This function should be deprecated. It is a vestige of > + # the old __safe_for_unpickling__ code. > if not callable(object): > raise TypeError("constructors must be callable") > > > > _______________________________________________ > Python-checkins mailing list > Python-checkins@python.org > http://mail.python.org/mailman/listinfo/python-checkins From montanaro@users.sourceforge.net Fri Jun 27 16:45:44 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 27 Jun 2003 08:45:44 -0700 Subject: [Python-checkins] python/dist/src/Lib pydoc.py,1.85,1.86 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv4797 Modified Files: pydoc.py Log Message: (HTML|Text)Repr.repr1: Guard against objects whos types have no __name__ attribute. Patch and bug report from Geoff Talvola. Closes patch #672855. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** pydoc.py 14 Jun 2003 09:03:46 -0000 1.85 --- pydoc.py 27 Jun 2003 15:45:41 -0000 1.86 *************** *** 313,321 **** def repr1(self, x, level): ! methodname = 'repr_' + join(split(type(x).__name__), '_') ! if hasattr(self, methodname): ! return getattr(self, methodname)(x, level) ! else: ! return self.escape(cram(stripid(repr(x)), self.maxother)) def repr_string(self, x, level): --- 313,321 ---- def repr1(self, x, level): ! if hasattr(type(x), '__name__'): ! methodname = 'repr_' + join(split(type(x).__name__), '_') ! if hasattr(self, methodname): ! return getattr(self, methodname)(x, level) ! return self.escape(cram(stripid(repr(x)), self.maxother)) def repr_string(self, x, level): *************** *** 875,883 **** def repr1(self, x, level): ! methodname = 'repr_' + join(split(type(x).__name__), '_') ! if hasattr(self, methodname): ! return getattr(self, methodname)(x, level) ! else: ! return cram(stripid(repr(x)), self.maxother) def repr_string(self, x, level): --- 875,883 ---- def repr1(self, x, level): ! if hasattr(type(x), '__name__'): ! methodname = 'repr_' + join(split(type(x).__name__), '_') ! if hasattr(self, methodname): ! return getattr(self, methodname)(x, level) ! return cram(stripid(repr(x)), self.maxother) def repr_string(self, x, level): From tim_one@users.sourceforge.net Fri Jun 27 16:49:37 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 27 Jun 2003 08:49:37 -0700 Subject: [Python-checkins] python/dist/src/PCbuild BUILDno.txt,1.46,1.47 python20.wse,1.126,1.127 pythoncore.dsp,1.44,1.45 readme.txt,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv5432/PCbuild Modified Files: BUILDno.txt python20.wse pythoncore.dsp readme.txt Log Message: Some Windows changes preparing for 2.3b2. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** BUILDno.txt 30 May 2003 15:23:21 -0000 1.46 --- BUILDno.txt 27 Jun 2003 15:49:34 -0000 1.47 *************** *** 34,37 **** --- 34,39 ---- Windows Python BUILD numbers ---------------------------- + 43 2.3b2 + 29-Jun-2003 42 2.2.3 (final) 30-May-2003 Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.126 retrieving revision 1.127 diff -C2 -d -r1.126 -r1.127 *** python20.wse 15 Jun 2003 20:40:33 -0000 1.126 --- python20.wse 27 Jun 2003 15:49:34 -0000 1.127 *************** *** 2,6 **** item: Global Version=8.14 ! Title=Python 2.3 beta 1 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 --- 2,6 ---- item: Global Version=8.14 ! Title=Python 2.3 beta 2 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 *************** *** 19,25 **** Patch Threshold=85 Patch Memory=4000 ! EXE Filename=Python-2.3b1.exe Dialogs Version=8 ! Version File=2.3b1 Version Description=Python Programming Language Version Copyright=©2001-2003 Python Software Foundation --- 19,25 ---- Patch Threshold=85 Patch Memory=4000 ! EXE Filename=Python-2.3b2.exe Dialogs Version=8 ! Version File=2.3b2 Version Description=Python Programming Language Version Copyright=©2001-2003 Python Software Foundation *************** *** 67,71 **** item: Set Variable Variable=PYVER_STRING ! Value=2.3b1 end item: Remark --- 67,71 ---- item: Set Variable Variable=PYVER_STRING ! Value=2.3b2 end item: Remark Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.dsp,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** pythoncore.dsp 24 Apr 2003 16:55:35 -0000 1.44 --- pythoncore.dsp 27 Jun 2003 15:49:35 -0000 1.45 *************** *** 259,263 **** SOURCE=..\Modules\getbuildinfo.c ! # ADD CPP /D BUILD=40 # End Source File # Begin Source File --- 259,263 ---- SOURCE=..\Modules\getbuildinfo.c ! # ADD CPP /D BUILD=43 # End Source File # Begin Source File Index: readme.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/readme.txt,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** readme.txt 22 Jun 2003 01:42:20 -0000 1.42 --- readme.txt 27 Jun 2003 15:49:35 -0000 1.43 *************** *** 102,105 **** --- 102,108 ---- XXX Some tests failed in "nmake -f makefile.vc test". XXX all.tcl: Total 10480 Passed 9743 Skipped 719 Failed 18 + XXX + XXX That was on Win98SE. On Win2K: + XXX all.tcl Total 10480 Passed 9781 Skipped 698 Failed 1 Build Tk From jhylton@users.sourceforge.net Fri Jun 27 17:13:19 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 27 Jun 2003 09:13:19 -0700 Subject: [Python-checkins] python/dist/src/Modules pyexpat.c,2.80,2.81 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv9842 Modified Files: pyexpat.c Log Message: Fix several bugs in handling of exceptions with trace function enabled. If the callback raised an exception but did not set curexc_traceback, the trace function was called with PyTrace_RETURN. That is, the trace function was called with an exception set. The main loop detected the exception when the trace function returned; it complained and disabled tracing. Fix the logic error so that PyTrace_RETURN only occurs if the callback returned normally. The trace function must be called for exceptions, too. So we had to add new functionality to call with PyTrace_EXCEPTION. (Leads to a rather ugly ifdef / else block that contains only a '}'.) Reverse the logic and name of NOFIX_TRACE to FIX_TRACE. Joint work with Fred. Index: pyexpat.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/pyexpat.c,v retrieving revision 2.80 retrieving revision 2.81 diff -C2 -d -r2.80 -r2.81 *** pyexpat.c 2 Feb 2003 03:54:17 -0000 2.80 --- pyexpat.c 27 Jun 2003 16:13:17 -0000 2.81 *************** *** 25,29 **** /* In Python 2.0 and 2.1, disabling Unicode was not possible. */ #define Py_USING_UNICODE ! #define NOFIX_TRACE #endif --- 25,30 ---- /* In Python 2.0 and 2.1, disabling Unicode was not possible. */ #define Py_USING_UNICODE ! #else ! #define FIX_TRACE #endif *************** *** 294,298 **** } ! #ifndef NOFIX_TRACE static int trace_frame(PyThreadState *tstate, PyFrameObject *f, int code, PyObject *val) --- 295,299 ---- } ! #ifdef FIX_TRACE static int trace_frame(PyThreadState *tstate, PyFrameObject *f, int code, PyObject *val) *************** *** 321,324 **** --- 322,356 ---- return result; } + + static int + trace_frame_exc(PyThreadState *tstate, PyFrameObject *f) + { + PyObject *type, *value, *traceback, *arg; + int err; + + if (tstate->c_tracefunc == NULL) + return 0; + + PyErr_Fetch(&type, &value, &traceback); + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + arg = Py_BuildValue("(OOO)", type, value, traceback); + if (arg == NULL) { + PyErr_Restore(type, value, traceback); + return 0; + } + err = trace_frame(tstate, f, PyTrace_EXCEPTION, arg); + Py_DECREF(arg); + if (err == 0) + PyErr_Restore(type, value, traceback); + else { + Py_XDECREF(type); + Py_XDECREF(value); + Py_XDECREF(traceback); + } + return err; + } #endif *************** *** 333,360 **** return NULL; ! f = PyFrame_New( ! tstate, /*back*/ ! c, /*code*/ ! PyEval_GetGlobals(), /*globals*/ ! NULL /*locals*/ ! ); if (f == NULL) return NULL; tstate->frame = f; ! #ifndef NOFIX_TRACE ! if (trace_frame(tstate, f, PyTrace_CALL, Py_None)) { ! Py_DECREF(f); return NULL; } #endif res = PyEval_CallObject(func, args); ! if (res == NULL && tstate->curexc_traceback == NULL) ! PyTraceBack_Here(f); ! #ifndef NOFIX_TRACE else { ! if (trace_frame(tstate, f, PyTrace_RETURN, res)) { Py_XDECREF(res); res = NULL; } } #endif --- 365,393 ---- return NULL; ! f = PyFrame_New(tstate, c, PyEval_GetGlobals(), NULL); if (f == NULL) return NULL; tstate->frame = f; ! #ifdef FIX_TRACE ! if (trace_frame(tstate, f, PyTrace_CALL, Py_None) < 0) { return NULL; } #endif res = PyEval_CallObject(func, args); ! if (res == NULL) { ! if (tstate->curexc_traceback == NULL) ! PyTraceBack_Here(f); ! #ifdef FIX_TRACE ! if (trace_frame_exc(tstate, f) < 0) { ! return NULL; ! } ! } else { ! if (trace_frame(tstate, f, PyTrace_RETURN, res) < 0) { Py_XDECREF(res); res = NULL; } + } + #else } #endif From fdrake@users.sourceforge.net Fri Jun 27 17:32:29 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 27 Jun 2003 09:32:29 -0700 Subject: [Python-checkins] python/dist/src/Doc/html style.css,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/html In directory sc8-pr-cvs1:/tmp/cvs-serv13099 Modified Files: style.css Log Message: fix link-hovering so (no href attribute) doesn't get the hovering background Index: style.css =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/html/style.css,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** style.css 29 Jan 2003 05:14:44 -0000 1.25 --- style.css 27 Jun 2003 16:32:27 -0000 1.26 *************** *** 40,44 **** a:active { color: #ff0000; } ! a[href]:hover { background-color: #bbeeff; } a:visited { color: #551a8b; } a:link { color: #0000bb; } --- 40,45 ---- a:active { color: #ff0000; } ! a:link:hover { background-color: #bbeeff; } ! a:visited:hover { background-color: #bbeeff; } a:visited { color: #551a8b; } a:link { color: #0000bb; } *************** *** 98,106 **** margin-right: 0.5in; padding: 0.05in; } - .productions { background-color: #bbeeff; } - .productions a:hover { background-color: #99ccff; } - .productions table { vertical-align: baseline; } .grammar-footer { padding: 0.05in; font-size: 85%; } .email { font-family: avantgarde, sans-serif; } --- 99,112 ---- margin-right: 0.5in; padding: 0.05in; } .grammar-footer { padding: 0.05in; font-size: 85%; } + + .productions { background-color: #bbeeff; } + .productions a:active { color: #ff0000; } + .productions a:link:hover { background-color: #99ccff; } + .productions a:visited:hover { background-color: #99ccff; } + .productions a:visited { color: #551a8b; } + .productions a:link { color: #0000bb; } + .productions table { vertical-align: baseline; } .email { font-family: avantgarde, sans-serif; } From jhylton@users.sourceforge.net Fri Jun 27 17:46:47 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 27 Jun 2003 09:46:47 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.237,2.238 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv15299 Modified Files: typeobject.c Log Message: Check return type of __nonzero__() method. The language reference says you must return an int or a bool. This fix limits the scope of SF bug 759227 (infinite recursion) to subclasses of int. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.237 retrieving revision 2.238 diff -C2 -d -r2.237 -r2.238 *** typeobject.c 13 Jun 2003 20:54:40 -0000 2.237 --- typeobject.c 27 Jun 2003 16:46:45 -0000 2.238 *************** *** 4197,4201 **** Py_DECREF(args); if (temp != NULL) { ! result = PyObject_IsTrue(temp); Py_DECREF(temp); } --- 4197,4213 ---- Py_DECREF(args); if (temp != NULL) { ! if (PyInt_Check(temp)) { ! /* XXX need to guard against recursion here */ ! result = PyObject_IsTrue(temp); ! } ! else if (PyBool_Check(temp)) ! result = PyObject_IsTrue(temp); ! else { ! PyErr_Format(PyExc_TypeError, ! "__nonzero__ should return " ! "bool or int, returned %s", ! temp->ob_type->tp_name); ! result = NULL; ! } Py_DECREF(temp); } From jhylton@users.sourceforge.net Fri Jun 27 17:58:45 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 27 Jun 2003 09:58:45 -0700 Subject: [Python-checkins] python/dist/src/Lib copy_reg.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv16769 Modified Files: copy_reg.py Log Message: Revert previous checkin and just add a comment about constructor_ob. There's no point to passing it anymore, but there's a test that expects the call to fail if you pass a non-callable object. Index: copy_reg.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/copy_reg.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** copy_reg.py 26 Jun 2003 23:20:20 -0000 1.26 --- copy_reg.py 27 Jun 2003 16:58:43 -0000 1.27 *************** *** 13,17 **** def pickle(ob_type, pickle_function, constructor_ob=None): - # constructor_ob exists only for backwards compatibility. if type(ob_type) is _ClassType: raise TypeError("copy_reg is not intended for use with classes") --- 13,16 ---- *************** *** 21,27 **** dispatch_table[ob_type] = pickle_function def constructor(object): - # XXX This function should be deprecated. It is a vestige of - # the old __safe_for_unpickling__ code. if not callable(object): raise TypeError("constructors must be callable") --- 20,29 ---- dispatch_table[ob_type] = pickle_function + # The constructor_ob function is a vestige of safe for unpickling. + # There is no reason for the caller to pass it anymore. + if constructor_ob is not None: + constructor(constructor_ob) + def constructor(object): if not callable(object): raise TypeError("constructors must be callable") From fdrake@users.sourceforge.net Fri Jun 27 18:12:47 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 27 Jun 2003 10:12:47 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref5.tex,1.75,1.76 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv18909 Modified Files: ref5.tex Log Message: Add definitions of the test and testlist symbols in the grammar so there are no gaps in the definitions. Closes SF bug #726150. Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** ref5.tex 26 Jun 2003 19:32:10 -0000 1.75 --- ref5.tex 27 Jun 2003 17:12:43 -0000 1.76 *************** *** 154,157 **** --- 154,162 ---- \begin{productionlist} + \production{test} + {\token{and_test} ( "or" \token{and_test} )* + | \token{lambda_form}} + \production{testlist} + {\token{test} ( "," \token{test} )* [ "," ]} \production{list_display} {"[" [\token{listmaker}] "]"} From fdrake@users.sourceforge.net Fri Jun 27 18:13:20 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 27 Jun 2003 10:13:20 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref5.tex,1.53.4.11,1.53.4.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv19043 Modified Files: Tag: release22-maint ref5.tex Log Message: Add definitions of the test and testlist symbols in the grammar so there are no gaps in the definitions. Closes SF bug #726150. Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.53.4.11 retrieving revision 1.53.4.12 diff -C2 -d -r1.53.4.11 -r1.53.4.12 *** ref5.tex 16 Dec 2002 23:19:19 -0000 1.53.4.11 --- ref5.tex 27 Jun 2003 17:13:17 -0000 1.53.4.12 *************** *** 170,173 **** --- 170,178 ---- \begin{productionlist} + \production{test} + {\token{and_test} ( "or" \token{and_test} )* + | \token{lambda_form}} + \production{testlist} + {\token{test} ( "," \token{test} )* [ "," ]} \production{list_display} {"[" [\token{listmaker}] "]"} From jhylton@users.sourceforge.net Fri Jun 27 18:38:33 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 27 Jun 2003 10:38:33 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.238,2.239 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv22884 Modified Files: typeobject.c Log Message: Require that __nonzero__() return a bool or exactly an int. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.238 retrieving revision 2.239 diff -C2 -d -r2.238 -r2.239 *** typeobject.c 27 Jun 2003 16:46:45 -0000 2.238 --- typeobject.c 27 Jun 2003 17:38:27 -0000 2.239 *************** *** 4197,4205 **** Py_DECREF(args); if (temp != NULL) { ! if (PyInt_Check(temp)) { ! /* XXX need to guard against recursion here */ ! result = PyObject_IsTrue(temp); ! } ! else if (PyBool_Check(temp)) result = PyObject_IsTrue(temp); else { --- 4197,4201 ---- Py_DECREF(args); if (temp != NULL) { ! if (PyInt_CheckExact(temp) || PyBool_Check(temp)) result = PyObject_IsTrue(temp); else { *************** *** 4208,4212 **** "bool or int, returned %s", temp->ob_type->tp_name); ! result = NULL; } Py_DECREF(temp); --- 4204,4208 ---- "bool or int, returned %s", temp->ob_type->tp_name); ! result = -1; } Py_DECREF(temp); From jhylton@users.sourceforge.net Fri Jun 27 18:40:18 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 27 Jun 2003 10:40:18 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_bool.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv23187 Modified Files: test_bool.py Log Message: Add tests for __nonzero__() problems. Index: test_bool.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bool.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_bool.py 12 May 2003 20:19:36 -0000 1.13 --- test_bool.py 27 Jun 2003 17:40:16 -0000 1.14 *************** *** 321,324 **** --- 321,345 ---- self.assertEqual(cPickle.dumps(False, True), "I00\n.") + def test_convert_to_bool(self): + # Verify that TypeError occurs when bad things are returned + # from __nonzero__(). This isn't really a bool test, but + # it's related. + check = lambda o: self.assertRaises(TypeError, bool, o) + class Foo(object): + def __nonzero__(self): + return self + check(Foo()) + + class Bar(object): + def __nonzero__(self): + return "Yes" + check(Bar()) + + class Baz(int): + def __nonzero__(self): + return self + check(Baz()) + + def test_main(): test_support.run_unittest(BoolTest) From jhylton@users.sourceforge.net Fri Jun 27 19:14:41 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 27 Jun 2003 11:14:41 -0700 Subject: [Python-checkins] python/dist/src/Lib inspect.py,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv28310 Modified Files: inspect.py Log Message: Fix for SF bug 620190: getargspec() doesn't work with methods. Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** inspect.py 15 Jun 2003 22:33:28 -0000 1.44 --- inspect.py 27 Jun 2003 18:14:39 -0000 1.45 *************** *** 594,598 **** a list of argument names (possibly containing nested lists), and 'varargs' and 'varkw' are the names of the * and ** arguments or None.""" ! if not iscode(co): raise TypeError, 'arg is not a code object' code = co.co_code --- 594,600 ---- a list of argument names (possibly containing nested lists), and 'varargs' and 'varkw' are the names of the * and ** arguments or None.""" ! ! if not iscode(co): ! raise TypeError('arg is not a code object') code = co.co_code *************** *** 643,648 **** 'args' is a list of the argument names (it may contain nested lists). 'varargs' and 'varkw' are the names of the * and ** arguments or None. ! 'defaults' is an n-tuple of the default values of the last n arguments.""" ! if not isfunction(func): raise TypeError, 'arg is not a Python function' args, varargs, varkw = getargs(func.func_code) return args, varargs, varkw, func.func_defaults --- 645,655 ---- 'args' is a list of the argument names (it may contain nested lists). 'varargs' and 'varkw' are the names of the * and ** arguments or None. ! 'defaults' is an n-tuple of the default values of the last n arguments. ! """ ! ! if ismethod(func): ! func = func.im_func ! if not isfunction(func): ! raise TypeError('arg is not a Python function') args, varargs, varkw = getargs(func.func_code) return args, varargs, varkw, func.func_defaults From jhylton@users.sourceforge.net Fri Jun 27 19:16:23 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 27 Jun 2003 11:16:23 -0700 Subject: [Python-checkins] python/dist/src/Lib inspect.py,1.26.10.3,1.26.10.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv28576 Modified Files: Tag: release22-maint inspect.py Log Message: Fix for SF bug 620190: getargspec() doesn't understand methods. Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.26.10.3 retrieving revision 1.26.10.4 diff -C2 -d -r1.26.10.3 -r1.26.10.4 *** inspect.py 19 Jan 2003 14:16:19 -0000 1.26.10.3 --- inspect.py 27 Jun 2003 18:16:21 -0000 1.26.10.4 *************** *** 620,623 **** --- 620,625 ---- 'varargs' and 'varkw' are the names of the * and ** arguments or None. 'defaults' is an n-tuple of the default values of the last n arguments.""" + if ismethod(func): + func = func.im_func if not isfunction(func): raise TypeError, 'arg is not a Python function' args, varargs, varkw = getargs(func.func_code) From fdrake@users.sourceforge.net Fri Jun 27 19:26:04 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 27 Jun 2003 11:26:04 -0700 Subject: [Python-checkins] python/dist/src/Doc/perl l2hinit.perl,1.73,1.74 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory sc8-pr-cvs1:/tmp/cvs-serv30004 Modified Files: l2hinit.perl Log Message: Don't assume the name of the table of contents will be contents.html; that won't be right when mkhowto is called with --numeric (as it is for the Python Tutorial). Save the actual name we use when we build the table of contents, then use that in the page head metadata. The node2label.pl script will munge this properly when --numeric isn't given, so this works in both cases. Closes SF bug #761830. Index: l2hinit.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/l2hinit.perl,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** l2hinit.perl 3 May 2003 02:07:22 -0000 1.73 --- l2hinit.perl 27 Jun 2003 18:26:01 -0000 1.74 *************** *** 402,405 **** --- 402,406 ---- # In addition to the standard stuff, add label to allow named node files and # support suppression of the page complete (for HTML Help use). + $MY_CONTENTS_PAGE = ''; sub do_cmd_tableofcontents { local($_) = @_; *************** *** 408,411 **** --- 409,413 ---- my($closures, $reopens) = preserve_open_tags(); anchor_label('contents', $CURRENT_FILE, $_); # this is added + $MY_CONTENTS_PAGE = "$CURRENT_FILE"; join('', "
    \n\\tableofchildlinks[off]", $closures , make_section_heading($toc_title, 'H2'), $toc_mark *************** *** 653,657 **** '>', ($HAVE_TABLE_OF_CONTENTS ! ? "\n" : ''), ($HAVE_GENERAL_INDEX --- 655,660 ---- '>', ($HAVE_TABLE_OF_CONTENTS ! ? ("\n') : ''), ($HAVE_GENERAL_INDEX From fdrake@users.sourceforge.net Fri Jun 27 19:27:23 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 27 Jun 2003 11:27:23 -0700 Subject: [Python-checkins] python/dist/src/Doc/perl l2hinit.perl,1.58.6.1,1.58.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory sc8-pr-cvs1:/tmp/cvs-serv30192 Modified Files: Tag: release22-maint l2hinit.perl Log Message: Don't assume the name of the table of contents will be contents.html; that won't be right when mkhowto is called with --numeric (as it is for the Python Tutorial). Save the actual name we use when we build the table of contents, then use that in the page head metadata. The node2label.pl script will munge this properly when --numeric isn't given, so this works in both cases. Closes SF bug #761830. Index: l2hinit.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/l2hinit.perl,v retrieving revision 1.58.6.1 retrieving revision 1.58.6.2 diff -C2 -d -r1.58.6.1 -r1.58.6.2 *** l2hinit.perl 22 Mar 2002 17:23:03 -0000 1.58.6.1 --- l2hinit.perl 27 Jun 2003 18:27:21 -0000 1.58.6.2 *************** *** 386,389 **** --- 386,390 ---- # In addition to the standard stuff, add label to allow named node files and # support suppression of the page complete (for HTML Help use). + $MY_CONTENTS_PAGE = ''; sub do_cmd_tableofcontents { local($_) = @_; *************** *** 392,395 **** --- 393,397 ---- my($closures,$reopens) = preserve_open_tags(); anchor_label('contents', $CURRENT_FILE, $_); # this is added + $MY_CONTENTS_PAGE = "$CURRENT_FILE"; join('', "
    \n\\tableofchildlinks[off]", $closures , make_section_heading($toc_title, 'H2'), $toc_mark *************** *** 620,625 **** "\n", ($HAVE_TABLE_OF_CONTENTS ! ? ('' ! . "\n") : ''), ($HAVE_GENERAL_INDEX --- 622,627 ---- "\n", ($HAVE_TABLE_OF_CONTENTS ! ? ("\n") : ''), ($HAVE_GENERAL_INDEX From jhylton@users.sourceforge.net Fri Jun 27 19:41:22 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 27 Jun 2003 11:41:22 -0700 Subject: [Python-checkins] python/dist/src/Lib inspect.py,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv1360 Modified Files: inspect.py Log Message: A bit o' reformatting and removal of non-_getframe currentframe(). Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** inspect.py 27 Jun 2003 18:14:39 -0000 1.45 --- inspect.py 27 Jun 2003 18:41:20 -0000 1.46 *************** *** 310,319 **** if hasattr(object, '__file__'): return object.__file__ ! raise TypeError, 'arg is a built-in module' if isclass(object): object = sys.modules.get(object.__module__) if hasattr(object, '__file__'): return object.__file__ ! raise TypeError, 'arg is a built-in class' if ismethod(object): object = object.im_func --- 310,319 ---- if hasattr(object, '__file__'): return object.__file__ ! raise TypeError('arg is a built-in module') if isclass(object): object = sys.modules.get(object.__module__) if hasattr(object, '__file__'): return object.__file__ ! raise TypeError('arg is a built-in class') if ismethod(object): object = object.im_func *************** *** 326,331 **** if iscode(object): return object.co_filename ! raise TypeError, 'arg is not a module, class, method, ' \ ! 'function, traceback, frame, or code object' def getmoduleinfo(path): --- 326,331 ---- if iscode(object): return object.co_filename ! raise TypeError('arg is not a module, class, method, ' ! 'function, traceback, frame, or code object') def getmoduleinfo(path): *************** *** 406,410 **** lines = linecache.getlines(file) if not lines: ! raise IOError, 'could not get source code' if ismodule(object): --- 406,410 ---- lines = linecache.getlines(file) if not lines: ! raise IOError('could not get source code') if ismodule(object): *************** *** 416,420 **** for i in range(len(lines)): if pat.match(lines[i]): return lines, i ! else: raise IOError, 'could not find class definition' if ismethod(object): --- 416,421 ---- for i in range(len(lines)): if pat.match(lines[i]): return lines, i ! else: ! raise IOError('could not find class definition') if ismethod(object): *************** *** 428,432 **** if iscode(object): if not hasattr(object, 'co_firstlineno'): ! raise IOError, 'could not find function definition' lnum = object.co_firstlineno - 1 pat = re.compile(r'^(\s*def\s)|(.*\slambda(:|\s))') --- 429,433 ---- if iscode(object): if not hasattr(object, 'co_firstlineno'): ! raise IOError('could not find function definition') lnum = object.co_firstlineno - 1 pat = re.compile(r'^(\s*def\s)|(.*\slambda(:|\s))') *************** *** 435,439 **** lnum = lnum - 1 return lines, lnum ! raise IOError, 'could not find code object' def getcomments(object): --- 436,440 ---- lnum = lnum - 1 return lines, lnum ! raise IOError('could not find code object') def getcomments(object): *************** *** 513,517 **** elif type == tokenize.DEDENT: self.indent = self.indent - 1 ! if self.indent == 0: raise EndOfBlock, self.last elif type == tokenize.NAME and scol == 0: raise EndOfBlock, self.last --- 514,519 ---- elif type == tokenize.DEDENT: self.indent = self.indent - 1 ! if self.indent == 0: ! raise EndOfBlock, self.last elif type == tokenize.NAME and scol == 0: raise EndOfBlock, self.last *************** *** 740,744 **** frame = frame.tb_frame if not isframe(frame): ! raise TypeError, 'arg is not a frame or traceback object' filename = getsourcefile(frame) or getfile(frame) --- 742,746 ---- frame = frame.tb_frame if not isframe(frame): ! raise TypeError('arg is not a frame or traceback object') filename = getsourcefile(frame) or getfile(frame) *************** *** 787,802 **** return framelist ! def currentframe(): ! """Return the frame object for the caller's stack frame.""" ! try: ! 1/0 ! except ZeroDivisionError: ! return sys.exc_info()[2].tb_frame.f_back ! ! if hasattr(sys, '_getframe'): currentframe = sys._getframe def stack(context=1): """Return a list of records for the stack above the caller's frame.""" ! return getouterframes(currentframe().f_back, context) def trace(context=1): --- 789,797 ---- return framelist ! currentframe = sys._getframe def stack(context=1): """Return a list of records for the stack above the caller's frame.""" ! return getouterframes(sys._getframe(1), context) def trace(context=1): From jhylton@users.sourceforge.net Fri Jun 27 19:43:14 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 27 Jun 2003 11:43:14 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_inspect.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv1655 Modified Files: test_inspect.py Log Message: Add a trivial test of getargspec() with a method. Index: test_inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_inspect.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_inspect.py 3 May 2003 09:58:26 -0000 1.11 --- test_inspect.py 27 Jun 2003 18:43:12 -0000 1.12 *************** *** 153,172 **** 'getcomments(mod.StupidGit)') - args, varargs, varkw, defaults = inspect.getargspec(mod.eggs) - test(args == ['x', 'y'], 'mod.eggs args') - test(varargs == None, 'mod.eggs varargs') - test(varkw == None, 'mod.eggs varkw') - test(defaults == None, 'mod.eggs defaults') - test(inspect.formatargspec(args, varargs, varkw, defaults) == - '(x, y)', 'mod.eggs formatted argspec') - args, varargs, varkw, defaults = inspect.getargspec(mod.spam) - test(args == ['a', 'b', 'c', 'd', ['e', ['f']]], 'mod.spam args') - test(varargs == 'g', 'mod.spam varargs') - test(varkw == 'h', 'mod.spam varkw') - test(defaults == (3, (4, (5,))), 'mod.spam defaults') - test(inspect.formatargspec(args, varargs, varkw, defaults) == - '(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h)', - 'mod.spam formatted argspec') - git.abuse(7, 8, 9) --- 153,156 ---- *************** *** 366,367 **** --- 350,372 ---- test(('m1', 'method', D) in attrs, 'missing plain method') test(('datablob', 'data', A) in attrs, 'missing data') + + args, varargs, varkw, defaults = inspect.getargspec(mod.eggs) + test(args == ['x', 'y'], 'mod.eggs args') + test(varargs == None, 'mod.eggs varargs') + test(varkw == None, 'mod.eggs varkw') + test(defaults == None, 'mod.eggs defaults') + test(inspect.formatargspec(args, varargs, varkw, defaults) == + '(x, y)', 'mod.eggs formatted argspec') + args, varargs, varkw, defaults = inspect.getargspec(mod.spam) + test(args == ['a', 'b', 'c', 'd', ['e', ['f']]], 'mod.spam args') + test(varargs == 'g', 'mod.spam varargs') + test(varkw == 'h', 'mod.spam varkw') + test(defaults == (3, (4, (5,))), 'mod.spam defaults') + test(inspect.formatargspec(args, varargs, varkw, defaults) == + '(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h)', + 'mod.spam formatted argspec') + args, varargs, varkw, defaults = inspect.getargspec(A.m) + test(args == ['self'], 'A.m args') + test(varargs is None, 'A.m varargs') + test(varkw is None, 'A.m varkw') + test(defaults is None, 'A.m defaults') From montanaro@users.sourceforge.net Fri Jun 27 20:09:36 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 27 Jun 2003 12:09:36 -0700 Subject: [Python-checkins] python/dist/src/Lib trace.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv5843 Modified Files: trace.py Log Message: add mention of -l, --listfuncs to usage() small part of 542562 Index: trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/trace.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** trace.py 26 Jun 2003 14:56:17 -0000 1.8 --- trace.py 27 Jun 2003 19:09:33 -0000 1.9 *************** *** 75,78 **** --- 75,81 ---- module executed, in the module's directory. See also `--coverdir', `--file', `--no-report' below. + -l, --listfuncs Keep track of which functions are executed at least + once and write the results to sys.stdout after the the + program exits. -r, --report Generate a report from a counts file; do not execute any code. `--file' must specify the results file to From fdrake@users.sourceforge.net Fri Jun 27 20:22:13 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 27 Jun 2003 12:22:13 -0700 Subject: [Python-checkins] python/dist/src/Lib trace.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv7876 Modified Files: trace.py Log Message: fix typo Index: trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/trace.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** trace.py 27 Jun 2003 19:09:33 -0000 1.9 --- trace.py 27 Jun 2003 19:22:11 -0000 1.10 *************** *** 76,80 **** See also `--coverdir', `--file', `--no-report' below. -l, --listfuncs Keep track of which functions are executed at least ! once and write the results to sys.stdout after the the program exits. -r, --report Generate a report from a counts file; do not execute --- 76,80 ---- See also `--coverdir', `--file', `--no-report' below. -l, --listfuncs Keep track of which functions are executed at least ! once and write the results to sys.stdout after the program exits. -r, --report Generate a report from a counts file; do not execute From niemeyer@users.sourceforge.net Fri Jun 27 20:33:40 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Fri, 27 Jun 2003 12:33:40 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils/command build_scripts.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1:/tmp/cvs-serv9490 Modified Files: build_scripts.py Log Message: Do not add extra "\n" after bang line. Index: build_scripts.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_scripts.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** build_scripts.py 29 Jan 2003 16:58:31 -0000 1.20 --- build_scripts.py 27 Jun 2003 19:33:38 -0000 1.21 *************** *** 16,20 **** # check if Python is called on the first line with this expression ! first_line_re = re.compile(r'^#!.*python[0-9.]*(\s+.*)?$') class build_scripts (Command): --- 16,20 ---- # check if Python is called on the first line with this expression ! first_line_re = re.compile('^#!.*python[0-9.]*([ \t].*)?$') class build_scripts (Command): *************** *** 97,101 **** post_interp)) else: ! outf.write("#!%s%s" % (os.path.join( sysconfig.get_config_var("BINDIR"), --- 97,101 ---- post_interp)) else: ! outf.write("#!%s%s\n" % (os.path.join( sysconfig.get_config_var("BINDIR"), From montanaro@users.sourceforge.net Fri Jun 27 20:37:18 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 27 Jun 2003 12:37:18 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils/command install_scripts.py,1.10.26.1,1.10.26.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1:/tmp/cvs-serv10199 Modified Files: Tag: release22-maint install_scripts.py Log Message: backport of fix from 1.15 to make sure installed scripts have the read bit set. Index: install_scripts.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/install_scripts.py,v retrieving revision 1.10.26.1 retrieving revision 1.10.26.2 diff -C2 -d -r1.10.26.1 -r1.10.26.2 *** install_scripts.py 22 Feb 2002 13:19:54 -0000 1.10.26.1 --- install_scripts.py 27 Jun 2003 19:37:16 -0000 1.10.26.2 *************** *** 51,55 **** self.announce("changing mode of %s" % file) else: ! mode = ((os.stat(file)[ST_MODE]) | 0111) & 07777 self.announce("changing mode of %s to %o" % (file, mode)) os.chmod(file, mode) --- 51,55 ---- self.announce("changing mode of %s" % file) else: ! mode = ((os.stat(file)[ST_MODE]) | 0555) & 07777 self.announce("changing mode of %s to %o" % (file, mode)) os.chmod(file, mode) From tim_one@users.sourceforge.net Fri Jun 27 21:48:07 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 27 Jun 2003 13:48:07 -0700 Subject: [Python-checkins] python/dist/src/Lib doctest.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv21606/Lib Modified Files: doctest.py Log Message: A hack to ease compatibility with pre-2.3 Pythons: by default, doctest now accepts "True" when a test expects "1", and similarly for "False" versus "0". This is un-doctest-like, but on balance makes it much more pleasant to write doctests that pass under 2.2 and 2.3. I expect it to go away again, when 2.2 is forgotten. In the meantime, there's a new doctest module constant that can be passed to a new optional argument, if you want to turn this behavior off. Note that this substitution is very simple-minded: the expected and actual outputs have to consist of single tokens. No attempt is made, e.g., to accept [True, False] when a test expects [1, 0]. This is a simple hack for simple tests, and I intend to keep it that way. Index: doctest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/doctest.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** doctest.py 22 Nov 2002 08:23:09 -0000 1.25 --- doctest.py 27 Jun 2003 20:48:05 -0000 1.26 *************** *** 298,301 **** --- 298,304 ---- from inspect import classify_class_attrs as _classify_class_attrs + # Option constants. + DONT_ACCEPT_TRUE_FOR_1 = 1 << 0 + # Extract interactive examples from a string. Return a list of triples, # (source, outcome, lineno). "source" is the source code, and ends *************** *** 415,419 **** def _run_examples_inner(out, fakeout, examples, globs, verbose, name, ! compileflags): import sys, traceback OK, BOOM, FAIL = range(3) --- 418,422 ---- def _run_examples_inner(out, fakeout, examples, globs, verbose, name, ! compileflags, optionflags): import sys, traceback OK, BOOM, FAIL = range(3) *************** *** 450,454 **** if state == OK: ! if got == want: if verbose: out("ok\n") --- 453,461 ---- if state == OK: ! if (got == want or ! (not (optionflags & DONT_ACCEPT_TRUE_FOR_1) and ! (got, want) in (("True\n", "1\n"), ("False\n", "0\n")) ! ) ! ): if verbose: out("ok\n") *************** *** 483,487 **** # Return (#failures, #tries). ! def _run_examples(examples, globs, verbose, name, compileflags): import sys saveout = sys.stdout --- 490,495 ---- # Return (#failures, #tries). ! def _run_examples(examples, globs, verbose, name, compileflags, ! optionflags): import sys saveout = sys.stdout *************** *** 490,494 **** sys.stdout = fakeout = _SpoofOut() x = _run_examples_inner(saveout.write, fakeout, examples, ! globs, verbose, name, compileflags) finally: sys.stdout = saveout --- 498,503 ---- sys.stdout = fakeout = _SpoofOut() x = _run_examples_inner(saveout.write, fakeout, examples, ! globs, verbose, name, compileflags, ! optionflags) finally: sys.stdout = saveout *************** *** 505,509 **** def run_docstring_examples(f, globs, verbose=0, name="NoName", ! compileflags=None): """f, globs, verbose=0, name="NoName" -> run examples from f.__doc__. --- 514,518 ---- def run_docstring_examples(f, globs, verbose=0, name="NoName", ! compileflags=None, optionflags=0): """f, globs, verbose=0, name="NoName" -> run examples from f.__doc__. *************** *** 534,538 **** if compileflags is None: compileflags = _extract_future_flags(globs) ! return _run_examples(e, globs, verbose, name, compileflags) def is_private(prefix, base): --- 543,547 ---- if compileflags is None: compileflags = _extract_future_flags(globs) ! return _run_examples(e, globs, verbose, name, compileflags, optionflags) def is_private(prefix, base): *************** *** 638,643 **** def __init__(self, mod=None, globs=None, verbose=None, ! isprivate=None): ! """mod=None, globs=None, verbose=None, isprivate=None See doctest.__doc__ for an overview. --- 647,653 ---- def __init__(self, mod=None, globs=None, verbose=None, ! isprivate=None, optionflags=0): ! """mod=None, globs=None, verbose=None, isprivate=None, ! optionflags=0 See doctest.__doc__ for an overview. *************** *** 659,662 **** --- 669,674 ---- whether a name is private. The default function is doctest.is_private; see its docs for details. + + See doctest.testmod docs for the meaning of optionflags. """ *************** *** 679,682 **** --- 691,696 ---- self.isprivate = isprivate + self.optionflags = optionflags + self.name2ft = {} # map name to (#failures, #trials) pair *************** *** 715,719 **** if e: f, t = _run_examples(e, self.globs, self.verbose, name, ! self.compileflags) if self.verbose: print f, "of", t, "examples failed in string", name --- 729,733 ---- if e: f, t = _run_examples(e, self.globs, self.verbose, name, ! self.compileflags, self.optionflags) if self.verbose: print f, "of", t, "examples failed in string", name *************** *** 1046,1051 **** def testmod(m=None, name=None, globs=None, verbose=None, isprivate=None, ! report=1): ! """m=None, name=None, globs=None, verbose=None, isprivate=None, report=1 Test examples in docstrings in functions and classes reachable --- 1060,1066 ---- def testmod(m=None, name=None, globs=None, verbose=None, isprivate=None, ! report=True, optionflags=0): ! """m=None, name=None, globs=None, verbose=None, isprivate=None, ! report=True, optionflags=0 Test examples in docstrings in functions and classes reachable *************** *** 1081,1084 **** --- 1096,1109 ---- detailed, else very brief (in fact, empty if all tests passed). + Optional keyword arg "optionflags" or's together module constants, + and defaults to 0. This is new in 2.3. Possible values: + + DONT_ACCEPT_TRUE_FOR_1 + By default, if an expected output block contains just "1", + an actual output block containing just "True" is considered + to be a match, and similarly for "0" versus "False". When + DONT_ACCEPT_TRUE_FOR_1 is specified, neither substitution + is allowed. + Advanced tomfoolery: testmod runs methods of a local instance of class doctest.Tester, then merges the results into (or creates) *************** *** 1103,1111 **** if name is None: name = m.__name__ ! tester = Tester(m, globs=globs, verbose=verbose, isprivate=isprivate) failures, tries = tester.rundoc(m, name) f, t = tester.rundict(m.__dict__, name, m) ! failures = failures + f ! tries = tries + t if hasattr(m, "__test__"): testdict = m.__test__ --- 1128,1137 ---- if name is None: name = m.__name__ ! tester = Tester(m, globs=globs, verbose=verbose, isprivate=isprivate, ! optionflags=optionflags) failures, tries = tester.rundoc(m, name) f, t = tester.rundict(m.__dict__, name, m) ! failures += f ! tries += t if hasattr(m, "__test__"): testdict = m.__test__ *************** *** 1115,1120 **** ".items(); " + `testdict`) f, t = tester.run__test__(testdict, name + ".__test__") ! failures = failures + f ! tries = tries + t if report: tester.summarize() --- 1141,1146 ---- ".items(); " + `testdict`) f, t = tester.run__test__(testdict, name + ".__test__") ! failures += f ! tries += t if report: tester.summarize() *************** *** 1175,1179 **** >>> x + y, x * y (3, 2) ! """ } --- 1201,1220 ---- >>> x + y, x * y (3, 2) ! """, ! "bool-int equivalence": r""" ! In 2.2, boolean expressions displayed ! 0 or 1. By default, we still accept ! them. This can be disabled by passing ! DONT_ACCEPT_TRUE_FOR_1 to the new ! optionflags argument. ! >>> 4 == 4 ! 1 ! >>> 4 == 4 ! True ! >>> 4 > 4 ! 0 ! >>> 4 > 4 ! False ! """, } From tim_one@users.sourceforge.net Fri Jun 27 21:48:07 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 27 Jun 2003 13:48:07 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libdoctest.tex,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv21606/Doc/lib Modified Files: libdoctest.tex Log Message: A hack to ease compatibility with pre-2.3 Pythons: by default, doctest now accepts "True" when a test expects "1", and similarly for "False" versus "0". This is un-doctest-like, but on balance makes it much more pleasant to write doctests that pass under 2.2 and 2.3. I expect it to go away again, when 2.2 is forgotten. In the meantime, there's a new doctest module constant that can be passed to a new optional argument, if you want to turn this behavior off. Note that this substitution is very simple-minded: the expected and actual outputs have to consist of single tokens. No attempt is made, e.g., to accept [True, False] when a test expects [1, 0]. This is a simple hack for simple tests, and I intend to keep it that way. Index: libdoctest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdoctest.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** libdoctest.tex 22 Nov 2002 08:23:09 -0000 1.10 --- libdoctest.tex 27 Jun 2003 20:48:05 -0000 1.11 *************** *** 399,402 **** --- 399,419 ---- doctest.testmod() \end{verbatim} + + \item WYSIWYG isn't always the case, starting in Python 2.3. The + string form of boolean results changed from \code{"0"} and + \code{"1"} to \code{"False"} and \code{"True"} in Python 2.3. + This makes it clumsy to write a doctest showing boolean results that + passes under multiple versions of Python. In Python 2.3, by default, + and as a special case, if an expected output block consists solely + of \code{"0"} and the actual output block consists solely of + \code{"False"}, that's accepted as an exact match, and similarly for + \code{"1"} versus \code{"True"}. This behavior can be turned off by + passing the new (in 2.3) module constant + \constant{DONT_ACCEPT_TRUE_FOR_1} as the value of \function{testmod()}'s + new (in 2.3) optional \var{optionflags} argument. Some years after + the integer spellings of booleans are history, this hack will + probably be removed again. + + \end{enumerate} From tim_one@users.sourceforge.net Fri Jun 27 21:48:08 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 27 Jun 2003 13:48:08 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.789,1.790 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv21606/Misc Modified Files: NEWS Log Message: A hack to ease compatibility with pre-2.3 Pythons: by default, doctest now accepts "True" when a test expects "1", and similarly for "False" versus "0". This is un-doctest-like, but on balance makes it much more pleasant to write doctests that pass under 2.2 and 2.3. I expect it to go away again, when 2.2 is forgotten. In the meantime, there's a new doctest module constant that can be passed to a new optional argument, if you want to turn this behavior off. Note that this substitution is very simple-minded: the expected and actual outputs have to consist of single tokens. No attempt is made, e.g., to accept [True, False] when a test expects [1, 0]. This is a simple hack for simple tests, and I intend to keep it that way. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.789 retrieving revision 1.790 diff -C2 -d -r1.789 -r1.790 *** NEWS 22 Jun 2003 01:42:19 -0000 1.789 --- NEWS 27 Jun 2003 20:48:05 -0000 1.790 *************** *** 84,87 **** --- 84,95 ---- ------- + - For compatibility with doctests created before 2.3, if an expected + output block consists solely of "1" and the actual output block + consists solely of "True", it's accepted as a match; similarly + for "0" and "False". This is quite un-doctest-like, but is practical. + The behavior can be disabled by passing the new doctest module + constant DONT_ACCEPT_TRUE_FOR_1 to the new optionflags optional + argument. + - The cgitb module has been extended to support plain text display (SF patch 569574). From rhettinger@users.sourceforge.net Fri Jun 27 22:43:41 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 27 Jun 2003 14:43:41 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_logging.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv31078/Lib/test Modified Files: test_logging.py Log Message: SF patch #761519: Fixes for bugs 760703 and 757821 SF bug #760703: SocketHandler and LogRecord don't work well together SF bug #757821: logging module docs Applied Vinay Sajip's patch with a few minor fixups and a NEWS item. Patched __init__.py - added new function makeLogRecord (for bug report 760703). Patched handlers.py - updated some docstrings and deleted some old commented-out code. Patched test_logging.py to make use of makeLogRecord. Patched liblogging.tex to fill documentation gaps (both 760703 and bug 757821). Index: test_logging.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_logging.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_logging.py 30 Apr 2003 05:32:32 -0000 1.8 --- test_logging.py 27 Jun 2003 21:43:39 -0000 1.9 *************** *** 71,76 **** chunk = chunk + self.connection.recv(slen - len(chunk)) obj = self.unPickle(chunk) ! record = logging.LogRecord(None, None, "", 0, "", (), None) ! record.__dict__.update(obj) self.handleLogRecord(record) except: --- 71,75 ---- chunk = chunk + self.connection.recv(slen - len(chunk)) obj = self.unPickle(chunk) ! record = logging.makeLogRecord(obj) self.handleLogRecord(record) except: From rhettinger@users.sourceforge.net Fri Jun 27 22:43:41 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 27 Jun 2003 14:43:41 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.790,1.791 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv31078/Misc Modified Files: NEWS Log Message: SF patch #761519: Fixes for bugs 760703 and 757821 SF bug #760703: SocketHandler and LogRecord don't work well together SF bug #757821: logging module docs Applied Vinay Sajip's patch with a few minor fixups and a NEWS item. Patched __init__.py - added new function makeLogRecord (for bug report 760703). Patched handlers.py - updated some docstrings and deleted some old commented-out code. Patched test_logging.py to make use of makeLogRecord. Patched liblogging.tex to fill documentation gaps (both 760703 and bug 757821). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.790 retrieving revision 1.791 diff -C2 -d -r1.790 -r1.791 *** NEWS 27 Jun 2003 20:48:05 -0000 1.790 --- NEWS 27 Jun 2003 21:43:38 -0000 1.791 *************** *** 84,87 **** --- 84,90 ---- ------- + - The logging module now has a new function, makeLogRecord() making + LogHandler easier to interact with DatagramHandler and SocketHandler. + - For compatibility with doctests created before 2.3, if an expected output block consists solely of "1" and the actual output block From rhettinger@users.sourceforge.net Fri Jun 27 22:43:41 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 27 Jun 2003 14:43:41 -0700 Subject: [Python-checkins] python/dist/src/Lib/logging __init__.py,1.10,1.11 handlers.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/logging In directory sc8-pr-cvs1:/tmp/cvs-serv31078/Lib/logging Modified Files: __init__.py handlers.py Log Message: SF patch #761519: Fixes for bugs 760703 and 757821 SF bug #760703: SocketHandler and LogRecord don't work well together SF bug #757821: logging module docs Applied Vinay Sajip's patch with a few minor fixups and a NEWS item. Patched __init__.py - added new function makeLogRecord (for bug report 760703). Patched handlers.py - updated some docstrings and deleted some old commented-out code. Patched test_logging.py to make use of makeLogRecord. Patched liblogging.tex to fill documentation gaps (both 760703 and bug 757821). Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/logging/__init__.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** __init__.py 23 Apr 2003 13:12:19 -0000 1.10 --- __init__.py 27 Jun 2003 21:43:39 -0000 1.11 *************** *** 37,42 **** __author__ = "Vinay Sajip " __status__ = "beta" ! __version__ = "0.4.8" ! __date__ = "22 April 2003" #--------------------------------------------------------------------------- --- 37,42 ---- __author__ = "Vinay Sajip " __status__ = "beta" ! __version__ = "0.4.8.1" ! __date__ = "26 June 2003" #--------------------------------------------------------------------------- *************** *** 233,236 **** --- 233,247 ---- msg = msg % self.args return msg + + def makeLogRecord(dict): + """ + Make a LogRecord whose attributes are defined by the specified dictionary, + This function is useful for converting a logging event received over + a socket connection (which is sent as a dictionary) into a LogRecord + instance. + """ + rv = LogRecord(None, None, "", 0, "", (), None) + rv.__dict__.update(dict) + return rv #--------------------------------------------------------------------------- Index: handlers.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/logging/handlers.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** handlers.py 23 Apr 2003 03:49:43 -0000 1.6 --- handlers.py 27 Jun 2003 21:43:39 -0000 1.7 *************** *** 112,117 **** a streaming socket. The socket is kept open across logging calls. If the peer resets it, an attempt is made to reconnect on the next call. ! Note that the very simple wire protocol used means that packet sizes ! are expected to be encodable within 16 bits (i.e. < 32767 bytes). """ --- 112,121 ---- a streaming socket. The socket is kept open across logging calls. If the peer resets it, an attempt is made to reconnect on the next call. ! The pickle which is sent is that of the LogRecord's attribute dictionary ! (__dict__), so that the receiver does not need to have the logging module ! installed in order to process the logging event. ! ! To unpickle the record at the receiving end into a LogRecord, use the ! makeLogRecord function. """ *************** *** 209,215 **** """ A handler class which writes logging records, in pickle format, to ! a datagram socket. Note that the very simple wire protocol used means ! that packet sizes are expected to be encodable within 16 bits ! (i.e. < 32767 bytes). """ --- 213,222 ---- """ A handler class which writes logging records, in pickle format, to ! a datagram socket. The pickle which is sent is that of the LogRecord's ! attribute dictionary (__dict__), so that the receiver does not need to ! have the logging module installed in order to process the logging event. ! ! To unpickle the record at the receiving end into a LogRecord, use the ! makeLogRecord function. """ *************** *** 237,248 **** can deliver packets out of sequence. """ - #old code - #sentsofar = 0 - #left = len(s) - #addr = (self.host, self.port) - #while left > 0: - # sent = self.sock.sendto(s[sentsofar:], addr) - # sentsofar = sentsofar + sent - # left = left - sent self.sock.sendto(s, (self.host, self.port)) --- 244,247 ---- From rhettinger@users.sourceforge.net Fri Jun 27 22:43:41 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 27 Jun 2003 14:43:41 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib liblogging.tex,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv31078/Doc/lib Modified Files: liblogging.tex Log Message: SF patch #761519: Fixes for bugs 760703 and 757821 SF bug #760703: SocketHandler and LogRecord don't work well together SF bug #757821: logging module docs Applied Vinay Sajip's patch with a few minor fixups and a NEWS item. Patched __init__.py - added new function makeLogRecord (for bug report 760703). Patched handlers.py - updated some docstrings and deleted some old commented-out code. Patched test_logging.py to make use of makeLogRecord. Patched liblogging.tex to fill documentation gaps (both 760703 and bug 757821). Index: liblogging.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liblogging.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** liblogging.tex 18 Feb 2003 14:20:05 -0000 1.8 --- liblogging.tex 27 Jun 2003 21:43:39 -0000 1.9 *************** *** 53,57 **** message (in the form of a \class{LogRecord}) ends up in a particular location (or set of locations) which is useful for the target audience for ! that message (e.g. end users, support desk staff, system administrators, developers). Handlers are passed \class{LogRecord} instances intended for particular destinations. Each logger can have zero, one or more handlers --- 53,57 ---- message (in the form of a \class{LogRecord}) ends up in a particular location (or set of locations) which is useful for the target audience for ! that message (such as end users, support desk staff, system administrators, developers). Handlers are passed \class{LogRecord} instances intended for particular destinations. Each logger can have zero, one or more handlers *************** *** 205,208 **** --- 205,215 ---- \end{funcdesc} + \begin{funcdesc}{makeLogRecord}{attrdict} + Creates and returns a new \class{LogRecord} instance whose attributes are + defined by \var{attrdict}. This function is useful for taking a pickled + \class{LogRecord} attribute dictionary, sent over a socket, and reconstituting + it as a \class{LogRecord} instance at the receiving end. + \end{funcdesc} + \begin{funcdesc}{basicConfig}{} Does basic configuration for the logging system by creating a *************** *** 267,271 **** \constant{NOTSET} has been set using \method{setLevel()}, it is returned. Otherwise, the hierarchy is traversed towards the root until a value ! other than \constant{NOTSET} is found,and that value is returned. \end{methoddesc} --- 274,278 ---- \constant{NOTSET} has been set using \method{setLevel()}, it is returned. Otherwise, the hierarchy is traversed towards the root until a value ! other than \constant{NOTSET} is found, and that value is returned. \end{methoddesc} *************** *** 536,542 **** \begin{methoddesc}{emit}{} ! Pickles the record and writes it to the socket in binary format. ! If there is an error with the socket, silently drops the packet. ! If the connection was previously lost, re-establishes the connection. \end{methoddesc} --- 543,551 ---- \begin{methoddesc}{emit}{} ! Pickles the record's attribute dictionary and writes it to the socket in ! binary format. If there is an error with the socket, silently drops the ! packet. If the connection was previously lost, re-establishes the connection. ! To unpickle the record at the receiving end into a LogRecord, use the ! \function{makeLogRecord} function. \end{methoddesc} *************** *** 554,559 **** \begin{methoddesc}{makePickle}{record} ! Pickles the record in binary format with a length prefix, and returns ! it ready for transmission across the socket. \end{methoddesc} --- 563,568 ---- \begin{methoddesc}{makePickle}{record} ! Pickles the record's attribute dictionary in binary format with a length ! prefix, and returns it ready for transmission across the socket. \end{methoddesc} *************** *** 575,580 **** \begin{methoddesc}{emit}{} ! Pickles the record and writes it to the socket in binary format. ! If there is an error with the socket, silently drops the packet. \end{methoddesc} --- 584,592 ---- \begin{methoddesc}{emit}{} ! Pickles the record's attribute dictionary and writes it to the socket in ! binary format. If there is an error with the socket, silently drops the ! packet. ! To unpickle the record at the receiving end into a LogRecord, use the ! \function{makeLogRecord} function. \end{methoddesc} *************** *** 585,590 **** \begin{methoddesc}{send}{s} ! Send a pickled string to a socket. This function allows for ! partial sends which can happen when the network is busy. \end{methoddesc} --- 597,601 ---- \begin{methoddesc}{send}{s} ! Send a pickled string to a socket. \end{methoddesc} *************** *** 790,795 **** A Formatter can be initialized with a format string which makes use of ! knowledge of the \class{LogRecord} attributes - e.g. the default value ! mentioned above makes use of the fact that the user's message and arguments are pre- formatted into a LogRecord's \var{message} attribute. Currently, the useful attributes in a LogRecord are --- 801,806 ---- A Formatter can be initialized with a format string which makes use of ! knowledge of the \class{LogRecord} attributes - such as the default value ! mentioned above making use of the fact that the user's message and arguments are pre- formatted into a LogRecord's \var{message} attribute. Currently, the useful attributes in a LogRecord are *************** *** 917,921 **** \subsubsection{Configuration functions} ! The following functions allow the logging module to be configured. \begin{funcdesc}{fileConfig}{fname\optional{, defaults}} --- 928,936 ---- \subsubsection{Configuration functions} ! The following functions allow the logging module to be configured. Before ! they can be used, you must import \module{logging.config}. Their use is optional - ! you can configure the logging module entirely by making calls to the main ! API (defined in \module{logging} itself) and defining handlers which are declared ! either in \module{logging} or \module{logging.handlers}. \begin{funcdesc}{fileConfig}{fname\optional{, defaults}} *************** *** 1014,1018 **** messages are \strong{not} propagated to handlers up the hierarchy. The \code{qualname} entry is the hierarchical channel name of the logger, ! i.e. the name used by the application to get the logger. Sections which specify handler configuration are exemplified by the --- 1029,1033 ---- messages are \strong{not} propagated to handlers up the hierarchy. The \code{qualname} entry is the hierarchical channel name of the logger, ! for example, the name used by the application to get the logger. Sections which specify handler configuration are exemplified by the From rhettinger@users.sourceforge.net Fri Jun 27 23:25:05 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 27 Jun 2003 15:25:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_zipfile.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv4923/Lib/test Modified Files: test_zipfile.py Log Message: SF patch #756996: Bare except in ZipFile.testzip() (Contributed by Steven Taschuk) Replaces a bare except that caused all errors to be mis-reported as archive errors. Added a related NEWS item. Index: test_zipfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_zipfile.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_zipfile.py 23 Jul 2002 19:04:09 -0000 1.9 --- test_zipfile.py 27 Jun 2003 22:25:03 -0000 1.10 *************** *** 77,78 **** --- 77,99 ---- raise TestFailed("expected creation of readable ZipFile without\n" " a file to raise an IOError.") + + + # Verify that testzip() doesn't swallow inappropriate exceptions. + data = StringIO.StringIO() + zipf = zipfile.ZipFile(data, mode="w") + zipf.writestr("foo.txt", "O, for a Muse of Fire!") + zipf.close() + zipf = zipfile.ZipFile(data, mode="r") + zipf.close() + try: + zipf.testzip() + except RuntimeError: + # This is correct; calling .read on a closed ZipFile should throw + # a RuntimeError, and so should calling .testzip. An earlier + # version of .testzip would swallow this exception (and any other) + # and report that the first file in the archive was corrupt. + pass + else: + raise TestFailed("expected calling .testzip on a closed ZipFile" + " to raise a RuntimeError") + del data, zipf From rhettinger@users.sourceforge.net Fri Jun 27 23:25:05 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 27 Jun 2003 15:25:05 -0700 Subject: [Python-checkins] python/dist/src/Lib zipfile.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv4923/Lib Modified Files: zipfile.py Log Message: SF patch #756996: Bare except in ZipFile.testzip() (Contributed by Steven Taschuk) Replaces a bare except that caused all errors to be mis-reported as archive errors. Added a related NEWS item. Index: zipfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/zipfile.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** zipfile.py 18 Jun 2003 00:54:28 -0000 1.30 --- zipfile.py 27 Jun 2003 22:25:03 -0000 1.31 *************** *** 328,332 **** try: self.read(zinfo.filename) # Check CRC-32 ! except: return zinfo.filename --- 328,332 ---- try: self.read(zinfo.filename) # Check CRC-32 ! except BadZipfile: return zinfo.filename From rhettinger@users.sourceforge.net Fri Jun 27 23:25:05 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 27 Jun 2003 15:25:05 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.791,1.792 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv4923/Misc Modified Files: NEWS Log Message: SF patch #756996: Bare except in ZipFile.testzip() (Contributed by Steven Taschuk) Replaces a bare except that caused all errors to be mis-reported as archive errors. Added a related NEWS item. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.791 retrieving revision 1.792 diff -C2 -d -r1.791 -r1.792 *** NEWS 27 Jun 2003 21:43:38 -0000 1.791 --- NEWS 27 Jun 2003 22:25:02 -0000 1.792 *************** *** 84,87 **** --- 84,91 ---- ------- + - ZipFile.testzip() now only traps BadZipfile exceptions. Previously, + a bare except caught to much and reported all errors as a problem + in the archive. + - The logging module now has a new function, makeLogRecord() making LogHandler easier to interact with DatagramHandler and SocketHandler. From fdrake@users.sourceforge.net Sat Jun 28 04:09:08 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 27 Jun 2003 20:09:08 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libdoctest.tex,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv4718/lib Modified Files: libdoctest.tex Log Message: fix markup nits Index: libdoctest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdoctest.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** libdoctest.tex 27 Jun 2003 20:48:05 -0000 1.11 --- libdoctest.tex 28 Jun 2003 03:09:06 -0000 1.12 *************** *** 154,158 **** If you want to test the module as the main module, you don't need to ! pass M to \function{testmod}; in this case, it will test the current module. --- 154,158 ---- If you want to test the module as the main module, you don't need to ! pass M to \function{testmod()}; in this case, it will test the current module. *************** *** 177,185 **** along with assorted summaries at the end. ! You can force verbose mode by passing \code{verbose=1} to testmod, or prohibit it by passing \code{verbose=0}. In either of those cases, ! \code{sys.argv} is not examined by testmod. ! In any case, testmod returns a 2-tuple of ints \code{(\var{f}, \var{t})}, where \var{f} is the number of docstring examples that failed and \var{t} is the total number of docstring examples --- 177,186 ---- along with assorted summaries at the end. ! You can force verbose mode by passing \code{verbose=1} to ! \function{testmod()}, or prohibit it by passing \code{verbose=0}. In either of those cases, ! \code{sys.argv} is not examined by \function{testmod()}. ! In any case, \function{testmod()} returns a 2-tuple of ints \code{(\var{f}, \var{t})}, where \var{f} is the number of docstring examples that failed and \var{t} is the total number of docstring examples *************** *** 211,216 **** \subsection{What's the Execution Context?} ! By default, each time testmod finds a docstring to test, it uses a ! \emph{copy} of \module{M}'s globals, so that running tests on a module doesn't change the module's real globals, and so that one test in \module{M} can't leave behind crumbs that accidentally allow another test --- 212,217 ---- \subsection{What's the Execution Context?} ! By default, each time \function{testmod()} finds a docstring to test, it uses ! a \emph{copy} of \module{M}'s globals, so that running tests on a module doesn't change the module's real globals, and so that one test in \module{M} can't leave behind crumbs that accidentally allow another test *************** *** 401,412 **** \item WYSIWYG isn't always the case, starting in Python 2.3. The ! string form of boolean results changed from \code{"0"} and ! \code{"1"} to \code{"False"} and \code{"True"} in Python 2.3. This makes it clumsy to write a doctest showing boolean results that passes under multiple versions of Python. In Python 2.3, by default, and as a special case, if an expected output block consists solely ! of \code{"0"} and the actual output block consists solely of ! \code{"False"}, that's accepted as an exact match, and similarly for ! \code{"1"} versus \code{"True"}. This behavior can be turned off by passing the new (in 2.3) module constant \constant{DONT_ACCEPT_TRUE_FOR_1} as the value of \function{testmod()}'s --- 402,413 ---- \item WYSIWYG isn't always the case, starting in Python 2.3. The ! string form of boolean results changed from \code{'0'} and ! \code{'1'} to \code{'False'} and \code{'True'} in Python 2.3. This makes it clumsy to write a doctest showing boolean results that passes under multiple versions of Python. In Python 2.3, by default, and as a special case, if an expected output block consists solely ! of \code{'0'} and the actual output block consists solely of ! \code{'False'}, that's accepted as an exact match, and similarly for ! \code{'1'} versus \code{'True'}. This behavior can be turned off by passing the new (in 2.3) module constant \constant{DONT_ACCEPT_TRUE_FOR_1} as the value of \function{testmod()}'s *************** *** 414,418 **** the integer spellings of booleans are history, this hack will probably be removed again. - \end{enumerate} --- 415,418 ---- From rhettinger@users.sourceforge.net Sat Jun 28 06:44:38 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 27 Jun 2003 22:44:38 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_itertools.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv19392/Lib/test Modified Files: test_itertools.py Log Message: Add take() to examples. Tighten the islice() example Index: test_itertools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_itertools.py 18 Jun 2003 19:25:37 -0000 1.13 --- test_itertools.py 28 Jun 2003 05:44:36 -0000 1.14 *************** *** 393,397 **** >>> reportlines = ['EuroPython', 'Roster', '', 'alex', '', 'laura', '', 'martin', '', 'walter', '', 'samuele'] ! >>> for name in islice(reportlines, 3, len(reportlines), 2): ... print name.title() ... --- 393,397 ---- >>> reportlines = ['EuroPython', 'Roster', '', 'alex', '', 'laura', '', 'martin', '', 'walter', '', 'samuele'] ! >>> for name in islice(reportlines, 3, None, 2): ... print name.title() ... *************** *** 450,453 **** --- 450,456 ---- ... yield result + >>> def take(n, seq): + ... return list(islice(seq, n)) + This is not part of the examples but it tests to make sure the definitions perform as purported. *************** *** 494,497 **** --- 497,503 ---- >>> dotproduct([1,2,3], [4,5,6]) 32 + + >>> take(10, count()) + [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] """ From rhettinger@users.sourceforge.net Sat Jun 28 06:44:38 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 27 Jun 2003 22:44:38 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libitertools.tex,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv19392/Doc/lib Modified Files: libitertools.tex Log Message: Add take() to examples. Tighten the islice() example Index: libitertools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libitertools.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** libitertools.tex 18 Jun 2003 19:25:37 -0000 1.10 --- libitertools.tex 28 Jun 2003 05:44:36 -0000 1.11 *************** *** 315,319 **** >>> reportlines = ['EuroPython', 'Roster', '', 'alex', '', 'laura', '', 'martin', '', 'walter', '', 'samuele'] ! >>> for name in islice(reportlines, 3, len(reportlines), 2): ... print name.title() ... --- 315,319 ---- >>> reportlines = ['EuroPython', 'Roster', '', 'alex', '', 'laura', '', 'martin', '', 'walter', '', 'samuele'] ! >>> for name in islice(reportlines, 3, None, 2): ... print name.title() ... *************** *** 380,383 **** --- 380,386 ---- ... result = result[1:] + (elem,) ... yield result + + >>> def take(n, seq): + ... return list(islice(seq, n)) \end{verbatim} From rhettinger@users.sourceforge.net Sat Jun 28 08:08:41 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 28 Jun 2003 00:08:41 -0700 Subject: [Python-checkins] python/dist/src/Lib dumbdbm.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv25990 Modified Files: dumbdbm.py Log Message: SF 662923: iterator for dbm keys When shelve and the bsdbm where expanded to a full mapping interface, this module was missed. Index: dumbdbm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/dumbdbm.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** dumbdbm.py 1 Mar 2003 22:58:00 -0000 1.20 --- dumbdbm.py 28 Jun 2003 07:08:39 -0000 1.21 *************** *** 24,27 **** --- 24,28 ---- import os as _os import __builtin__ + import UserDict _open = __builtin__.open *************** *** 31,35 **** error = IOError # For anydbm ! class _Database: def __init__(self, file, mode): --- 32,36 ---- error = IOError # For anydbm ! class _Database(UserDict.DictMixin): def __init__(self, file, mode): From loewis@users.sourceforge.net Sat Jun 28 08:40:27 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 28 Jun 2003 00:40:27 -0700 Subject: [Python-checkins] python/dist/src/Modules _ssl.c,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv28637 Modified Files: _ssl.c Log Message: Patch #751916: Check for signals, fix some refcounting errors. Index: _ssl.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_ssl.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** _ssl.c 2 Feb 2003 17:08:33 -0000 1.11 --- _ssl.c 28 Jun 2003 07:40:23 -0000 1.12 *************** *** 246,249 **** --- 246,252 ---- err = SSL_get_error(self->ssl, ret); Py_END_ALLOW_THREADS + if(PyErr_CheckSignals()) { + goto fail; + } if (err == SSL_ERROR_WANT_READ) { timedout = wait_for_timeout(Sock, 0); *************** *** 252,257 **** } if (timedout) { ! PyErr_SetString(PySSLErrorObject, "The connect operation timed out"); ! return NULL; } } while (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE); --- 255,260 ---- } if (timedout) { ! errstr = "The connect operation timed out"; ! goto fail; } } while (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE); *************** *** 388,391 **** --- 391,397 ---- err = SSL_get_error(self->ssl, len); Py_END_ALLOW_THREADS + if(PyErr_CheckSignals()) { + return NULL; + } if (err == SSL_ERROR_WANT_READ) { timedout = wait_for_timeout(self->Socket, 0); *************** *** 435,438 **** --- 441,448 ---- err = SSL_get_error(self->ssl, count); Py_END_ALLOW_THREADS + if(PyErr_CheckSignals()) { + Py_DECREF(buf); + return NULL; + } if (err == SSL_ERROR_WANT_READ) { timedout = wait_for_timeout(self->Socket, 0); *************** *** 442,445 **** --- 452,456 ---- if (timedout) { PyErr_SetString(PySSLErrorObject, "The read operation timed out"); + Py_DECREF(buf); return NULL; } From loewis@users.sourceforge.net Sat Jun 28 08:46:41 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 28 Jun 2003 00:46:41 -0700 Subject: [Python-checkins] python/dist/src configure,1.407,1.408 configure.in,1.418,1.419 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv29066 Modified Files: configure configure.in Log Message: Patch #758910: Add pthread flag to CXX if possible. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.407 retrieving revision 1.408 diff -C2 -d -r1.407 -r1.408 *** configure 14 Jun 2003 21:03:05 -0000 1.407 --- configure 28 Jun 2003 07:46:31 -0000 1.408 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.417 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.418 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 4018,4021 **** --- 4018,4064 ---- echo "${ECHO_T}$ac_cv_pthread" >&6 fi + + # If we have set a CC compiler flag for thread support then + # check if it works for CXX, too. + ac_cv_cxx_thread=no + if test ! -z "$CXX" + then + echo "$as_me:$LINENO: checking whether $CXX also accepts flags for thread support" >&5 + echo $ECHO_N "checking whether $CXX also accepts flags for thread support... $ECHO_C" >&6 + ac_save_cxx="$CXX" + + if test "$ac_cv_kpthread" = "yes" + then + CXX="$CXX -Kpthread" + ac_cv_cxx_thread=yes + elif test "$ac_cv_kthread" = "yes" + then + CXX="$CXX -Kthread" + ac_cv_cxx_thread=yes + elif test "$ac_cv_pthread" = "yes" + then + CXX="$CXX -pthread" + ac_cv_cxx_thread=yes + fi + + if test $ac_cv_cxx_thread = yes + then + echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext + $CXX -c conftest.$ac_ext 2>&5 + if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \ + && test -s conftest$ac_exeext && ./conftest$ac_exeext + then + ac_cv_cxx_thread=yes + else + ac_cv_cxx_thread=no + CXX="$ac_save_cxx" + fi + rm -fr conftest* + else + CXX="$ac_save_cxx" + fi + fi + echo "$as_me:$LINENO: result: $ac_cv_cxx_thread" >&5 + echo "${ECHO_T}$ac_cv_cxx_thread" >&6 Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.418 retrieving revision 1.419 diff -C2 -d -r1.418 -r1.419 *** configure.in 14 Jun 2003 21:03:05 -0000 1.418 --- configure.in 28 Jun 2003 07:46:38 -0000 1.419 *************** *** 833,836 **** --- 833,877 ---- fi + # If we have set a CC compiler flag for thread support then + # check if it works for CXX, too. + ac_cv_cxx_thread=no + if test ! -z "$CXX" + then + AC_MSG_CHECKING(whether $CXX also accepts flags for thread support) + ac_save_cxx="$CXX" + + if test "$ac_cv_kpthread" = "yes" + then + CXX="$CXX -Kpthread" + ac_cv_cxx_thread=yes + elif test "$ac_cv_kthread" = "yes" + then + CXX="$CXX -Kthread" + ac_cv_cxx_thread=yes + elif test "$ac_cv_pthread" = "yes" + then + CXX="$CXX -pthread" + ac_cv_cxx_thread=yes + fi + + if test $ac_cv_cxx_thread = yes + then + echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext + $CXX -c conftest.$ac_ext 2>&5 + if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \ + && test -s conftest$ac_exeext && ./conftest$ac_exeext + then + ac_cv_cxx_thread=yes + else + ac_cv_cxx_thread=no + CXX="$ac_save_cxx" + fi + rm -fr conftest* + else + CXX="$ac_save_cxx" + fi + fi + AC_MSG_RESULT($ac_cv_cxx_thread) + dnl # check for ANSI or K&R ("traditional") preprocessor dnl AC_MSG_CHECKING(for C preprocessor type) From loewis@users.sourceforge.net Sat Jun 28 09:11:57 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 28 Jun 2003 01:11:57 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.187,1.188 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv31491 Modified Files: tut.tex Log Message: Explain source encodings. Fixes #683486. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.187 retrieving revision 1.188 diff -C2 -d -r1.187 -r1.188 *** tut.tex 20 Jun 2003 14:27:27 -0000 1.187 --- tut.tex 28 Jun 2003 08:11:55 -0000 1.188 *************** *** 304,307 **** --- 304,340 ---- comment in Python. + \subsection{Source Code Encoding} + + It is possible to use encodings different than ASCII in Python source + files. The best way to do it is to put one more special comment line + right after \code{#!} line making proper encoding declaration: + + \begin{verbatim} + # -*- coding: iso-8859-1 -*- + \end{verbatim} + + With that declaration, all characters in the source file will be + treated as belonging to \code{iso-8859-1} encoding, and it will be + possible to directly write Unicode string literals in the selected + encoding. The list of possible encodings can be found in the + \citetitle[../lib/lib.html]{Python Library Reference}, in the section + on \module{codecs}. + + If your editor supports saving files as \code{UTF-8} with an UTF-8 + signature (aka BOM -- Byte Order Mark), you can use that instead of an + encoding declaration. IDLE supports such saving if + \code{Options/General/Default Source Encoding/UTF-8} is set. Notice + that this signature is not understood in older Python releases (2.2 + and earlier), and also not understood by the operating system for + \code{#!} files. + + By using UTF-8 (either through the signature, or a an encoding + declaration), characters of most languages in the world can be used + simultaneously in string literals and comments. Using non-ASCII + characters in identifiers is not supported. To display all these + characters properly, your editor must recognize that the file is + UTF-8, and it must use a font that supports all the characters in the + file. + \subsection{The Interactive Startup File \label{startup}} From fdrake@users.sourceforge.net Sat Jun 28 12:50:36 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sat, 28 Jun 2003 04:50:36 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.188,1.189 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv18276/tut Modified Files: tut.tex Log Message: Correct markup errors that prevented formatting. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.188 retrieving revision 1.189 diff -C2 -d -r1.188 -r1.189 *** tut.tex 28 Jun 2003 08:11:55 -0000 1.188 --- tut.tex 28 Jun 2003 11:50:34 -0000 1.189 *************** *** 308,312 **** It is possible to use encodings different than ASCII in Python source files. The best way to do it is to put one more special comment line ! right after \code{#!} line making proper encoding declaration: \begin{verbatim} --- 308,312 ---- It is possible to use encodings different than ASCII in Python source files. The best way to do it is to put one more special comment line ! right after \code{\#!} line making proper encoding declaration: \begin{verbatim} *************** *** 327,331 **** that this signature is not understood in older Python releases (2.2 and earlier), and also not understood by the operating system for ! \code{#!} files. By using UTF-8 (either through the signature, or a an encoding --- 327,331 ---- that this signature is not understood in older Python releases (2.2 and earlier), and also not understood by the operating system for ! \code{\#!} files. By using UTF-8 (either through the signature, or a an encoding From dcjim@users.sourceforge.net Sat Jun 28 12:53:14 2003 From: dcjim@users.sourceforge.net (dcjim@users.sourceforge.net) Date: Sat, 28 Jun 2003 04:53:14 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext newtypes.tex,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1:/tmp/cvs-serv18456a Modified Files: newtypes.tex Log Message: Changed the assignment of PyType_GenericNew to tp_new slot. Now do this in module initialization before calling PyType_Ready. (Sorry Tim.) This is necessary to compile on cygwin. AFAIK, we support cygwin. If so, then we need to write extentions this way. Fixed bug in implementation of tp_init function. It should be an int function, not a PyObject *. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/newtypes.tex,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** newtypes.tex 16 May 2003 14:36:26 -0000 1.27 --- newtypes.tex 28 Jun 2003 11:53:12 -0000 1.28 *************** *** 100,120 **** Py_TPFLAGS_DEFAULT, /*tp_flags*/ "Noddy objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ }; \end{verbatim} --- 100,103 ---- *************** *** 210,217 **** \member{tp_new} implementation. In this case, we can just use the default implementation provided by the API function ! \cfunction{PyType_GenericNew}. \begin{verbatim} ! PyType_GenericNew, /* tp_new */ \end{verbatim} --- 193,207 ---- \member{tp_new} implementation. In this case, we can just use the default implementation provided by the API function ! \cfunction{PyType_GenericNew}. We'd like to just assign this to the ! \member{tp_new} slot, but we can't, for portability sake, On some ! platforms or compilers, we can't statically initialize a structure ! member with a function defined in another C module, so, instead, we'll ! assign the \member{tp_new} slot in the module initialization function ! just before calling \cfunction{PyType_Ready()}: \begin{verbatim} ! noddy_NoddyType.tp_new = PyType_GenericNew; ! if (PyType_Ready(&noddy_NoddyType) < 0) ! return; \end{verbatim} *************** *** 398,402 **** \begin{verbatim} ! static PyObject * Noddy_init(Noddy *self, PyObject *args, PyObject *kwds) { --- 388,392 ---- \begin{verbatim} ! static int Noddy_init(Noddy *self, PyObject *args, PyObject *kwds) { *************** *** 408,412 **** &first, &last, &self->number)) ! return NULL; if (first) { --- 398,402 ---- &first, &last, &self->number)) ! return -1; if (first) { *************** *** 422,427 **** } ! Py_INCREF(Py_None); ! return Py_None; } \end{verbatim} --- 412,416 ---- } ! return 0; } \end{verbatim} From dcjim@users.sourceforge.net Sat Jun 28 12:53:32 2003 From: dcjim@users.sourceforge.net (dcjim@users.sourceforge.net) Date: Sat, 28 Jun 2003 04:53:32 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext noddy.c,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1:/tmp/cvs-serv18550 Modified Files: noddy.c Log Message: Changed the assignment of PyType_GenericNew to tp_new slot. Now do this in module initialization before calling PyType_Ready. (Sorry Tim.) This is necessary to compile on cygwin. AFAIK, we support cygwin. If so, then we need to write extentions this way. Index: noddy.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/noddy.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** noddy.c 25 May 2003 17:59:37 -0000 1.7 --- noddy.c 28 Jun 2003 11:53:29 -0000 1.8 *************** *** 29,49 **** Py_TPFLAGS_DEFAULT, /*tp_flags*/ "Noddy objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ }; --- 29,32 ---- *************** *** 60,63 **** --- 43,47 ---- PyObject* m; + noddy_NoddyType.tp_new = PyType_GenericNew; if (PyType_Ready(&noddy_NoddyType) < 0) return; From dcjim@users.sourceforge.net Sat Jun 28 12:53:49 2003 From: dcjim@users.sourceforge.net (dcjim@users.sourceforge.net) Date: Sat, 28 Jun 2003 04:53:49 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext noddy2.c,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1:/tmp/cvs-serv18589 Modified Files: noddy2.c Log Message: Fixed bug in implementation of tp_init function. It should be an int function, not a PyObject *. Index: noddy2.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/noddy2.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** noddy2.c 25 May 2003 17:59:38 -0000 1.3 --- noddy2.c 28 Jun 2003 11:53:47 -0000 1.4 *************** *** 44,48 **** } ! static PyObject * Noddy_init(Noddy *self, PyObject *args, PyObject *kwds) { --- 44,48 ---- } ! static int Noddy_init(Noddy *self, PyObject *args, PyObject *kwds) { *************** *** 54,58 **** &first, &last, &self->number)) ! return NULL; if (first) { --- 54,58 ---- &first, &last, &self->number)) ! return -1; if (first) { *************** *** 68,73 **** } ! Py_INCREF(Py_None); ! return Py_None; } --- 68,72 ---- } ! return 0; } From dcjim@users.sourceforge.net Sat Jun 28 12:54:22 2003 From: dcjim@users.sourceforge.net (dcjim@users.sourceforge.net) Date: Sat, 28 Jun 2003 04:54:22 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext setup.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1:/tmp/cvs-serv18692 Added Files: setup.py Log Message: Added s setup module to make it easier to test the sample modules. --- NEW FILE: setup.py --- from distutils.core import setup, Extension setup(name="noddy", version="1.0", ext_modules=[ Extension("noddy", ["noddy.c"]), Extension("noddy2", ["noddy2.c"]), Extension("noddy3", ["noddy3.c"]), ]) From dcjim@users.sourceforge.net Sat Jun 28 12:54:05 2003 From: dcjim@users.sourceforge.net (dcjim@users.sourceforge.net) Date: Sat, 28 Jun 2003 04:54:05 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext noddy3.c,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1:/tmp/cvs-serv18618 Modified Files: noddy3.c Log Message: Fixed bug in implementation of tp_init function. It should be an int function, not a PyObject *. Index: noddy3.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/noddy3.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** noddy3.c 25 May 2003 17:59:38 -0000 1.3 --- noddy3.c 28 Jun 2003 11:54:03 -0000 1.4 *************** *** 44,48 **** } ! static PyObject * Noddy_init(Noddy *self, PyObject *args, PyObject *kwds) { --- 44,48 ---- } ! static int Noddy_init(Noddy *self, PyObject *args, PyObject *kwds) { *************** *** 54,58 **** &first, &last, &self->number)) ! return NULL; if (first) { --- 54,58 ---- &first, &last, &self->number)) ! return -1; if (first) { *************** *** 68,73 **** } ! Py_INCREF(Py_None); ! return Py_None; } --- 68,72 ---- } ! return 0; } From dcjim@users.sourceforge.net Sat Jun 28 12:54:42 2003 From: dcjim@users.sourceforge.net (dcjim@users.sourceforge.net) Date: Sat, 28 Jun 2003 04:54:42 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext test.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1:/tmp/cvs-serv18722 Added Files: test.py Log Message: Added tests for sample modules. --- NEW FILE: test.py --- """Test module for the noddy examples Noddy 1: >>> import noddy >>> n1 = noddy.Noddy() >>> n2 = noddy.Noddy() >>> del n1 >>> del n2 Noddy 2 >>> import noddy2 >>> n1 = noddy2.Noddy('jim', 'fulton', 42) >>> n1.first 'jim' >>> n1.last 'fulton' >>> n1.number 42 >>> n1.name() 'jim fulton' >>> n1.first = 'will' >>> n1.name() 'will fulton' >>> n1.last = 'tell' >>> n1.name() 'will tell' >>> del n1.first >>> n1.name() Traceback (most recent call last): ... AttributeError: first >>> n1.first Traceback (most recent call last): ... AttributeError: first >>> n1.first = 'drew' >>> n1.first 'drew' >>> del n1.number Traceback (most recent call last): ... TypeError: can't delete numeric/char attribute >>> n1.number=2 >>> n1.number 2 >>> n1.first = 42 >>> n1.name() '42 tell' >>> n2 = noddy2.Noddy() >>> n2.name() ' ' >>> n2.first '' >>> n2.last '' >>> del n2.first >>> n2.first Traceback (most recent call last): ... AttributeError: first >>> n2.first Traceback (most recent call last): ... AttributeError: first >>> n2.name() Traceback (most recent call last): File "", line 1, in ? AttributeError: first >>> n2.number 0 >>> n3 = noddy2.Noddy('jim', 'fulton', 'waaa') Traceback (most recent call last): File "", line 1, in ? TypeError: an integer is required >>> del n1 >>> del n2 Noddy 3 >>> import noddy3 >>> n1 = noddy3.Noddy('jim', 'fulton', 42) >>> n1 = noddy3.Noddy('jim', 'fulton', 42) >>> n1.name() 'jim fulton' >>> del n1.first Traceback (most recent call last): File "", line 1, in ? TypeError: Cannot delete the first attribute >>> n1.first = 42 Traceback (most recent call last): File "", line 1, in ? TypeError: The first attribute value must be a string >>> n1.first = 'will' >>> n1.name() 'will fulton' >>> n2 = noddy3.Noddy() >>> n2 = noddy3.Noddy() >>> n2 = noddy3.Noddy() >>> n3 = noddy3.Noddy('jim', 'fulton', 'waaa') Traceback (most recent call last): File "", line 1, in ? TypeError: an integer is required >>> del n1 >>> del n2 """ import os import sys from distutils.util import get_platform PLAT_SPEC = "%s-%s" % (get_platform(), sys.version[0:3]) src = os.path.join("build", "lib.%s" % PLAT_SPEC) sys.path.append(src) if __name__ == "__main__": import doctest, __main__ doctest.testmod(__main__) From dcjim@users.sourceforge.net Sat Jun 28 14:28:00 2003 From: dcjim@users.sourceforge.net (dcjim@users.sourceforge.net) Date: Sat, 28 Jun 2003 06:28:00 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.108,1.109 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv29083 Modified Files: Makefile.deps Log Message: Updated the depenencies to reflect changes in the sample code for building new types. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** Makefile.deps 28 May 2003 12:10:14 -0000 1.108 --- Makefile.deps 28 Jun 2003 13:27:57 -0000 1.109 *************** *** 61,66 **** ext/windows.tex \ ext/embedding.tex \ - ext/cycle-gc.c \ ext/noddy.c \ ext/run-func.c \ texinputs/typestruct.h \ --- 61,68 ---- ext/windows.tex \ ext/embedding.tex \ ext/noddy.c \ + ext/noddy2.c \ + ext/noddy3.c \ + ext/noddy4.c \ ext/run-func.c \ texinputs/typestruct.h \ From dcjim@users.sourceforge.net Sat Jun 28 14:29:18 2003 From: dcjim@users.sourceforge.net (dcjim@users.sourceforge.net) Date: Sat, 28 Jun 2003 06:29:18 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext noddy4.c,NONE,1.1 newtypes.tex,1.28,1.29 setup.py,1.1,1.2 test.py,1.1,1.2 cycle-gc.c,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1:/tmp/cvs-serv29154/ext Modified Files: newtypes.tex setup.py test.py Added Files: noddy4.c Removed Files: cycle-gc.c Log Message: Rewrote the docs for supporting cyclic garbage collection to reflect the new way that once writes types. Deleted the old section and sample code and added a new section building on the Noddy example. --- NEW FILE: noddy4.c --- #include #include "structmember.h" typedef struct { PyObject_HEAD PyObject *first; PyObject *last; int number; } Noddy; static int Noddy_traverse(Noddy *self, visitproc visit, void *arg) { if (self->first && visit(self->first, arg) < 0) return -1; if (self->last && visit(self->last, arg) < 0) return -1; return 0; } static int Noddy_clear(Noddy *self) { Py_XDECREF(self->first); self->first = NULL; Py_XDECREF(self->last); self->last = NULL; return 0; } static void Noddy_dealloc(Noddy* self) { Noddy_clear(self); self->ob_type->tp_free((PyObject*)self); } static PyObject * Noddy_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { Noddy *self; self = (Noddy *)type->tp_alloc(type, 0); if (self != NULL) { self->first = PyString_FromString(""); if (self->first == NULL) { Py_DECREF(self); return NULL; } self->last = PyString_FromString(""); if (self->last == NULL) { Py_DECREF(self); return NULL; } self->number = 0; } return (PyObject *)self; } static int Noddy_init(Noddy *self, PyObject *args, PyObject *kwds) { PyObject *first=NULL, *last=NULL; static char *kwlist[] = {"first", "last", "number", NULL}; if (! PyArg_ParseTupleAndKeywords(args, kwds, "|OOi", kwlist, &first, &last, &self->number)) return -1; if (first) { Py_XDECREF(self->first); Py_INCREF(first); self->first = first; } if (last) { Py_XDECREF(self->last); Py_INCREF(last); self->last = last; } return 0; } static PyMemberDef Noddy_members[] = { {"first", T_OBJECT_EX, offsetof(Noddy, first), 0, "first name"}, {"last", T_OBJECT_EX, offsetof(Noddy, last), 0, "last name"}, {"number", T_INT, offsetof(Noddy, number), 0, "noddy number"}, {NULL} /* Sentinel */ }; static PyObject * Noddy_name(Noddy* self) { static PyObject *format = NULL; PyObject *args, *result; if (format == NULL) { format = PyString_FromString("%s %s"); if (format == NULL) return NULL; } if (self->first == NULL) { PyErr_SetString(PyExc_AttributeError, "first"); return NULL; } if (self->last == NULL) { PyErr_SetString(PyExc_AttributeError, "last"); return NULL; } args = Py_BuildValue("OO", self->first, self->last); if (args == NULL) return NULL; result = PyString_Format(format, args); Py_DECREF(args); return result; } static PyMethodDef Noddy_methods[] = { {"name", (PyCFunction)Noddy_name, METH_NOARGS, "Return the name, combining the first and last name" }, {NULL} /* Sentinel */ }; static PyTypeObject NoddyType = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "noddy.Noddy", /*tp_name*/ sizeof(Noddy), /*tp_basicsize*/ 0, /*tp_itemsize*/ (destructor)Noddy_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash */ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ "Noddy objects", /* tp_doc */ (traverseproc)Noddy_traverse, /* tp_traverse */ (inquiry)Noddy_clear, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ Noddy_methods, /* tp_methods */ Noddy_members, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)Noddy_init, /* tp_init */ 0, /* tp_alloc */ Noddy_new, /* tp_new */ }; static PyMethodDef module_methods[] = { {NULL} /* Sentinel */ }; #ifndef PyMODINIT_FUNC /* declarations for DLL import/export */ #define PyMODINIT_FUNC void #endif PyMODINIT_FUNC initnoddy4(void) { PyObject* m; if (PyType_Ready(&NoddyType) < 0) return; m = Py_InitModule3("noddy4", module_methods, "Example module that creates an extension type."); if (m == NULL) return; Py_INCREF(&NoddyType); PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType); } Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/newtypes.tex,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** newtypes.tex 28 Jun 2003 11:53:12 -0000 1.28 --- newtypes.tex 28 Jun 2003 13:29:16 -0000 1.29 *************** *** 671,674 **** --- 671,765 ---- definition to the \file{setup.py} file. + \subsection{Supporting cyclic garbage collection} + + Python has a cyclic-garbage collector that can identify unneeded + objects even when their reference counts are not zero. This can happen + when objects are involved in cycles. For example, consider: + + \begin{verbatim} + >>> l = [] + >>> l.append(l) + >>> del l + \end{verbatim} + + In this example, we create a list that contains itself. When we delete + it, it still has a reference from itself. It's reference count doesn't + drop to zero. Fortunately, Python's cyclic-garbage collector will + eventually figure out that that the list is garbage and free it. + + In the second version of the \class{Noddy} example, we allowed any + kind of object to be stored in the \member{first} or \member{last} + attributes. This means that \class{Noddy} objects can participate in + cycles: + + \begin{verbatim} + >>> import noddy2 + >>> n = noddy2.Noddy() + >>> l = [n] + >>> n.first = l + \end{verbatim} + + This is pretty silly, but it gives us an excuse to add support for the + cyclic-garbage collector to the \class{Noddy} example. To support + cyclic garbage collection, types need to fill two slots and set a + class flag that enables these slots: + + \verbatiminput{noddy4.c} + + The traversal method provides access to subobjects that + could participate in cycles: + + \begin{verbatim} + static int + Noddy_traverse(Noddy *self, visitproc visit, void *arg) + { + if (self->first && visit(self->first, arg) < 0) + return -1; + if (self->last && visit(self->last, arg) < 0) + return -1; + + return 0; + } + \end{verbatim} + + For each subobject that can participate in cycles, we need to call the + \cfunction{visit} function passed to the traversal method passing the + subobject and the extra argument passed to the traversal method. + + We also need to provide a method for clearing any subobjects that can + participate in cycles. We implement the method and reimplement the + deallocator to use it: + + \begin{verbatim} + static int + Noddy_clear(Noddy *self) + { + Py_XDECREF(self->first); + self->first = NULL; + Py_XDECREF(self->last); + self->last = NULL; + + return 0; + } + + static void + Noddy_dealloc(Noddy* self) + { + Noddy_clear(self); + self->ob_type->tp_free((PyObject*)self); + } + \end{verbatim} + + Finally, we add the \constant{Py_TPFLAGS_HAVE_GC} flag to the class flags: + + \begin{verbatim} + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + \end{verbatim} + + That's pretty much it. If we had written custom \member{tp_alloc} or + \member{tp_free} slots, we'd need to modify then for cyclic-garbage + collection. Most extensions will use the versions automatically + provided. + \section{Type Methods \label{dnt-type-methods}} *************** *** 1304,1331 **** avoiding the exception can yield slightly better performance. If an actual error occurs, it should set an exception and return \NULL. - - - \subsection{Supporting the Cycle Collector - \label{example-cycle-support}} - - This example shows only enough of the implementation of an extension - type to show how the garbage collector support needs to be added. It - shows the definition of the object structure, the - \member{tp_traverse}, \member{tp_clear} and \member{tp_dealloc} - implementations, the type structure, and a constructor --- the module - initialization needed to export the constructor to Python is not shown - as there are no special considerations there for the collector. To - make this interesting, assume that the module exposes ways for the - \member{container} field of the object to be modified. Note that - since no checks are made on the type of the object used to initialize - \member{container}, we have to assume that it may be a container. - - \verbatiminput{cycle-gc.c} - - Full details on the APIs related to the cycle detector are in - \ulink{Supporting Cyclic Garbarge - Collection}{../api/supporting-cycle-detection.html} in the - \citetitle[../api/api.html]{Python/C API Reference Manual}. - \subsection{More Suggestions} --- 1395,1398 ---- Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/setup.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** setup.py 28 Jun 2003 11:54:20 -0000 1.1 --- setup.py 28 Jun 2003 13:29:16 -0000 1.2 *************** *** 5,8 **** --- 5,9 ---- Extension("noddy2", ["noddy2.c"]), Extension("noddy3", ["noddy3.c"]), + Extension("noddy4", ["noddy4.c"]), ]) Index: test.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/test.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test.py 28 Jun 2003 11:54:40 -0000 1.1 --- test.py 28 Jun 2003 13:29:16 -0000 1.2 *************** *** 107,110 **** --- 107,203 ---- >>> del n1 >>> del n2 + + Noddy 4 + + >>> import noddy4 + >>> n1 = noddy4.Noddy('jim', 'fulton', 42) + >>> n1.first + 'jim' + >>> n1.last + 'fulton' + >>> n1.number + 42 + >>> n1.name() + 'jim fulton' + >>> n1.first = 'will' + >>> n1.name() + 'will fulton' + >>> n1.last = 'tell' + >>> n1.name() + 'will tell' + >>> del n1.first + >>> n1.name() + Traceback (most recent call last): + ... + AttributeError: first + >>> n1.first + Traceback (most recent call last): + ... + AttributeError: first + >>> n1.first = 'drew' + >>> n1.first + 'drew' + >>> del n1.number + Traceback (most recent call last): + ... + TypeError: can't delete numeric/char attribute + >>> n1.number=2 + >>> n1.number + 2 + >>> n1.first = 42 + >>> n1.name() + '42 tell' + >>> n2 = noddy4.Noddy() + >>> n2 = noddy4.Noddy() + >>> n2 = noddy4.Noddy() + >>> n2 = noddy4.Noddy() + >>> n2.name() + ' ' + >>> n2.first + '' + >>> n2.last + '' + >>> del n2.first + >>> n2.first + Traceback (most recent call last): + ... + AttributeError: first + >>> n2.first + Traceback (most recent call last): + ... + AttributeError: first + >>> n2.name() + Traceback (most recent call last): + File "", line 1, in ? + AttributeError: first + >>> n2.number + 0 + >>> n3 = noddy4.Noddy('jim', 'fulton', 'waaa') + Traceback (most recent call last): + File "", line 1, in ? + TypeError: an integer is required + + + Test cyclic gc(?) + + >>> import gc + >>> gc.disable() + + >>> x = [] + >>> l = [x] + >>> n2.first = l + >>> n2.first + [[]] + >>> l.append(n2) + >>> del l + >>> del n1 + >>> del n2 + >>> sys.getrefcount(x) + 3 + >>> ignore = gc.collect() + >>> sys.getrefcount(x) + 2 + + >>> gc.enable() """ --- cycle-gc.c DELETED --- From bwarsaw@users.sourceforge.net Sat Jun 28 16:22:18 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sat, 28 Jun 2003 08:22:18 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext newtypes.tex,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1:/tmp/cvs-serv9903 Modified Files: newtypes.tex Log Message: A few minor improvements Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/newtypes.tex,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** newtypes.tex 28 Jun 2003 13:29:16 -0000 1.29 --- newtypes.tex 28 Jun 2003 15:22:16 -0000 1.30 *************** *** 724,729 **** For each subobject that can participate in cycles, we need to call the ! \cfunction{visit} function passed to the traversal method passing the ! subobject and the extra argument passed to the traversal method. We also need to provide a method for clearing any subobjects that can --- 724,730 ---- For each subobject that can participate in cycles, we need to call the ! \cfunction{visit} function, which is passed to the traversal method. ! The \cfunction{visit} function takes as arguments the subobject and ! the extra argument \var{arg} passed to the traversal method. We also need to provide a method for clearing any subobjects that can *************** *** 758,762 **** That's pretty much it. If we had written custom \member{tp_alloc} or ! \member{tp_free} slots, we'd need to modify then for cyclic-garbage collection. Most extensions will use the versions automatically provided. --- 759,763 ---- That's pretty much it. If we had written custom \member{tp_alloc} or ! \member{tp_free} slots, we'd need to modify them for cyclic-garbage collection. Most extensions will use the versions automatically provided. From rhettinger@users.sourceforge.net Sat Jun 28 21:04:27 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 28 Jun 2003 13:04:27 -0700 Subject: [Python-checkins] python/dist/src/Objects floatobject.c,2.123,2.124 intobject.c,2.104,2.105 longobject.c,1.160,1.161 unicodeobject.c,2.188,2.189 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv14359 Modified Files: floatobject.c intobject.c longobject.c unicodeobject.c Log Message: SF patch 703666: Several objects don't decref tmp on failure in subtype_new Submitted By: Christopher A. Craig Fillin some missing decrefs. Index: floatobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v retrieving revision 2.123 retrieving revision 2.124 diff -C2 -d -r2.123 -r2.124 *** floatobject.c 24 May 2003 20:18:24 -0000 2.123 --- floatobject.c 28 Jun 2003 20:04:24 -0000 2.124 *************** *** 752,757 **** assert(PyFloat_CheckExact(tmp)); new = type->tp_alloc(type, 0); ! if (new == NULL) return NULL; ((PyFloatObject *)new)->ob_fval = ((PyFloatObject *)tmp)->ob_fval; Py_DECREF(tmp); --- 752,759 ---- assert(PyFloat_CheckExact(tmp)); new = type->tp_alloc(type, 0); ! if (new == NULL) { ! Py_DECREF(tmp); return NULL; + } ((PyFloatObject *)new)->ob_fval = ((PyFloatObject *)tmp)->ob_fval; Py_DECREF(tmp); Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.104 retrieving revision 2.105 diff -C2 -d -r2.104 -r2.105 *** intobject.c 17 Apr 2003 18:55:36 -0000 2.104 --- intobject.c 28 Jun 2003 20:04:24 -0000 2.105 *************** *** 959,964 **** new = type->tp_alloc(type, 0); ! if (new == NULL) return NULL; ((PyIntObject *)new)->ob_ival = ival; Py_DECREF(tmp); --- 959,966 ---- new = type->tp_alloc(type, 0); ! if (new == NULL) { ! Py_DECREF(tmp); return NULL; + } ((PyIntObject *)new)->ob_ival = ival; Py_DECREF(tmp); Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.160 retrieving revision 1.161 diff -C2 -d -r1.160 -r1.161 *** longobject.c 5 May 2003 20:39:43 -0000 1.160 --- longobject.c 28 Jun 2003 20:04:25 -0000 1.161 *************** *** 2795,2800 **** n = -n; new = (PyLongObject *)type->tp_alloc(type, n); ! if (new == NULL) return NULL; assert(PyLong_Check(new)); new->ob_size = tmp->ob_size; --- 2795,2802 ---- n = -n; new = (PyLongObject *)type->tp_alloc(type, n); ! if (new == NULL) { ! Py_DECREF(tmp); return NULL; + } assert(PyLong_Check(new)); new->ob_size = tmp->ob_size; Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.188 retrieving revision 2.189 diff -C2 -d -r2.188 -r2.189 *** unicodeobject.c 18 May 2003 12:31:09 -0000 2.188 --- unicodeobject.c 28 Jun 2003 20:04:25 -0000 2.189 *************** *** 6689,6698 **** assert(PyUnicode_Check(tmp)); pnew = (PyUnicodeObject *) type->tp_alloc(type, n = tmp->length); ! if (pnew == NULL) return NULL; pnew->str = PyMem_NEW(Py_UNICODE, n+1); if (pnew->str == NULL) { _Py_ForgetReference((PyObject *)pnew); PyObject_Del(pnew); return PyErr_NoMemory(); } --- 6689,6701 ---- assert(PyUnicode_Check(tmp)); pnew = (PyUnicodeObject *) type->tp_alloc(type, n = tmp->length); ! if (pnew == NULL) { ! Py_DECREF(tmp); return NULL; + } pnew->str = PyMem_NEW(Py_UNICODE, n+1); if (pnew->str == NULL) { _Py_ForgetReference((PyObject *)pnew); PyObject_Del(pnew); + Py_DECREF(tmp); return PyErr_NoMemory(); } From rhettinger@users.sourceforge.net Sat Jun 28 21:10:28 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 28 Jun 2003 13:10:28 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.239,1.240 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv15603 Modified Files: ACKS Log Message: Added Steven Taschuk for efforts fixing zipfile.py Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.239 retrieving revision 1.240 diff -C2 -d -r1.239 -r1.240 *** ACKS 9 Jun 2003 08:55:14 -0000 1.239 --- ACKS 28 Jun 2003 20:10:26 -0000 1.240 *************** *** 535,538 **** --- 535,539 ---- William Tanksley Christian Tanzer + Steven Taschuk Amy Taylor Tobias Thelen From gvanrossum@users.sourceforge.net Sat Jun 28 22:53:54 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 28 Jun 2003 14:53:54 -0700 Subject: [Python-checkins] python/dist/src/Python pystate.c,2.27,2.28 ceval.c,2.365,2.366 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv29907/python Modified Files: pystate.c ceval.c Log Message: Add PyThreadState_SetAsyncExc(long, PyObject *). A new API (only accessible from C) to interrupt a thread by sending it an exception. This is not always effective, but might help some people. Requested by Just van Rossum and Alex Martelli. It is intentional that you have to write your own C extension to call it from Python. Docs will have to wait. Index: pystate.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pystate.c,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -d -r2.27 -r2.28 *** pystate.c 1 May 2003 05:25:29 -0000 2.27 --- pystate.c 28 Jun 2003 21:53:52 -0000 2.28 *************** *** 144,147 **** --- 144,149 ---- tstate->tick_counter = 0; tstate->gilstate_counter = 0; + tstate->async_exc = NULL; + tstate->thread_id = PyThread_get_thread_ident(); tstate->dict = NULL; *************** *** 180,183 **** --- 182,186 ---- ZAP(tstate->dict); + ZAP(tstate->async_exc); ZAP(tstate->curexc_type); *************** *** 297,300 **** --- 300,329 ---- + /* Asynchronously raise an exception in a thread. + Requested by Just van Rossum and Alex Martelli. + To prevent naive misuse, you must write your own exception + to call this. Must be called with the GIL held. + Returns the number of tstates modified; if it returns a number + greater than one, you're in trouble, and you should call it again + with exc=NULL to revert the effect. This raises no exceptions. */ + + int + PyThreadState_SetAsyncExc(long id, PyObject *exc) { + PyThreadState *tstate = PyThreadState_Get(); + PyInterpreterState *interp = tstate->interp; + PyThreadState *p; + int count = 0; + for (p = interp->tstate_head; p != NULL; p = p->next) { + if (p->thread_id != id) + continue; + ZAP(p->async_exc); + Py_XINCREF(exc); + p->async_exc = exc; + count += 1; + } + return count; + } + + /* Routines for advanced debuggers, requested by David Beazley. Don't use unless you know what you are doing! */ *************** *** 320,323 **** --- 349,353 ---- return tstate->next; } + /* Python "auto thread state" API. */ Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.365 retrieving revision 2.366 diff -C2 -d -r2.365 -r2.366 *** ceval.c 1 Jun 2003 19:21:12 -0000 2.365 --- ceval.c 28 Jun 2003 21:53:52 -0000 2.366 *************** *** 291,295 **** extern int _PyThread_Started; /* Flag for Py_Exit */ ! static PyThread_type_lock interpreter_lock = 0; static long main_thread = 0; --- 291,295 ---- extern int _PyThread_Started; /* Flag for Py_Exit */ ! static PyThread_type_lock interpreter_lock = 0; /* This is the GIL */ static long main_thread = 0; *************** *** 774,777 **** --- 774,782 ---- if (--_Py_Ticker < 0) { + if (*next_instr == SETUP_FINALLY) { + /* Make the last opcode before + a try: finally: block uninterruptable. */ + goto fast_next_opcode; + } _Py_Ticker = _Py_CheckInterval; tstate->tick_counter++; *************** *** 806,809 **** --- 811,825 ---- if (PyThreadState_Swap(tstate) != NULL) Py_FatalError("ceval: orphan tstate"); + + /* Check for thread interrupts */ + + if (tstate->async_exc != NULL) { + x = tstate->async_exc; + tstate->async_exc = NULL; + PyErr_SetNone(x); + Py_DECREF(x); + why = WHY_EXCEPTION; + goto on_error; + } } #endif From gvanrossum@users.sourceforge.net Sat Jun 28 22:53:54 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sat, 28 Jun 2003 14:53:54 -0700 Subject: [Python-checkins] python/dist/src/Include pystate.h,2.24,2.25 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv29907/include Modified Files: pystate.h Log Message: Add PyThreadState_SetAsyncExc(long, PyObject *). A new API (only accessible from C) to interrupt a thread by sending it an exception. This is not always effective, but might help some people. Requested by Just van Rossum and Alex Martelli. It is intentional that you have to write your own C extension to call it from Python. Docs will have to wait. Index: pystate.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pystate.h,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -d -r2.24 -r2.25 *** pystate.h 19 Apr 2003 15:41:45 -0000 2.24 --- pystate.h 28 Jun 2003 21:53:52 -0000 2.25 *************** *** 75,78 **** --- 75,81 ---- int gilstate_counter; + PyObject *async_exc; /* Asynchronous exception to raise */ + long thread_id; /* Thread id where this tstate was created */ + /* XXX signal handlers should also be here */ *************** *** 94,97 **** --- 97,101 ---- PyAPI_FUNC(PyThreadState *) PyThreadState_Swap(PyThreadState *); PyAPI_FUNC(PyObject *) PyThreadState_GetDict(void); + PyAPI_FUNC(int) PyThreadState_SetAsyncExc(long, PyObject *); From jackjansen@users.sourceforge.net Sun Jun 29 00:38:06 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat, 28 Jun 2003 16:38:06 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/Doc setup.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv12080 Modified Files: setup.py Log Message: By default build docs, don't download them. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Doc/setup.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** setup.py 27 May 2003 22:47:54 -0000 1.3 --- setup.py 28 Jun 2003 23:38:04 -0000 1.4 *************** *** 34,39 **** self.build_html = None self.build_dest = None ! self.download = 1 ! self.doc_version = '2.2.2' def finalize_options(self): --- 34,39 ---- self.build_html = None self.build_dest = None ! self.download = 0 ! self.doc_version = '2.3b1' # Only needed if download is true def finalize_options(self): *************** *** 42,46 **** self.build_html = os.path.join(self.build_base, 'html') if self.build_dest is None: ! self.build_dest = os.path.join(self.build_base, 'processed-html') def spawn(self, *args): --- 42,46 ---- self.build_html = os.path.join(self.build_base, 'html') if self.build_dest is None: ! self.build_dest = os.path.join(self.build_base, 'PythonDocumentation') def spawn(self, *args): From jackjansen@users.sourceforge.net Sun Jun 29 01:09:20 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat, 28 Jun 2003 17:09:20 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac pimp.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv15566 Modified Files: pimp.py Log Message: Use http://www.python.org/packman as the base URL. Also upped the version number because of this. Index: pimp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** pimp.py 1 Jun 2003 20:57:12 -0000 1.25 --- pimp.py 29 Jun 2003 00:09:18 -0000 1.26 *************** *** 2,6 **** This is currently a MacOSX-only strawman implementation. ! Motto: "He may be shabby, but he gets you what you need" :-) Tools to allow easy installation of packages. The idea is that there is --- 2,6 ---- This is currently a MacOSX-only strawman implementation. ! Despite other rumours the name stands for "Packman IMPlementation". Tools to allow easy installation of packages. The idea is that there is *************** *** 36,40 **** NO_EXECUTE=0 ! PIMP_VERSION="0.2" # Flavors: --- 36,40 ---- NO_EXECUTE=0 ! PIMP_VERSION="0.3" # Flavors: *************** *** 45,49 **** DEFAULT_BUILDDIR='/tmp' DEFAULT_INSTALLDIR=distutils.sysconfig.get_python_lib() ! DEFAULT_PIMPDATABASE="http://homepages.cwi.nl/~jack/pimp-0.2/pimp-%s.plist" % distutils.util.get_platform() def _cmd(output, dir, *cmditems): --- 45,49 ---- DEFAULT_BUILDDIR='/tmp' DEFAULT_INSTALLDIR=distutils.sysconfig.get_python_lib() ! DEFAULT_PIMPDATABASE="http://www.python.org/packman/version-0.3/%s.plist" % distutils.util.get_platform() def _cmd(output, dir, *cmditems): From jackjansen@users.sourceforge.net Sun Jun 29 01:17:25 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat, 28 Jun 2003 17:17:25 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation packman.html,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation In directory sc8-pr-cvs1:/tmp/cvs-serv16527 Modified Files: packman.html Log Message: Suggest people visit www.python.org/packman if the default database cannot be found. Index: packman.html =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSXResources/app/Resources/English.lproj/Documentation/packman.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** packman.html 18 Jun 2003 22:10:27 -0000 1.3 --- packman.html 29 Jun 2003 00:17:23 -0000 1.4 *************** *** 46,50 **** In the standalone Package Manager you can open an alternative database with the File->Open URL... command, but you should realize that ! you are now on untested ground.

    --- 46,52 ---- In the standalone Package Manager you can open an alternative database with the File->Open URL... command, but you should realize that ! you are now on untested ground. You may be able to find an alternative ! database that works for your system at !
    http://www.python.org/packman.

    From jackjansen@users.sourceforge.net Sun Jun 29 01:24:14 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat, 28 Jun 2003 17:24:14 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Extras.ReadMe.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1:/tmp/cvs-serv17348 Modified Files: Extras.ReadMe.txt Log Message: Slight clarification on running the examples from the Finder. Index: Extras.ReadMe.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Extras.ReadMe.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Extras.ReadMe.txt 19 Jun 2003 22:35:20 -0000 1.1 --- Extras.ReadMe.txt 29 Jun 2003 00:24:12 -0000 1.2 *************** *** 6,9 **** Some examples can be run from within the PythonIDE, but many will require ! that you start them from the command line, or supply command-line arguments ! by holding down the "alt" key when double-clicking them. --- 6,12 ---- Some examples can be run from within the PythonIDE, but many will require ! that you start them from the command line or with PythonLauncher. In the ! latter case, you can supply any needed command line arguments by holding ! the "alt" key while dragging the script to PythonLauncher (or while ! double-clicking the script, if PythonLauncher is set as the default application ! to open Python scripts with). From tim_one@users.sourceforge.net Sun Jun 29 01:57:19 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 28 Jun 2003 17:57:19 -0700 Subject: [Python-checkins] python/dist/src/Include patchlevel.h,2.67,2.68 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv20264/Include Modified Files: patchlevel.h Log Message: Bump release level to 2.3b2. Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.67 retrieving revision 2.68 diff -C2 -d -r2.67 -r2.68 *** patchlevel.h 30 Apr 2003 22:14:27 -0000 2.67 --- patchlevel.h 29 Jun 2003 00:57:17 -0000 2.68 *************** *** 24,31 **** #define PY_MICRO_VERSION 0 #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_BETA ! #define PY_RELEASE_SERIAL 1 /* Version as a string */ ! #define PY_VERSION "2.3b1+" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 24,31 ---- #define PY_MICRO_VERSION 0 #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_BETA ! #define PY_RELEASE_SERIAL 2 /* Version as a string */ ! #define PY_VERSION "2.3b2" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From tim_one@users.sourceforge.net Sun Jun 29 01:57:19 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 28 Jun 2003 17:57:19 -0700 Subject: [Python-checkins] python/dist/src/PC python_nt.rc,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory sc8-pr-cvs1:/tmp/cvs-serv20264/PC Modified Files: python_nt.rc Log Message: Bump release level to 2.3b2. Index: python_nt.rc =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/python_nt.rc,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** python_nt.rc 24 Apr 2003 16:45:32 -0000 1.22 --- python_nt.rc 29 Jun 2003 00:57:17 -0000 1.23 *************** *** 34,45 **** * following comment and #define are output from PCbuild\field3.py: * ! * For 2.3b1, * PY_MICRO_VERSION = 0 * PY_RELEASE_LEVEL = 'beta' = 0xb ! * PY_RELEASE_SERIAL = 1 * ! * and 0*1000 + 11*10 + 1 = 111 */ ! #define FIELD3 111 /* e.g., 2.1a2 --- 34,45 ---- * following comment and #define are output from PCbuild\field3.py: * ! * For 2.3b2, * PY_MICRO_VERSION = 0 * PY_RELEASE_LEVEL = 'beta' = 0xb ! * PY_RELEASE_SERIAL = 2 * ! * and 0*1000 + 11*10 + 2 = 112 */ ! #define FIELD3 112 /* e.g., 2.1a2 From fdrake@users.sourceforge.net Sun Jun 29 03:14:33 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sat, 28 Jun 2003 19:14:33 -0700 Subject: [Python-checkins] python/dist/src/Doc/api init.tex,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv27640/api Modified Files: init.tex Log Message: Document PyThreadState_SetAsyncExc(). Index: init.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/init.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** init.tex 15 Apr 2003 15:10:49 -0000 1.8 --- init.tex 29 Jun 2003 02:14:31 -0000 1.9 *************** *** 686,689 **** --- 686,703 ---- \end{cfuncdesc} + \begin{cfuncdesc}{int}{PyThreadState_SetAsyncExc}{long id, PyObject *exc} + Asynchronously raise an exception in a thread. + The \var{id} argument is the thread id of the target thread; + \var{exc} is the exception object to be raised. + This function does not steal any references to \var{exc}. + To prevent naive misuse, you must write your own C extension + to call this. Must be called with the GIL held. + Returns the number of thread states modified; if it returns a number + greater than one, you're in trouble, and you should call it again + with \var{exc} set to \constant{NULL} to revert the effect. + This raises no exceptions. + \versionadded{2.3} + \end{cfuncdesc} + \section{Profiling and Tracing \label{profiling}} From fdrake@users.sourceforge.net Sun Jun 29 03:17:31 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sat, 28 Jun 2003 19:17:31 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile,1.254,1.255 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv27953 Modified Files: Makefile Log Message: Bump version information for Python 2.3 beta 2. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.254 retrieving revision 1.255 diff -C2 -d -r1.254 -r1.255 *** Makefile 22 May 2003 15:28:55 -0000 1.254 --- Makefile 29 Jun 2003 02:17:28 -0000 1.255 *************** *** 67,71 **** # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.3b1 PYTHON= python --- 67,71 ---- # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.3b2 PYTHON= python From fdrake@users.sourceforge.net Sun Jun 29 03:17:31 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sat, 28 Jun 2003 19:17:31 -0700 Subject: [Python-checkins] python/dist/src/Doc/texinputs boilerplate.tex,1.79,1.80 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory sc8-pr-cvs1:/tmp/cvs-serv27953/texinputs Modified Files: boilerplate.tex Log Message: Bump version information for Python 2.3 beta 2. Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/boilerplate.tex,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** boilerplate.tex 26 Apr 2003 00:52:30 -0000 1.79 --- boilerplate.tex 29 Jun 2003 02:17:28 -0000 1.80 *************** *** 6,11 **** } ! \date{\today} % XXX update before final release! \release{2.3} % software release, not documentation ! \setreleaseinfo{b1+} % empty for final release \setshortversion{2.3} % major.minor only for software --- 6,11 ---- } ! \date{June 29, 2003} % XXX update before final release! \release{2.3} % software release, not documentation ! \setreleaseinfo{b2} % empty for final release \setshortversion{2.3} % major.minor only for software From rhettinger@users.sourceforge.net Sun Jun 29 04:08:07 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 28 Jun 2003 20:08:07 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.268,1.269 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv31711 Modified Files: socketmodule.c Log Message: SF patch #760257: add socket.timeout exception (Contributed by Bob Halley) Added a new exception, socket.timeout so that timeouts can be differentiated from other socket exceptions. Docs, more tests, and newsitem to follow. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.268 retrieving revision 1.269 diff -C2 -d -r1.268 -r1.269 *** socketmodule.c 10 May 2003 07:36:55 -0000 1.268 --- socketmodule.c 29 Jun 2003 03:08:05 -0000 1.269 *************** *** 329,332 **** --- 329,333 ---- static PyObject *socket_herror; static PyObject *socket_gaierror; + static PyObject *socket_timeout; #ifdef RISCOS *************** *** 576,594 **** /* Do a select() on the socket, if necessary (sock_timeout > 0). The argument writing indicates the direction. ! This does not raise an exception or return a success indicator; ! we'll let the actual socket call do that. */ ! static void internal_select(PySocketSockObject *s, int writing) { fd_set fds; struct timeval tv; /* Nothing to do unless we're in timeout mode (not non-blocking) */ if (s->sock_timeout <= 0.0) ! return; /* Guard against closed socket */ if (s->sock_fd < 0) ! return; /* Construct the arguments to select */ --- 577,597 ---- /* Do a select() on the socket, if necessary (sock_timeout > 0). The argument writing indicates the direction. ! This does not raise an exception; we'll let our caller do that ! after they've reacquired the interpreter lock. ! Returns 1 on timeout, 0 otherwise. */ ! static int internal_select(PySocketSockObject *s, int writing) { fd_set fds; struct timeval tv; + int n; /* Nothing to do unless we're in timeout mode (not non-blocking) */ if (s->sock_timeout <= 0.0) ! return 0; /* Guard against closed socket */ if (s->sock_fd < 0) ! return 0; /* Construct the arguments to select */ *************** *** 600,606 **** /* See if the socket is ready */ if (writing) ! select(s->sock_fd+1, NULL, &fds, NULL, &tv); else ! select(s->sock_fd+1, &fds, NULL, NULL, &tv); } --- 603,612 ---- /* See if the socket is ready */ if (writing) ! n = select(s->sock_fd+1, NULL, &fds, NULL, &tv); else ! n = select(s->sock_fd+1, &fds, NULL, NULL, &tv); ! if (n == 0) ! return 1; ! return 0; } *************** *** 1091,1094 **** --- 1097,1101 ---- PyObject *addr = NULL; PyObject *res = NULL; + int timeout; if (!getsockaddrlen(s, &addrlen)) *************** *** 1096,1104 **** memset(addrbuf, 0, addrlen); Py_BEGIN_ALLOW_THREADS ! internal_select(s, 0); ! newfd = accept(s->sock_fd, (struct sockaddr *) addrbuf, &addrlen); Py_END_ALLOW_THREADS #ifdef MS_WINDOWS if (newfd == INVALID_SOCKET) --- 1103,1124 ---- memset(addrbuf, 0, addrlen); + #ifdef MS_WINDOWS + newfd = INVALID_SOCKET; + #else + newfd = -1; + #endif + Py_BEGIN_ALLOW_THREADS ! timeout = internal_select(s, 0); ! if (!timeout) ! newfd = accept(s->sock_fd, (struct sockaddr *) addrbuf, ! &addrlen); Py_END_ALLOW_THREADS + if (timeout) { + PyErr_SetString(socket_timeout, "timed out"); + return NULL; + } + #ifdef MS_WINDOWS if (newfd == INVALID_SOCKET) *************** *** 1406,1413 **** static int ! internal_connect(PySocketSockObject *s, struct sockaddr *addr, int addrlen) { ! int res; res = connect(s->sock_fd, addr, addrlen); --- 1426,1435 ---- static int ! internal_connect(PySocketSockObject *s, struct sockaddr *addr, int addrlen, ! int *timeoutp) { ! int res, timeout; + timeout = 0; res = connect(s->sock_fd, addr, addrlen); *************** *** 1424,1430 **** FD_SET(s->sock_fd, &fds); res = select(s->sock_fd+1, NULL, &fds, NULL, &tv); ! if (res == 0) res = WSAEWOULDBLOCK; ! else if (res > 0) res = 0; /* else if (res < 0) an error occurred */ --- 1446,1453 ---- FD_SET(s->sock_fd, &fds); res = select(s->sock_fd+1, NULL, &fds, NULL, &tv); ! if (res == 0) { res = WSAEWOULDBLOCK; ! timeout = 1; ! } else if (res > 0) res = 0; /* else if (res < 0) an error occurred */ *************** *** 1439,1443 **** if (s->sock_timeout > 0.0) { if (res < 0 && errno == EINPROGRESS) { ! internal_select(s, 1); res = connect(s->sock_fd, addr, addrlen); if (res < 0 && errno == EISCONN) --- 1462,1466 ---- if (s->sock_timeout > 0.0) { if (res < 0 && errno == EINPROGRESS) { ! timeout = internal_select(s, 1); res = connect(s->sock_fd, addr, addrlen); if (res < 0 && errno == EISCONN) *************** *** 1450,1453 **** --- 1473,1477 ---- #endif + *timeoutp = timeout; return res; *************** *** 1462,1465 **** --- 1486,1490 ---- int addrlen; int res; + int timeout; if (!getsockaddrarg(s, addro, &addr, &addrlen)) *************** *** 1467,1473 **** Py_BEGIN_ALLOW_THREADS ! res = internal_connect(s, addr, addrlen); Py_END_ALLOW_THREADS if (res != 0) return s->errorhandler(); --- 1492,1502 ---- Py_BEGIN_ALLOW_THREADS ! res = internal_connect(s, addr, addrlen, &timeout); Py_END_ALLOW_THREADS + if (timeout) { + PyErr_SetString(socket_timeout, "timed out"); + return NULL; + } if (res != 0) return s->errorhandler(); *************** *** 1491,1494 **** --- 1520,1524 ---- int addrlen; int res; + int timeout; if (!getsockaddrarg(s, addro, &addr, &addrlen)) *************** *** 1496,1500 **** Py_BEGIN_ALLOW_THREADS ! res = internal_connect(s, addr, addrlen); Py_END_ALLOW_THREADS --- 1526,1530 ---- Py_BEGIN_ALLOW_THREADS ! res = internal_connect(s, addr, addrlen, &timeout); Py_END_ALLOW_THREADS *************** *** 1717,1721 **** sock_recv(PySocketSockObject *s, PyObject *args) { ! int len, n, flags = 0; PyObject *buf; #ifdef __VMS --- 1747,1751 ---- sock_recv(PySocketSockObject *s, PyObject *args) { ! int len, n = 0, flags = 0, timeout; PyObject *buf; #ifdef __VMS *************** *** 1739,1746 **** #ifndef __VMS Py_BEGIN_ALLOW_THREADS ! internal_select(s, 0); ! n = recv(s->sock_fd, PyString_AS_STRING(buf), len, flags); Py_END_ALLOW_THREADS if (n < 0) { Py_DECREF(buf); --- 1769,1782 ---- #ifndef __VMS Py_BEGIN_ALLOW_THREADS ! timeout = internal_select(s, 0); ! if (!timeout) ! n = recv(s->sock_fd, PyString_AS_STRING(buf), len, flags); Py_END_ALLOW_THREADS + if (timeout) { + Py_DECREF(buf); + PyErr_SetString(socket_timeout, "timed out"); + return NULL; + } if (n < 0) { Py_DECREF(buf); *************** *** 1764,1771 **** Py_BEGIN_ALLOW_THREADS ! internal_select(s, 0); ! n = recv(s->sock_fd, read_buf, segment, flags); Py_END_ALLOW_THREADS if (n < 0) { Py_DECREF(buf); --- 1800,1813 ---- Py_BEGIN_ALLOW_THREADS ! timeout = internal_select(s, 0); ! if (!timeout) ! n = recv(s->sock_fd, read_buf, segment, flags); Py_END_ALLOW_THREADS + if (timeout) { + Py_DECREF(buf); + PyErr_SetString(socket_timeout, "timed out"); + return NULL; + } if (n < 0) { Py_DECREF(buf); *************** *** 1806,1810 **** PyObject *addr = NULL; PyObject *ret = NULL; ! int len, n, flags = 0; socklen_t addrlen; --- 1848,1852 ---- PyObject *addr = NULL; PyObject *ret = NULL; ! int len, n = 0, flags = 0, timeout; socklen_t addrlen; *************** *** 1820,1837 **** Py_BEGIN_ALLOW_THREADS memset(addrbuf, 0, addrlen); ! internal_select(s, 0); ! n = recvfrom(s->sock_fd, PyString_AS_STRING(buf), len, flags, #ifndef MS_WINDOWS #if defined(PYOS_OS2) && !defined(PYCC_GCC) ! (struct sockaddr *)addrbuf, &addrlen #else ! (void *)addrbuf, &addrlen #endif #else ! (struct sockaddr *)addrbuf, &addrlen #endif ! ); Py_END_ALLOW_THREADS if (n < 0) { Py_DECREF(buf); --- 1862,1885 ---- Py_BEGIN_ALLOW_THREADS memset(addrbuf, 0, addrlen); ! timeout = internal_select(s, 0); ! if (!timeout) ! n = recvfrom(s->sock_fd, PyString_AS_STRING(buf), len, flags, #ifndef MS_WINDOWS #if defined(PYOS_OS2) && !defined(PYCC_GCC) ! (struct sockaddr *)addrbuf, &addrlen #else ! (void *)addrbuf, &addrlen #endif #else ! (struct sockaddr *)addrbuf, &addrlen #endif ! ); Py_END_ALLOW_THREADS + if (timeout) { + Py_DECREF(buf); + PyErr_SetString(socket_timeout, "timed out"); + return NULL; + } if (n < 0) { Py_DECREF(buf); *************** *** 1865,1869 **** { char *buf; ! int len, n, flags = 0; #ifdef __VMS int send_length; --- 1913,1917 ---- { char *buf; ! int len, n = 0, flags = 0, timeout; #ifdef __VMS int send_length; *************** *** 1875,1882 **** #ifndef __VMS Py_BEGIN_ALLOW_THREADS ! internal_select(s, 1); ! n = send(s->sock_fd, buf, len, flags); Py_END_ALLOW_THREADS if (n < 0) return s->errorhandler(); --- 1923,1935 ---- #ifndef __VMS Py_BEGIN_ALLOW_THREADS ! timeout = internal_select(s, 1); ! if (!timeout) ! n = send(s->sock_fd, buf, len, flags); Py_END_ALLOW_THREADS + if (timeout) { + PyErr_SetString(socket_timeout, "timed out"); + return NULL; + } if (n < 0) return s->errorhandler(); *************** *** 1896,1902 **** } Py_BEGIN_ALLOW_THREADS ! internal_select(s, 1); ! n = send(s->sock_fd, buf, segment, flags); Py_END_ALLOW_THREADS if (n < 0) { return s->errorhandler(); --- 1949,1960 ---- } Py_BEGIN_ALLOW_THREADS ! timeout = internal_select(s, 1); ! if (!timeout) ! n = send(s->sock_fd, buf, segment, flags); Py_END_ALLOW_THREADS + if (timeout) { + PyErr_SetString(socket_timeout, "timed out"); + return NULL; + } if (n < 0) { return s->errorhandler(); *************** *** 1923,1927 **** { char *buf; ! int len, n, flags = 0; if (!PyArg_ParseTuple(args, "s#|i:sendall", &buf, &len, &flags)) --- 1981,1985 ---- { char *buf; ! int len, n = 0, flags = 0, timeout; if (!PyArg_ParseTuple(args, "s#|i:sendall", &buf, &len, &flags)) *************** *** 1930,1934 **** Py_BEGIN_ALLOW_THREADS do { ! internal_select(s, 1); n = send(s->sock_fd, buf, len, flags); if (n < 0) --- 1988,1994 ---- Py_BEGIN_ALLOW_THREADS do { ! timeout = internal_select(s, 1); ! if (timeout) ! break; n = send(s->sock_fd, buf, len, flags); if (n < 0) *************** *** 1939,1942 **** --- 1999,2006 ---- Py_END_ALLOW_THREADS + if (timeout) { + PyErr_SetString(socket_timeout, "timed out"); + return NULL; + } if (n < 0) return s->errorhandler(); *************** *** 1963,1967 **** char *buf; struct sockaddr *addr; ! int addrlen, len, n, flags; flags = 0; --- 2027,2031 ---- char *buf; struct sockaddr *addr; ! int addrlen, len, n = 0, flags, timeout; flags = 0; *************** *** 1977,1984 **** Py_BEGIN_ALLOW_THREADS ! internal_select(s, 1); ! n = sendto(s->sock_fd, buf, len, flags, addr, addrlen); Py_END_ALLOW_THREADS if (n < 0) return s->errorhandler(); --- 2041,2053 ---- Py_BEGIN_ALLOW_THREADS ! timeout = internal_select(s, 1); ! if (!timeout) ! n = sendto(s->sock_fd, buf, len, flags, addr, addrlen); Py_END_ALLOW_THREADS + if (timeout) { + PyErr_SetString(socket_timeout, "timed out"); + return NULL; + } if (n < 0) return s->errorhandler(); *************** *** 3410,3413 **** --- 3479,3488 ---- Py_INCREF(socket_gaierror); PyModule_AddObject(m, "gaierror", socket_gaierror); + socket_timeout = PyErr_NewException("socket.timeout", + socket_error, NULL); + if (socket_timeout == NULL) + return; + Py_INCREF(socket_timeout); + PyModule_AddObject(m, "timeout", socket_timeout); Py_INCREF((PyObject *)&sock_type); if (PyModule_AddObject(m, "SocketType", From tim_one@users.sourceforge.net Sun Jun 29 04:11:22 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 28 Jun 2003 20:11:22 -0700 Subject: [Python-checkins] python/dist/src/Lib doctest.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv32106/Lib Modified Files: doctest.py Log Message: Missed a spot where the new optional optionflags argument needed to get passed on. Index: doctest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/doctest.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** doctest.py 27 Jun 2003 20:48:05 -0000 1.26 --- doctest.py 29 Jun 2003 03:11:20 -0000 1.27 *************** *** 768,772 **** print "Running", name + ".__doc__" f, t = run_docstring_examples(object, self.globs, self.verbose, name, ! self.compileflags) if self.verbose: print f, "of", t, "examples failed in", name + ".__doc__" --- 768,772 ---- print "Running", name + ".__doc__" f, t = run_docstring_examples(object, self.globs, self.verbose, name, ! self.compileflags, self.optionflags) if self.verbose: print f, "of", t, "examples failed in", name + ".__doc__" From rhettinger@users.sourceforge.net Sun Jun 29 04:27:47 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 28 Jun 2003 20:27:47 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.240,1.241 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv906 Modified Files: ACKS Log Message: Added Bob Halley for work on socket.timeout Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.240 retrieving revision 1.241 diff -C2 -d -r1.240 -r1.241 *** ACKS 28 Jun 2003 20:10:26 -0000 1.240 --- ACKS 29 Jun 2003 03:27:45 -0000 1.241 *************** *** 211,214 **** --- 211,215 ---- Rasmus Hahn Peter Haight + Bob Halley Jesse Hallio Jun Hamano From rhettinger@users.sourceforge.net Sun Jun 29 04:29:44 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 28 Jun 2003 20:29:44 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.792,1.793 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv1050 Modified Files: NEWS Log Message: SF patch #760257: add socket.timeout exception Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.792 retrieving revision 1.793 diff -C2 -d -r1.792 -r1.793 *** NEWS 27 Jun 2003 22:25:02 -0000 1.792 --- NEWS 29 Jun 2003 03:29:42 -0000 1.793 *************** *** 59,62 **** --- 59,65 ---- ----------------- + - the socket module has a new exception, socket.timeout, to allow + timeouts to be handled separately from other socket errors. + - mimetools.choose_boundary() could return duplicate strings at times, especially likely on Windows. The strings returned are now guaranteed From nnorwitz@users.sourceforge.net Sun Jun 29 05:16:30 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 28 Jun 2003 21:16:30 -0700 Subject: [Python-checkins] python/dist/src/Lib SimpleXMLRPCServer.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv5514 Modified Files: SimpleXMLRPCServer.py Log Message: fix problems found by pychecker Index: SimpleXMLRPCServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/SimpleXMLRPCServer.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SimpleXMLRPCServer.py 1 May 2003 05:05:09 -0000 1.5 --- SimpleXMLRPCServer.py 29 Jun 2003 04:16:28 -0000 1.6 *************** *** 306,310 **** return "" else: ! return pydoc.getdoc(method) def system_multicall(self, call_list): --- 306,311 ---- return "" else: ! import pydoc ! return pydoc.getdoc(method) def system_multicall(self, call_list): *************** *** 486,490 **** print 'Content-Length: %d' % len(response) print ! sys.stdout.write(reponse) def handle_request(self, request_text = None): --- 487,491 ---- print 'Content-Length: %d' % len(response) print ! sys.stdout.write(response) def handle_request(self, request_text = None): From nnorwitz@users.sourceforge.net Sun Jun 29 05:16:51 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 28 Jun 2003 21:16:51 -0700 Subject: [Python-checkins] python/dist/src/Lib _strptime.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv5562 Modified Files: _strptime.py Log Message: use == like all the other conditionals Index: _strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** _strptime.py 13 May 2003 20:28:15 -0000 1.18 --- _strptime.py 29 Jun 2003 04:16:49 -0000 1.19 *************** *** 462,466 **** elif group_key == 'd': day = int(found_dict['d']) ! elif group_key is 'H': hour = int(found_dict['H']) elif group_key == 'I': --- 462,466 ---- elif group_key == 'd': day = int(found_dict['d']) ! elif group_key == 'H': hour = int(found_dict['H']) elif group_key == 'I': From nnorwitz@users.sourceforge.net Sun Jun 29 05:17:48 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 28 Jun 2003 21:17:48 -0700 Subject: [Python-checkins] python/dist/src/Lib platform.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv5660 Modified Files: platform.py Log Message: remove extra parameter from _java_getprop, remove duplicate imports Index: platform.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/platform.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** platform.py 24 Apr 2003 16:36:49 -0000 1.4 --- platform.py 29 Jun 2003 04:17:45 -0000 1.5 *************** *** 586,590 **** return release,versioninfo,machine ! def _java_getprop(self,name,default): from java.lang import System --- 586,590 ---- return release,versioninfo,machine ! def _java_getprop(name,default): from java.lang import System *************** *** 1080,1084 **** """ global _sys_version_cache ! import sys, re, time if _sys_version_cache is not None: --- 1080,1084 ---- """ global _sys_version_cache ! import time if _sys_version_cache is not None: From nnorwitz@users.sourceforge.net Sun Jun 29 05:18:18 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 28 Jun 2003 21:18:18 -0700 Subject: [Python-checkins] python/dist/src/Lib timeit.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv5721 Modified Files: timeit.py Log Message: remove unused import math Index: timeit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/timeit.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** timeit.py 20 May 2003 04:59:56 -0000 1.12 --- timeit.py 29 Jun 2003 04:18:15 -0000 1.13 *************** *** 53,57 **** import sys - import math import time try: --- 53,56 ---- From nnorwitz@users.sourceforge.net Sun Jun 29 05:19:39 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 28 Jun 2003 21:19:39 -0700 Subject: [Python-checkins] python/dist/src/Lib SimpleXMLRPCServer.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv5858 Modified Files: SimpleXMLRPCServer.py Log Message: whitespace normalization Index: SimpleXMLRPCServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/SimpleXMLRPCServer.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SimpleXMLRPCServer.py 29 Jun 2003 04:16:28 -0000 1.6 --- SimpleXMLRPCServer.py 29 Jun 2003 04:19:37 -0000 1.7 *************** *** 307,311 **** else: import pydoc ! return pydoc.getdoc(method) def system_multicall(self, call_list): --- 307,311 ---- else: import pydoc ! return pydoc.getdoc(method) def system_multicall(self, call_list): From nnorwitz@users.sourceforge.net Sun Jun 29 05:21:45 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 28 Jun 2003 21:21:45 -0700 Subject: [Python-checkins] python/dist/src/Lib imaplib.py,1.63,1.64 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv6066 Modified Files: imaplib.py Log Message: Comment out cap, it was unused. Should all the commented out code be removed? Index: imaplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/imaplib.py,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** imaplib.py 29 Apr 2003 23:58:08 -0000 1.63 --- imaplib.py 29 Jun 2003 04:21:43 -0000 1.64 *************** *** 331,335 **** """ mech = mechanism.upper() ! cap = 'AUTH=%s' % mech #if not cap in self.capabilities: # Let the server decide! # raise self.error("Server doesn't allow %s authentication." % mech) --- 331,336 ---- """ mech = mechanism.upper() ! # XXX: shouldn't this code be removed, not commented out? ! #cap = 'AUTH=%s' % mech #if not cap in self.capabilities: # Let the server decide! # raise self.error("Server doesn't allow %s authentication." % mech) From nnorwitz@users.sourceforge.net Sun Jun 29 05:23:37 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 28 Jun 2003 21:23:37 -0700 Subject: [Python-checkins] python/dist/src/Lib ConfigParser.py,1.57,1.58 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv6264 Modified Files: ConfigParser.py Log Message: Fix arguments for instantiating InterpolationSyntaxError Index: ConfigParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ConfigParser.py,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** ConfigParser.py 31 Dec 2002 17:23:27 -0000 1.57 --- ConfigParser.py 29 Jun 2003 04:23:35 -0000 1.58 *************** *** 598,603 **** m = self._interpvar_match(rest) if m is None: ! raise InterpolationSyntaxError( ! "bad interpolation variable reference", rest) var = m.group(1) rest = rest[m.end():] --- 598,603 ---- m = self._interpvar_match(rest) if m is None: ! raise InterpolationSyntaxError(option, section, ! "bad interpolation variable reference %r" % rest) var = m.group(1) rest = rest[m.end():] *************** *** 614,617 **** else: raise InterpolationSyntaxError( ! option, section, rest, "'%' must be followed by '%' or '(', found: " + `rest`) --- 614,617 ---- else: raise InterpolationSyntaxError( ! option, section, "'%' must be followed by '%' or '(', found: " + `rest`) From rhettinger@users.sourceforge.net Sun Jun 29 05:40:24 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 28 Jun 2003 21:40:24 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py,1.65,1.66 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv7356 Modified Files: test_socket.py Log Message: SF patch #760257: add socket.timeout exception (Contributed by Bob Halley) Add unittests for the new socket.timeout exception. Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** test_socket.py 12 May 2003 20:19:37 -0000 1.65 --- test_socket.py 29 Jun 2003 04:40:22 -0000 1.66 *************** *** 683,690 **** bufsize = 2 # Exercise the buffering code def test_main(): ! tests = [ GeneralModuleTests, BasicTCPTest ] if sys.platform != 'mac': ! tests.append(BasicUDPTest) tests.extend([ --- 683,745 ---- bufsize = 2 # Exercise the buffering code + class TCPTimeoutTest(SocketTCPTest): + + def testTCPTimeout(self): + def raise_timeout(*args, **kwargs): + self.serv.settimeout(1.0) + self.serv.accept() + self.failUnlessRaises(socket.timeout, raise_timeout, + "Error generating a timeout exception (TCP)") + + def testTimeoutZero(self): + ok = False + try: + self.serv.settimeout(0.0) + foo = self.serv.accept() + except socket.timeout: + self.fail("caught timeout instead of error (TCP)") + except socket.error: + ok = True + except: + self.fail("caught unexpected exception (TCP)") + if not ok: + self.fail("accept() returned success when we did not expect it") + + class UDPTimeoutTest(SocketTCPTest): + + def testUDPTimeout(self): + def raise_timeout(*args, **kwargs): + self.serv.settimeout(1.0) + self.serv.recv(1024) + self.failUnlessRaises(socket.timeout, raise_timeout, + "Error generating a timeout exception (UDP)") + + def testTimeoutZero(self): + ok = False + try: + self.serv.settimeout(0.0) + foo = self.serv.recv(1024) + except socket.timeout: + self.fail("caught timeout instead of error (UDP)") + except socket.error: + ok = True + except: + self.fail("caught unexpected exception (UDP)") + if not ok: + self.fail("recv() returned success when we did not expect it") + + class TestExceptions(unittest.TestCase): + + def testExceptionTree(self): + self.assert_(issubclass(socket.error, Exception)) + self.assert_(issubclass(socket.herror, socket.error)) + self.assert_(issubclass(socket.gaierror, socket.error)) + self.assert_(issubclass(socket.timeout, socket.error)) + + def test_main(): ! tests = [GeneralModuleTests, BasicTCPTest, TCPTimeoutTest, TestExceptions] if sys.platform != 'mac': ! tests.extend([ BasicUDPTest, UDPTimeoutTest ]) tests.extend([ From nnorwitz@users.sourceforge.net Sun Jun 29 05:50:36 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat, 28 Jun 2003 21:50:36 -0700 Subject: [Python-checkins] python/dist/src/Lib/xml/dom expatbuilder.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/xml/dom In directory sc8-pr-cvs1:/tmp/cvs-serv8334 Modified Files: expatbuilder.py Log Message: Add missing self. before curNode. This may need to be committed to PyXML, I'm not sure of the procedure. Index: expatbuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xml/dom/expatbuilder.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** expatbuilder.py 26 Jan 2003 09:01:30 -0000 1.2 --- expatbuilder.py 29 Jun 2003 04:50:34 -0000 1.3 *************** *** 270,274 **** _append_child(self.curNode, node) if self._filter and self._filter.acceptNode(node) == FILTER_REJECT: ! curNode.removeChild(node) def character_data_handler_cdata(self, data): --- 270,274 ---- _append_child(self.curNode, node) if self._filter and self._filter.acceptNode(node) == FILTER_REJECT: ! self.curNode.removeChild(node) def character_data_handler_cdata(self, data): From rhettinger@users.sourceforge.net Sun Jun 29 05:53:25 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 28 Jun 2003 21:53:25 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.107,1.108 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv8664 Modified Files: ref3.tex Log Message: Minor fixes to punctuation and grammar. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.107 retrieving revision 1.108 diff -C2 -d -r1.107 -r1.108 *** ref3.tex 27 Jun 2003 06:57:56 -0000 1.107 --- ref3.tex 29 Jun 2003 04:53:23 -0000 1.108 *************** *** 1325,1330 **** \begin{datadesc}{__slots__} This class variable can be assigned a string, iterable, or sequence of strings ! with variable names used by instances. If defined in a new-style class ! definition, \var{__slots__} reserves space for the declared variables and prevents the automatic creation of \var{__dict__} and \var{__weakref__} for each instance. --- 1325,1330 ---- \begin{datadesc}{__slots__} This class variable can be assigned a string, iterable, or sequence of strings ! with variable names used by instances. If defined in a new-style class, ! \var{__slots__} reserves space for the declared variables and prevents the automatic creation of \var{__dict__} and \var{__weakref__} for each instance. *************** *** 1333,1337 **** \noindent ! Notes on Using \var{__slots__} \begin{itemize} --- 1333,1337 ---- \noindent ! Notes on using \var{__slots__} \begin{itemize} *************** *** 1350,1354 **** If weak reference support is needed, then add \code{'__weakref__'} to the sequence of strings in the \var{__slots__} declaration. ! \versionchanged[Previously, adding \code{__weakref__} to the \var{__slots__} declaration would not enable support for weak references]{2.3} --- 1350,1354 ---- If weak reference support is needed, then add \code{'__weakref__'} to the sequence of strings in the \var{__slots__} declaration. ! \versionchanged[Previously, adding \code{'__weakref__'} to the \var{__slots__} declaration would not enable support for weak references]{2.3} *************** *** 1371,1375 **** built-in types such as \class{long}, \class{str} and \class{tuple}. ! \item Any non-string iterable may be assigned \var{__slots__}. Mappings may also be used; however, in the future, special meaning may be assigned to the values corresponding to each key. --- 1371,1375 ---- built-in types such as \class{long}, \class{str} and \class{tuple}. ! \item Any non-string iterable may be assigned to \var{__slots__}. Mappings may also be used; however, in the future, special meaning may be assigned to the values corresponding to each key. From rhettinger@users.sourceforge.net Sun Jun 29 05:56:01 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 28 Jun 2003 21:56:01 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libsocket.tex,1.74,1.75 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv8888 Modified Files: libsocket.tex Log Message: SF patch #760257: add socket.timeout exception (Contributed by Bob Halley) Add documentation for the new socket.timeout exception. Index: libsocket.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsocket.tex,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** libsocket.tex 20 Jun 2003 17:11:39 -0000 1.74 --- libsocket.tex 29 Jun 2003 04:55:59 -0000 1.75 *************** *** 110,113 **** --- 110,121 ---- \end{excdesc} + \begin{excdesc}{timeout} + This exception is raised when a timeout occurs on a socket which has + had timeouts enabled via a prior call to \method{settimeout()}. The + accompanying value is a string whose value is currently always ``timed + out''. + \versionadded{2.3} + \end{excdesc} + \begin{datadesc}{AF_UNIX} \dataline{AF_INET} *************** *** 580,584 **** can be a nonnegative float expressing seconds, or \code{None}. If a float is ! given, subsequent socket operations will raise an \exception{error} exception if the timeout period \var{value} has elapsed before the operation has completed. Setting a timeout of \code{None} disables --- 588,592 ---- can be a nonnegative float expressing seconds, or \code{None}. If a float is ! given, subsequent socket operations will raise an \exception{timeout} exception if the timeout period \var{value} has elapsed before the operation has completed. Setting a timeout of \code{None} disables From rhettinger@users.sourceforge.net Sun Jun 29 06:06:58 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 28 Jun 2003 22:06:58 -0700 Subject: [Python-checkins] python/dist/src/Lib CGIHTTPServer.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv9787 Modified Files: CGIHTTPServer.py Log Message: SF bug #430160: CGIHTTPServer.py POST bug using IE Minor improvement to previous bugfix. Eating the remaining characters would lead to an endless loop without a termination test. Index: CGIHTTPServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/CGIHTTPServer.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** CGIHTTPServer.py 8 Jan 2003 18:53:18 -0000 1.30 --- CGIHTTPServer.py 29 Jun 2003 05:06:56 -0000 1.31 *************** *** 203,207 **** # throw away additional data [see bug #427345] while select.select([self.rfile], [], [], 0)[0]: ! waste = self.rfile.read(1) if sts: self.log_error("CGI script exit status %#x", sts) --- 203,208 ---- # throw away additional data [see bug #427345] while select.select([self.rfile], [], [], 0)[0]: ! if not self.rfile.read(1): ! break if sts: self.log_error("CGI script exit status %#x", sts) *************** *** 251,255 **** # throw away additional data [see bug #427345] while select.select([self.rfile._sock], [], [], 0)[0]: ! waste = self.rfile._sock.recv(1) fi.close() shutil.copyfileobj(fo, self.wfile) --- 252,257 ---- # throw away additional data [see bug #427345] while select.select([self.rfile._sock], [], [], 0)[0]: ! if not self.rfile._sock.recv(1): ! break fi.close() shutil.copyfileobj(fo, self.wfile) From tim_one@users.sourceforge.net Sun Jun 29 06:30:50 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 28 Jun 2003 22:30:50 -0700 Subject: [Python-checkins] python/dist/src/Lib doctest.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv11324/Lib Modified Files: doctest.py Log Message: Some nifty doctest extensions from Jim Fulton, currently used in Zope3. I won't have time to write real docs, but spent a lot of time adding comments to his code and fleshing out the exported functions' docstrings. There's probably opportunity to consolidate how docstrings get extracted too, and the new code for that is probably better than the old code for that (which strained mightily to recover from 2.2's new class/type gimmicks). Index: doctest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/doctest.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** doctest.py 29 Jun 2003 03:11:20 -0000 1.27 --- doctest.py 29 Jun 2003 05:30:48 -0000 1.28 *************** *** 278,281 **** --- 278,285 ---- 'is_private', 'Tester', + 'DocTestTestFailure', + 'DocTestSuite', + 'testsource', + 'debug', ] *************** *** 1150,1153 **** --- 1154,1421 ---- master.merge(tester) return failures, tries + + ########################################################################### + # Various doctest extensions, to make using doctest with unittest + # easier, and to help debugging when a doctest goes wrong. Original + # code by Jim Fulton. + + # Utilities. + + # If module is None, return the calling module (the module that called + # the routine that called _normalize_module -- this normally won't be + # doctest!). If module is a string, it should be the (possibly dotted) + # name of a module, and the (rightmost) module object is returned. Else + # module is returned untouched; the intent appears to be that module is + # already a module object in this case (although this isn't checked). + + def _normalize_module(module): + import sys + + if module is None: + # Get our caller's caller's module. + module = sys._getframe(2).f_globals['__name__'] + module = sys.modules[module] + + elif isinstance(module, (str, unicode)): + # The ["*"] at the end is a mostly meaningless incantation with + # a crucial property: if, e.g., module is 'a.b.c', it convinces + # __import__ to return c instead of a. + module = __import__(module, globals(), locals(), ["*"]) + + return module + + # tests is a list of (testname, docstring, filename, lineno) tuples. + # If object has a __doc__ attr, and the __doc__ attr looks like it + # contains a doctest (specifically, if it contains an instance of '>>>'), + # then tuple + # prefix + name, object.__doc__, filename, lineno + # is appended to tests. Else tests is left alone. + # There is no return value. + + def _get_doctest(name, object, tests, prefix, filename='', lineno=''): + doc = getattr(object, '__doc__', '') + if isinstance(doc, basestring) and '>>>' in doc: + tests.append((prefix + name, doc, filename, lineno)) + + # tests is a list of (testname, docstring, filename, lineno) tuples. + # docstrings containing doctests are appended to tests (if any are found). + # items is a dict, like a module or class dict, mapping strings to objects. + # mdict is the global dict of a "home" module -- only objects belonging + # to this module are searched for docstrings. module is the module to + # which mdict belongs. + # prefix is a string to be prepended to an object's name when adding a + # tuple to tests. + # The objects (values) in items are examined (recursively), and doctests + # belonging to functions and classes in the home module are appended to + # tests. + # minlineno is a gimmick to try to guess the file-relative line number + # at which a doctest probably begins. + + def _extract_doctests(items, module, mdict, tests, prefix, minlineno=0): + + for name, object in items: + # Only interested in named objects. + if not hasattr(object, '__name__'): + continue + + elif hasattr(object, 'func_globals'): + # Looks like a function. + if object.func_globals is not mdict: + # Non-local function. + continue + code = getattr(object, 'func_code', None) + filename = getattr(code, 'co_filename', '') + lineno = getattr(code, 'co_firstlineno', -1) + 1 + if minlineno: + minlineno = min(lineno, minlineno) + else: + minlineno = lineno + _get_doctest(name, object, tests, prefix, filename, lineno) + + elif hasattr(object, "__module__"): + # Maybe a class-like thing, in which case we care. + if object.__module__ != module.__name__: + # Not the same module. + continue + if not (hasattr(object, '__dict__') + and hasattr(object, '__bases__')): + # Not a class. + continue + + lineno = _extract_doctests(object.__dict__.items(), + module, + mdict, + tests, + prefix + name + ".") + # XXX "-3" is unclear. + _get_doctest(name, object, tests, prefix, + lineno="%s (or above)" % (lineno - 3)) + + return minlineno + + # Find all the doctests belonging to the module object. + # Return a list of + # (testname, docstring, filename, lineno) + # tuples. + + def _find_tests(module, prefix=None): + if prefix is None: + prefix = module.__name__ + mdict = module.__dict__ + tests = [] + # Get the module-level doctest (if any). + _get_doctest(prefix, module, tests, '', lineno="1 (or above)") + # Recursively search the module __dict__ for doctests. + if prefix: + prefix += "." + _extract_doctests(mdict.items(), module, mdict, tests, prefix) + return tests + + # unittest helpers. + + # A function passed to unittest, for unittest to drive. + # tester is doctest Tester instance. doc is the docstring whose + # doctests are to be run. + + def _utest(tester, name, doc, filename, lineno): + import sys + from StringIO import StringIO + + old = sys.stdout + sys.stdout = new = StringIO() + try: + failures, tries = tester.runstring(doc, name) + finally: + sys.stdout = old + + if failures: + msg = new.getvalue() + lname = '.'.join(name.split('.')[-1:]) + if not lineno: + lineno = "0 (don't know line number)" + # Don't change this format! It was designed so that Emacs can + # parse it naturally. + raise DocTestTestFailure('Failed doctest test for %s\n' + ' File "%s", line %s, in %s\n\n%s' % + (name, filename, lineno, lname, msg)) + + class DocTestTestFailure(Exception): + """A doctest test failed""" + + def DocTestSuite(module=None): + """Convert doctest tests for a module to a unittest TestSuite. + + The returned TestSuite is to be run by the unittest framework, and + runs each doctest in the module. If any of the doctests fail, + then the synthesized unit test fails, and an error is raised showing + the name of the file containing the test and a (sometimes approximate) + line number. + + The optional module argument provides the module to be tested. It + can be a module object or a (possibly dotted) module name. If not + specified, the module calling DocTestSuite() is used. + + Example (although note that unittest supplies many ways to use the + TestSuite returned; see the unittest docs): + + import unittest + import doctest + import my_module_with_doctests + + suite = doctest.DocTestSuite(my_module_with_doctests) + runner = unittest.TextTestRunner() + runner.run(suite) + """ + + import unittest + + module = _normalize_module(module) + tests = _find_tests(module) + if not tests: + raise ValueError(module, "has no tests") + + tests.sort() + suite = unittest.TestSuite() + tester = Tester(module) + for name, doc, filename, lineno in tests: + if not filename: + filename = module.__file__ + if filename.endswith(".pyc"): + filename = filename[:-1] + elif filename.endswith(".pyo"): + filename = filename[:-1] + def runit(name=name, doc=doc, filename=filename, lineno=lineno): + _utest(tester, name, doc, filename, lineno) + suite.addTest(unittest.FunctionTestCase( + runit, + description="doctest of " + name)) + return suite + + # Debugging support. + + def _expect(expect): + # Return the expected output (if any), formatted as a Python + # comment block. + if expect: + expect = "\n# ".join(expect.split("\n")) + expect = "\n# Expect:\n# %s" % expect + return expect + + def testsource(module, name): + """Extract the doctest examples from a docstring. + + Provide the module (or dotted name of the module) containing the + tests to be extracted, and the name (within the module) of the object + with the docstring containing the tests to be extracted. + + The doctest examples are returned as a string containing Python + code. The expected output blocks in the examples are converted + to Python comments. + """ + + module = _normalize_module(module) + tests = _find_tests(module, "") + test = [doc for (tname, doc, dummy, dummy) in tests + if tname == name] + if not test: + raise ValueError(name, "not found in tests") + test = test[0] + examples = [source + _expect(expect) + for source, expect, dummy in _extract_examples(test)] + return '\n'.join(examples) + + def debug(module, name): + """Debug a single docstring containing doctests. + + Provide the module (or dotted name of the module) containing the + docstring to be debugged, and the name (within the module) of the + object with the docstring to be debugged. + + The doctest examples are extracted (see function testsource()), + and written to a temp file. The Python debugger (pdb) is then + invoked on that file. + """ + + import os + import pdb + import tempfile + + module = _normalize_module(module) + testsrc = testsource(module, name) + srcfilename = tempfile.mktemp("doctestdebug.py") + f = file(srcfilename, 'w') + f.write(testsrc) + f.close() + + globs = {} + globs.update(module.__dict__) + try: + # Note that %r is vital here. '%s' instead can, e.g., cause + # backslashes to get treated as metacharacters on Windows. + pdb.run("execfile(%r)" % srcfilename, globs, globs) + finally: + os.remove(srcfilename) + + class _TestClass: From tim_one@users.sourceforge.net Sun Jun 29 06:30:50 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 28 Jun 2003 22:30:50 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.793,1.794 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv11324/Misc Modified Files: NEWS Log Message: Some nifty doctest extensions from Jim Fulton, currently used in Zope3. I won't have time to write real docs, but spent a lot of time adding comments to his code and fleshing out the exported functions' docstrings. There's probably opportunity to consolidate how docstrings get extracted too, and the new code for that is probably better than the old code for that (which strained mightily to recover from 2.2's new class/type gimmicks). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.793 retrieving revision 1.794 diff -C2 -d -r1.793 -r1.794 *** NEWS 29 Jun 2003 03:29:42 -0000 1.793 --- NEWS 29 Jun 2003 05:30:48 -0000 1.794 *************** *** 87,90 **** --- 87,105 ---- ------- + - Some happy doctest extensions from Jim Fulton have been added to + doctest.py. These are already being used in Zope3. The two + primary ones: + + doctest.debug(module, name) extracts the doctests from the named object + in the given module, puts them in a temp file, and starts pdb running + on that file. This is great when a doctest fails. + + doctest.DocTestSuite(module=None) returns a synthesized unittest + TestSuite instance, to be run by the unittest framework, which + runs all the doctests in the module. This allows writing tests in + doctest style (which can be clearer and shorter than writing tests + in unittest style), without losing unittest's powerful testing + framework features (which doctest lacks). + - ZipFile.testzip() now only traps BadZipfile exceptions. Previously, a bare except caught to much and reported all errors as a problem From tim_one@users.sourceforge.net Sun Jun 29 06:46:56 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 28 Jun 2003 22:46:56 -0700 Subject: [Python-checkins] python/dist/src/Lib cgitb.py,1.8,1.9 inspect.py,1.46,1.47 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv12735/Lib Modified Files: cgitb.py inspect.py Log Message: Whitespace normalization. Index: cgitb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/cgitb.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** cgitb.py 17 Jun 2003 12:58:31 -0000 1.8 --- cgitb.py 29 Jun 2003 05:46:53 -0000 1.9 *************** *** 10,14 **** logdir - if set, tracebacks are written to files in this directory context - number of lines of source code to show for each stack frame ! format - 'text' or 'html' controls the output format By default, tracebacks are displayed but not saved, the context is 5 lines --- 10,14 ---- logdir - if set, tracebacks are written to files in this directory context - number of lines of source code to show for each stack frame ! format - 'text' or 'html' controls the output format By default, tracebacks are displayed but not saved, the context is 5 lines Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** inspect.py 27 Jun 2003 18:41:20 -0000 1.46 --- inspect.py 29 Jun 2003 05:46:53 -0000 1.47 *************** *** 326,330 **** if iscode(object): return object.co_filename ! raise TypeError('arg is not a module, class, method, ' 'function, traceback, frame, or code object') --- 326,330 ---- if iscode(object): return object.co_filename ! raise TypeError('arg is not a module, class, method, ' 'function, traceback, frame, or code object') From tim_one@users.sourceforge.net Sun Jun 29 06:46:56 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 28 Jun 2003 22:46:56 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_bool.py,1.14,1.15 test_complex.py,1.10,1.11 test_posixpath.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv12735/Lib/test Modified Files: test_bool.py test_complex.py test_posixpath.py Log Message: Whitespace normalization. Index: test_bool.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bool.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_bool.py 27 Jun 2003 17:40:16 -0000 1.14 --- test_bool.py 29 Jun 2003 05:46:53 -0000 1.15 *************** *** 330,344 **** return self check(Foo()) ! class Bar(object): def __nonzero__(self): return "Yes" check(Bar()) ! class Baz(int): def __nonzero__(self): return self check(Baz()) ! def test_main(): --- 330,344 ---- return self check(Foo()) ! class Bar(object): def __nonzero__(self): return "Yes" check(Bar()) ! class Baz(int): def __nonzero__(self): return self check(Baz()) ! def test_main(): Index: test_complex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_complex.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_complex.py 18 Jun 2003 14:26:18 -0000 1.10 --- test_complex.py 29 Jun 2003 05:46:54 -0000 1.11 *************** *** 209,213 **** class EvilExc(Exception): ! pass class evilcomplex: --- 209,213 ---- class EvilExc(Exception): ! pass class evilcomplex: Index: test_posixpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_posixpath.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_posixpath.py 19 Jun 2003 10:21:14 -0000 1.7 --- test_posixpath.py 29 Jun 2003 05:46:54 -0000 1.8 *************** *** 238,242 **** True ) ! # If we don't have links, assume that os.stat doesn't return resonable # inode information and thus, that samefile() doesn't work if hasattr(os, "symlink"): --- 238,242 ---- True ) ! # If we don't have links, assume that os.stat doesn't return resonable # inode information and thus, that samefile() doesn't work if hasattr(os, "symlink"): *************** *** 289,293 **** True ) ! # If we don't have links, assume that os.stat() doesn't return resonable # inode information and thus, that samefile() doesn't work if hasattr(os, "symlink"): --- 289,293 ---- True ) ! # If we don't have links, assume that os.stat() doesn't return resonable # inode information and thus, that samefile() doesn't work if hasattr(os, "symlink"): From nnorwitz@users.sourceforge.net Sun Jun 29 15:48:34 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 29 Jun 2003 07:48:34 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.366,2.367 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv7530/Python Modified Files: ceval.c Log Message: Fix SF #762455, segfault when sys.stdout is changed in getattr Will backport. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.366 retrieving revision 2.367 diff -C2 -d -r2.366 -r2.367 *** ceval.c 28 Jun 2003 21:53:52 -0000 2.366 --- ceval.c 29 Jun 2003 14:48:32 -0000 2.367 *************** *** 1502,1505 **** --- 1502,1510 ---- } } + /* PyFile_SoftSpace() can exececute arbitrary code + if sys.stdout is an instance with a __getattr__. + If __getattr__ raises an exception, w will + be freed, so we need to prevent that temporarily. */ + Py_XINCREF(w); if (w != NULL && PyFile_SoftSpace(w, 0)) err = PyFile_WriteString(" ", w); *************** *** 1529,1532 **** --- 1534,1538 ---- PyFile_SoftSpace(w, 1); } + Py_XDECREF(w); Py_DECREF(v); Py_XDECREF(stream); From nnorwitz@users.sourceforge.net Sun Jun 29 15:57:12 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 29 Jun 2003 07:57:12 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.301.4.8,2.301.4.9 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv8561/Python Modified Files: Tag: release22-maint ceval.c Log Message: Backport: Fix SF #762455, segfault when sys.stdout is changed in getattr Note: in 2.2, the problem was an infinite loop (at least for me). Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.301.4.8 retrieving revision 2.301.4.9 diff -C2 -d -r2.301.4.8 -r2.301.4.9 *** ceval.c 7 Oct 2002 09:47:20 -0000 2.301.4.8 --- ceval.c 29 Jun 2003 14:57:10 -0000 2.301.4.9 *************** *** 1366,1369 **** --- 1366,1374 ---- } } + /* PyFile_SoftSpace() can exececute arbitrary code + if sys.stdout is an instance with a __getattr__. + If __getattr__ raises an exception, w will + be freed, so we need to prevent that temporarily. */ + Py_XINCREF(w); if (w != NULL && PyFile_SoftSpace(w, 1)) err = PyFile_WriteString(" ", w); *************** *** 1391,1394 **** --- 1396,1400 ---- #endif } + Py_XDECREF(w); Py_DECREF(v); Py_XDECREF(stream); From rhettinger@users.sourceforge.net Sun Jun 29 16:44:09 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 29 Jun 2003 08:44:09 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.195,1.196 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14333 Modified Files: test_descr.py Log Message: SF bug #762455: Python segfaults when sys.stdout is changed in getattr * Added unittest that fails before, but not after Neil's fix to ceval.c. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.195 retrieving revision 1.196 diff -C2 -d -r1.195 -r1.196 *** test_descr.py 18 Jun 2003 01:13:41 -0000 1.195 --- test_descr.py 29 Jun 2003 15:44:07 -0000 1.196 *************** *** 3917,3920 **** --- 3917,3934 ---- del o + # Fix SF #762455, segfault when sys.stdout is changed in getattr + def filefault(): + if verbose: + print "Testing sys.stdout is changed in getattr..." + import sys + class StdoutGuard: + def __getattr__(self, attr): + sys.stdout = sys.__stdout__ + raise RuntimeError("Premature access to sys.stdout.%s" % attr) + sys.stdout = StdoutGuard() + try: + print "Oops!" + except RuntimeError: + pass def test_main(): *************** *** 4008,4011 **** --- 4022,4026 ---- proxysuper() carloverre() + filefault() if verbose: print "All OK" From aimacintyre@users.sourceforge.net Sun Jun 29 16:46:23 2003 From: aimacintyre@users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Sun, 29 Jun 2003 08:46:23 -0700 Subject: [Python-checkins] python/dist/src/Include py_curses.h,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv14629 Modified Files: py_curses.h Log Message: FreeBSD 5.x uses different wchar_t/win_t guards than earlier versions Index: py_curses.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/py_curses.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** py_curses.h 11 Jun 2003 12:26:08 -0000 1.7 --- py_curses.h 29 Jun 2003 15:46:21 -0000 1.8 *************** *** 19,22 **** --- 19,33 ---- */ #ifdef _XOPEN_SOURCE_EXTENDED + #ifndef __FreeBSD_version + #include + #endif + #if __FreeBSD_version >= 500000 + #ifndef __wchar_t + #define __wchar_t + #endif + #ifndef __wint_t + #define __wint_t + #endif + #else #ifndef _WCHAR_T #define _WCHAR_T *************** *** 24,27 **** --- 35,39 ---- #ifndef _WINT_T #define _WINT_T + #endif #endif #endif From rhettinger@users.sourceforge.net Sun Jun 29 16:57:52 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 29 Jun 2003 08:57:52 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_strptime.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv16059 Modified Files: test_strptime.py Log Message: Removed invalid test. Analysis by Bob Halley: The test seems to expect that if time.daylight is true, then the is_dst field of the tm structure will be 1 too. But this isn't the case, since daylight is true if the timezone does DST, *not* if DST is in effect. Index: test_strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_strptime.py 11 May 2003 06:23:36 -0000 1.14 --- test_strptime.py 29 Jun 2003 15:57:50 -0000 1.15 *************** *** 300,306 **** strp_output = _strptime.strptime("GMT", "%Z") self.failUnlessEqual(strp_output.tm_isdst, 0) - if time.daylight: - strp_output = _strptime.strptime(time.tzname[1], "%Z") - self.failUnlessEqual(strp_output[8], 1) time_tuple = time.localtime() strf_output = time.strftime("%Z") #UTC does not have a timezone --- 300,303 ---- From montanaro@users.sourceforge.net Sun Jun 29 17:01:53 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sun, 29 Jun 2003 09:01:53 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.189,1.190 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv16820 Modified Files: tut.tex Log Message: minor wordsmithing Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.189 retrieving revision 1.190 diff -C2 -d -r1.189 -r1.190 *** tut.tex 28 Jun 2003 11:50:34 -0000 1.189 --- tut.tex 29 Jun 2003 16:01:51 -0000 1.190 *************** *** 308,312 **** It is possible to use encodings different than ASCII in Python source files. The best way to do it is to put one more special comment line ! right after \code{\#!} line making proper encoding declaration: \begin{verbatim} --- 308,312 ---- It is possible to use encodings different than ASCII in Python source files. The best way to do it is to put one more special comment line ! right after the \code{\#!} line to define the source file encoding: \begin{verbatim} *************** *** 314,321 **** \end{verbatim} ! With that declaration, all characters in the source file will be ! treated as belonging to \code{iso-8859-1} encoding, and it will be possible to directly write Unicode string literals in the selected ! encoding. The list of possible encodings can be found in the \citetitle[../lib/lib.html]{Python Library Reference}, in the section on \module{codecs}. --- 314,321 ---- \end{verbatim} ! With that declaration, all characters in the source file will be treated as ! {}\code{iso-8859-1}, and it will be possible to directly write Unicode string literals in the selected ! encoding. The list of possible encodings can be found in the \citetitle[../lib/lib.html]{Python Library Reference}, in the section on \module{codecs}. *************** *** 323,327 **** If your editor supports saving files as \code{UTF-8} with an UTF-8 signature (aka BOM -- Byte Order Mark), you can use that instead of an ! encoding declaration. IDLE supports such saving if \code{Options/General/Default Source Encoding/UTF-8} is set. Notice that this signature is not understood in older Python releases (2.2 --- 323,327 ---- If your editor supports saving files as \code{UTF-8} with an UTF-8 signature (aka BOM -- Byte Order Mark), you can use that instead of an ! encoding declaration. IDLE supports this capability if \code{Options/General/Default Source Encoding/UTF-8} is set. Notice that this signature is not understood in older Python releases (2.2 *************** *** 329,333 **** \code{\#!} files. ! By using UTF-8 (either through the signature, or a an encoding declaration), characters of most languages in the world can be used simultaneously in string literals and comments. Using non-ASCII --- 329,333 ---- \code{\#!} files. ! By using UTF-8 (either through the signature or an encoding declaration), characters of most languages in the world can be used simultaneously in string literals and comments. Using non-ASCII From tim_one@users.sourceforge.net Sun Jun 29 17:18:10 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 29 Jun 2003 09:18:10 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.794,1.795 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv18774/python/Misc Modified Files: NEWS Log Message: Filled in release date; repaired grammar in a news item. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.794 retrieving revision 1.795 diff -C2 -d -r1.794 -r1.795 *** NEWS 29 Jun 2003 05:30:48 -0000 1.794 --- NEWS 29 Jun 2003 16:18:08 -0000 1.795 *************** *** 8,12 **** ================================ ! *Release date: XX-XXX-2003* Core and builtins --- 8,12 ---- ================================ ! *Release date: 29-Jun-2003* Core and builtins *************** *** 164,169 **** - Tools/idle is gone; long live Lib/idlelib. ! - diff.py is a new script for print file diffs in context, unified, or ndiff ! formats. Provides an alternate command line interface to difflib.py. - texcheck.py is a new script for making a rough validation of Python LaTeX --- 164,169 ---- - Tools/idle is gone; long live Lib/idlelib. ! - diff.py prints file diffs in context, unified, or ndiff formats, ! providing a command line interface to difflib.py. - texcheck.py is a new script for making a rough validation of Python LaTeX From tim_one@users.sourceforge.net Sun Jun 29 17:50:08 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 29 Jun 2003 09:50:08 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.795,1.796 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv23543/python/Misc Modified Files: NEWS Log Message: Provide dummy (do-nothing) settrace() and setprofile() functions until Jeremy can check in the real things. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.795 retrieving revision 1.796 diff -C2 -d -r1.795 -r1.796 *** NEWS 29 Jun 2003 16:18:08 -0000 1.795 --- NEWS 29 Jun 2003 16:50:06 -0000 1.796 *************** *** 128,131 **** --- 128,135 ---- module. A function registered with the threading module will be used for all threads it creates. + XXX Somebody forget to check these in to threading.py, although + XXX some other library modules call them. This will be repaired + XXX before the final release. For now, dummy settrace() and + XXX setprofile() functions have been added to threading.py. - copy.py: applied SF patch 707900, fixing bug 702858, by Steven From tim_one@users.sourceforge.net Sun Jun 29 17:50:08 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 29 Jun 2003 09:50:08 -0700 Subject: [Python-checkins] python/dist/src/Lib threading.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv23543/python/Lib Modified Files: threading.py Log Message: Provide dummy (do-nothing) settrace() and setprofile() functions until Jeremy can check in the real things. Index: threading.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/threading.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** threading.py 27 Feb 2003 20:14:41 -0000 1.32 --- threading.py 29 Jun 2003 16:50:06 -0000 1.33 *************** *** 15,19 **** # Rename some stuff so "from threading import *" is safe __all__ = ['activeCount', 'Condition', 'currentThread', 'enumerate', 'Event', ! 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread', 'Timer'] _start_new_thread = thread.start_new_thread --- 15,20 ---- # Rename some stuff so "from threading import *" is safe __all__ = ['activeCount', 'Condition', 'currentThread', 'enumerate', 'Event', ! 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread', ! 'Timer', 'setprofile', 'settrace'] _start_new_thread = thread.start_new_thread *************** *** 601,604 **** --- 602,612 ---- return active + # XXX This needs a real defintion. + def settrace(tracefunc): + pass + + # XXX This needs a real defintion. + def setprofile(dispatchfunc): + pass # Create the main thread object From fdrake@users.sourceforge.net Sun Jun 29 17:55:49 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sun, 29 Jun 2003 09:55:49 -0700 Subject: [Python-checkins] python/dist/src/Doc README,1.47,1.48 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv24151 Modified Files: README Log Message: Update copyright years. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/README,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** README 8 Jul 2002 14:10:41 -0000 1.47 --- README 29 Jun 2003 16:55:47 -0000 1.48 *************** *** 215,219 **** ---------------------------------------------------------------------- ! Copyright (c) 2000-2002 Python Software Foundation. All rights reserved. --- 215,219 ---- ---------------------------------------------------------------------- ! Copyright (c) 2000-2003 Python Software Foundation. All rights reserved. From tim_one@users.sourceforge.net Sun Jun 29 17:56:40 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 29 Jun 2003 09:56:40 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.796,1.797 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv24230/python/Misc Modified Files: NEWS Log Message: Typo repair. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.796 retrieving revision 1.797 diff -C2 -d -r1.796 -r1.797 *** NEWS 29 Jun 2003 16:50:06 -0000 1.796 --- NEWS 29 Jun 2003 16:56:38 -0000 1.797 *************** *** 128,132 **** module. A function registered with the threading module will be used for all threads it creates. ! XXX Somebody forget to check these in to threading.py, although XXX some other library modules call them. This will be repaired XXX before the final release. For now, dummy settrace() and --- 128,132 ---- module. A function registered with the threading module will be used for all threads it creates. ! XXX Somebody forgot to check these in to threading.py, although XXX some other library modules call them. This will be repaired XXX before the final release. For now, dummy settrace() and From jhylton@users.sourceforge.net Sun Jun 29 17:58:43 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 29 Jun 2003 09:58:43 -0700 Subject: [Python-checkins] python/dist/src/Lib threading.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv24496/Lib Modified Files: threading.py Log Message: Add settrace() and setprofile() functions to the threading library. Index: threading.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/threading.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** threading.py 29 Jun 2003 16:50:06 -0000 1.33 --- threading.py 29 Jun 2003 16:58:41 -0000 1.34 *************** *** 53,56 **** --- 53,68 ---- pass + # Support for profile and trace hooks + + _profile_hook = None + _trace_hook = None + + def setprofile(func): + global _profile_hook + _profile_hook = func + + def settrace(func): + global _trace_hook + _trace_hook = func # Synchronization classes *************** *** 409,412 **** --- 421,432 ---- if __debug__: self._note("%s.__bootstrap(): thread started", self) + + if _trace_hook: + self._note("%s.__bootstrap(): registering trace hook", self) + _sys.settrace(_trace_hook) + if _profile_hook: + self._note("%s.__bootstrap(): registering profile hook", self) + _sys.setprofile(_profile_hook) + try: self.run() From jhylton@users.sourceforge.net Sun Jun 29 17:58:43 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 29 Jun 2003 09:58:43 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libthreading.tex,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv24496/Doc/lib Modified Files: libthreading.tex Log Message: Add settrace() and setprofile() functions to the threading library. Index: libthreading.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libthreading.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** libthreading.tex 6 Jan 2003 16:38:10 -0000 1.15 --- libthreading.tex 29 Jun 2003 16:58:41 -0000 1.16 *************** *** 91,94 **** --- 91,108 ---- \end{classdesc*} + \begin{funcdesc}{settrace}{func} + Set a trace function \index{trace function} for all threads started + from the \module{threading} module. The \var{func} will be passed to + \cfuntion{sys.settrace} for each thread, before its \method{run} + method is called. + \end{funcdesc} + + \begin{funcdesc}{setprofile}{func} + Set a profile function \index{profile function} for all threads started + from the \module{threading} module. The \var{func} will be passed to + \cfuntion{sys.setprofile} for each thread, before its \method{run} + method is called. + \end{funcdesc} + Detailed interfaces for the objects are documented below. From jhylton@users.sourceforge.net Sun Jun 29 17:59:46 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 29 Jun 2003 09:59:46 -0700 Subject: [Python-checkins] python/dist/src/Lib linecache.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv24677/Lib Modified Files: linecache.py Log Message: Whitespace normalization. Index: linecache.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/linecache.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** linecache.py 1 Jun 2002 19:51:15 -0000 1.11 --- linecache.py 29 Jun 2003 16:59:43 -0000 1.12 *************** *** 9,13 **** import os ! __all__ = ["getline","clearcache","checkcache"] def getline(filename, lineno): --- 9,13 ---- import os ! __all__ = ["getline", "clearcache", "checkcache"] def getline(filename, lineno): From jhylton@users.sourceforge.net Sun Jun 29 18:00:02 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 29 Jun 2003 10:00:02 -0700 Subject: [Python-checkins] python/dist/src/Lib pickle.py,1.155,1.156 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv24707/Lib Modified Files: pickle.py Log Message: Fix grammar in comment. Index: pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v retrieving revision 1.155 retrieving revision 1.156 diff -C2 -d -r1.155 -r1.156 *** pickle.py 18 Feb 2003 22:49:10 -0000 1.155 --- pickle.py 29 Jun 2003 16:59:59 -0000 1.156 *************** *** 352,356 **** def save_reduce(self, func, args, state=None, listitems=None, dictitems=None, obj=None): ! # This API is be called by some subclasses # Assert that args is a tuple or None --- 352,356 ---- def save_reduce(self, func, args, state=None, listitems=None, dictitems=None, obj=None): ! # This API is called by some subclasses # Assert that args is a tuple or None From bwarsaw@users.sourceforge.net Sun Jun 29 18:07:09 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun, 29 Jun 2003 10:07:09 -0700 Subject: [Python-checkins] python/dist/src/Modules main.c,1.77,1.78 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv25742 Modified Files: main.c Log Message: Py_Main(): Add a check for the PYTHONINSPECT environment variable after running the script so that a program could do something like: os.environ['PYTHONINSPECT'] = 1 to programmatically enter a prompt at the end. (After a patch by Skip Montanaro w/ proposal by Troy Melhase Index: main.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** main.c 30 Mar 2003 17:09:58 -0000 1.77 --- main.c 29 Jun 2003 17:07:06 -0000 1.78 *************** *** 419,422 **** --- 419,431 ---- } + /* Check this environment variable at the end, to give programs the + * opportunity to set it from Python. + */ + if (!saw_inspect_flag && + (p = Py_GETENV("PYTHONINSPECT")) && *p != '\0') + { + inspect = 1; + } + if (inspect && stdin_is_interactive && (filename != NULL || command != NULL)) From jhylton@users.sourceforge.net Sun Jun 29 18:07:48 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 29 Jun 2003 10:07:48 -0700 Subject: [Python-checkins] python/dist/src/Lib threading.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv25801/Lib Modified Files: threading.py Log Message: Remove stub settrace() and setprofile() calls. Index: threading.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/threading.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** threading.py 29 Jun 2003 16:58:41 -0000 1.34 --- threading.py 29 Jun 2003 17:07:46 -0000 1.35 *************** *** 622,633 **** return active - # XXX This needs a real defintion. - def settrace(tracefunc): - pass - - # XXX This needs a real defintion. - def setprofile(dispatchfunc): - pass - # Create the main thread object --- 622,625 ---- From bwarsaw@users.sourceforge.net Sun Jun 29 18:10:13 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun, 29 Jun 2003 10:10:13 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.797,1.798 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv26125 Modified Files: NEWS Log Message: Added news about os.environ['PYTHONINSPECT'] = 'yes' Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.797 retrieving revision 1.798 diff -C2 -d -r1.797 -r1.798 *** NEWS 29 Jun 2003 16:56:38 -0000 1.797 --- NEWS 29 Jun 2003 17:10:11 -0000 1.798 *************** *** 13,16 **** --- 13,21 ---- ----------------- + - A program can now set the environment variable PYTHONINSPECT to some + string value in Python, and cause the interpreter to enter the + interactive prompt at program exit, as if Python had been invoked + with the -i option. + - list.index() now accepts optional start and stop arguments. Similar changes were made to UserList.index(). SF feature request 754014. From tim_one@users.sourceforge.net Sun Jun 29 18:12:32 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 29 Jun 2003 10:12:32 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.798,1.799 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv26361/python/Misc Modified Files: NEWS Log Message: Removed XXX comments about missing threading.py functions. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.798 retrieving revision 1.799 diff -C2 -d -r1.798 -r1.799 *** NEWS 29 Jun 2003 17:10:11 -0000 1.798 --- NEWS 29 Jun 2003 17:12:30 -0000 1.799 *************** *** 133,140 **** module. A function registered with the threading module will be used for all threads it creates. - XXX Somebody forgot to check these in to threading.py, although - XXX some other library modules call them. This will be repaired - XXX before the final release. For now, dummy settrace() and - XXX setprofile() functions have been added to threading.py. - copy.py: applied SF patch 707900, fixing bug 702858, by Steven --- 133,136 ---- From tim_one@users.sourceforge.net Sun Jun 29 18:24:19 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 29 Jun 2003 10:24:19 -0700 Subject: [Python-checkins] python/dist/src/Lib threading.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv28216/Lib Modified Files: threading.py Log Message: Whitespace normalization. Index: threading.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/threading.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** threading.py 29 Jun 2003 17:07:46 -0000 1.35 --- threading.py 29 Jun 2003 17:24:17 -0000 1.36 *************** *** 61,65 **** global _profile_hook _profile_hook = func ! def settrace(func): global _trace_hook --- 61,65 ---- global _profile_hook _profile_hook = func ! def settrace(func): global _trace_hook *************** *** 428,432 **** self._note("%s.__bootstrap(): registering profile hook", self) _sys.setprofile(_profile_hook) ! try: self.run() --- 428,432 ---- self._note("%s.__bootstrap(): registering profile hook", self) _sys.setprofile(_profile_hook) ! try: self.run() From jhylton@users.sourceforge.net Sun Jun 29 18:25:41 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 29 Jun 2003 10:25:41 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.799,1.800 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv28366/Misc Modified Files: NEWS Log Message: Add several news items for changes I made since b1. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.799 retrieving revision 1.800 diff -C2 -d -r1.799 -r1.800 *** NEWS 29 Jun 2003 17:12:30 -0000 1.799 --- NEWS 29 Jun 2003 17:25:39 -0000 1.800 *************** *** 38,41 **** --- 38,45 ---- code relying (whether intentionally or accidentally) on old behavior. + - SF bug 734869: Fixed a compiler bug that caused a fatal error when + compiling a list comprehension that contained another list comprehension + embedded in a lambda expression. + - SF bug 705231: builtin pow() no longer lets the platform C pow() raise -1.0 to integer powers, because (at least) glibc gets it wrong *************** *** 44,47 **** --- 48,55 ---- is (mathematically) an exact even integer. + - SF bug 759227: A new-style class that implements __nonzero__() must + return a bool or int (but not an int subclass) from that method. This + matches the restriction on classic classes. + - The encoding attribute has been added for file objects, and set to the terminal encoding on Unix and Windows. *************** *** 61,64 **** --- 69,76 ---- name lookups). + - SF bug 735247: The staticmethod and super types participate in + garbage collection. Before this change, it was possible for leaks to + occur in functions with non-global free variables that used these types. + Extension modules ----------------- *************** *** 67,70 **** --- 79,90 ---- timeouts to be handled separately from other socket errors. + - SF bug 751276: cPickle has fixed to propagate exceptions raised in + user code. In earlier versions, cPickle caught and ignored any + exception when it performed operations that it expected to raise + specific exceptions like AttributeError. + + - cPickle Pickler and Unpickler objects now participate in garbage + collection. + - mimetools.choose_boundary() could return duplicate strings at times, especially likely on Windows. The strings returned are now guaranteed *************** *** 89,92 **** --- 109,113 ---- for many BSD-derived systems. + Library ------- *************** *** 107,117 **** framework features (which doctest lacks). - - ZipFile.testzip() now only traps BadZipfile exceptions. Previously, - a bare except caught to much and reported all errors as a problem - in the archive. - - - The logging module now has a new function, makeLogRecord() making - LogHandler easier to interact with DatagramHandler and SocketHandler. - - For compatibility with doctests created before 2.3, if an expected output block consists solely of "1" and the actual output block --- 128,131 ---- *************** *** 122,125 **** --- 136,146 ---- argument. + - ZipFile.testzip() now only traps BadZipfile exceptions. Previously, + a bare except caught to much and reported all errors as a problem + in the archive. + + - The logging module now has a new function, makeLogRecord() making + LogHandler easier to interact with DatagramHandler and SocketHandler. + - The cgitb module has been extended to support plain text display (SF patch 569574). *************** *** 129,136 **** no more. - The threading module has new functions settrace() and setprofile() that cooperate with the functions of the same name in the sys module. A function registered with the threading module will ! be used for all threads it creates. - copy.py: applied SF patch 707900, fixing bug 702858, by Steven --- 150,164 ---- no more. + - Added a new module: trace (documentation missing). This module used + to be distributed in Tools/scripts. It uses sys.settrace() to trace + code execution -- either function calls or individual lines. It can + generate tracing output during execution or a post-mortem report of + code coverage. + - The threading module has new functions settrace() and setprofile() that cooperate with the functions of the same name in the sys module. A function registered with the threading module will ! be used for all threads it creates. The new trace module uses this ! to provide tracing for code running in threads. - copy.py: applied SF patch 707900, fixing bug 702858, by Steven From jhylton@users.sourceforge.net Sun Jun 29 18:55:08 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 29 Jun 2003 10:55:08 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.78,1.79 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv31795/Lib Modified Files: httplib.py Log Message: Fix sf bug 666219: assertion error in httplib. The obvious way for this assertion to fail is if the LineAndFileWrapper constructor is called when an empty line. Raise a BadStatusError before the call. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** httplib.py 24 Jun 2003 06:35:19 -0000 1.78 --- httplib.py 29 Jun 2003 17:55:05 -0000 1.79 *************** *** 232,235 **** --- 232,239 ---- if self.debuglevel > 0: print "reply:", repr(line) + if not line: + # Presumably, the server closed the connection before + # sending a valid response. + raise BadStatusLine(line) try: [version, status, reason] = line.split(None, 2) From fdrake@users.sourceforge.net Sun Jun 29 19:12:25 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sun, 29 Jun 2003 11:12:25 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libthreading.tex,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv1754/lib Modified Files: libthreading.tex Log Message: Fix broken markup, & tweak a couple of things for consistency. Index: libthreading.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libthreading.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** libthreading.tex 29 Jun 2003 16:58:41 -0000 1.16 --- libthreading.tex 29 Jun 2003 18:12:23 -0000 1.17 *************** *** 92,105 **** \begin{funcdesc}{settrace}{func} ! Set a trace function \index{trace function} for all threads started from the \module{threading} module. The \var{func} will be passed to ! \cfuntion{sys.settrace} for each thread, before its \method{run} method is called. \end{funcdesc} \begin{funcdesc}{setprofile}{func} ! Set a profile function \index{profile function} for all threads started from the \module{threading} module. The \var{func} will be passed to ! \cfuntion{sys.setprofile} for each thread, before its \method{run} method is called. \end{funcdesc} --- 92,105 ---- \begin{funcdesc}{settrace}{func} ! Set a trace function\index{trace function} for all threads started from the \module{threading} module. The \var{func} will be passed to ! \function{sys.settrace()} for each thread, before its \method{run()} method is called. \end{funcdesc} \begin{funcdesc}{setprofile}{func} ! Set a profile function\index{profile function} for all threads started from the \module{threading} module. The \var{func} will be passed to ! \function{sys.setprofile()} for each thread, before its \method{run()} method is called. \end{funcdesc} From jhylton@users.sourceforge.net Sun Jun 29 20:01:17 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 29 Jun 2003 12:01:17 -0700 Subject: [Python-checkins] python/nondist/peps pep-0283.txt,1.36,1.37 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv8541/nondist/peps Modified Files: pep-0283.txt Log Message: A few updates to the schedule and plans. Index: pep-0283.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0283.txt,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** pep-0283.txt 25 Apr 2003 20:13:53 -0000 1.36 --- pep-0283.txt 29 Jun 2003 19:01:15 -0000 1.37 *************** *** 23,35 **** least one week apart (excepting again blunder corrections). ! Here's a tentative release schedule that follows the above ! guidelines: alpha 1 -- December 31, 2002 alpha 2 -- February 19, 2003 beta 1 -- April 25, 2003 ! beta 2 -- late May ! rc 1 -- late June ! final -- early July --- 23,37 ---- least one week apart (excepting again blunder corrections). ! The schedule so far has had longer gaps than planned: alpha 1 -- December 31, 2002 alpha 2 -- February 19, 2003 beta 1 -- April 25, 2003 ! beta 2 -- June 29, 2003 ! ! Here's a tenative schedule for the remaining releases: ! ! rc 1 -- late July ! final -- early August *************** *** 152,155 **** --- 154,161 ---- Heller did this work.) + - A new version of IDLE was imported from the IDLEfork project + (http://idlefork.sf.net). The code now lives in the idlelib + package in the standard library and the idle script is installed + by setup.py. Planned features for 2.3 *************** *** 163,169 **** feedback to python-dev@python.org; I hope to maintain this for the life of the 2.3 development process. - - - I plan to integrate the new version of IDLE from the IDLEfork - project (http://idlefork.sf.net). - The import lock could use some redesign. (SF 683658.) --- 169,172 ---- From fdrake@users.sourceforge.net Sun Jun 29 20:03:59 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sun, 29 Jun 2003 12:03:59 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libthreading.tex,1.16,1.16.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv8839/lib Modified Files: Tag: r23b2-branch libthreading.tex Log Message: Merge from trunk: Fix broken markup, & tweak a couple of things for consistency. Index: libthreading.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libthreading.tex,v retrieving revision 1.16 retrieving revision 1.16.2.1 diff -C2 -d -r1.16 -r1.16.2.1 *** libthreading.tex 29 Jun 2003 16:58:41 -0000 1.16 --- libthreading.tex 29 Jun 2003 19:03:57 -0000 1.16.2.1 *************** *** 92,105 **** \begin{funcdesc}{settrace}{func} ! Set a trace function \index{trace function} for all threads started from the \module{threading} module. The \var{func} will be passed to ! \cfuntion{sys.settrace} for each thread, before its \method{run} method is called. \end{funcdesc} \begin{funcdesc}{setprofile}{func} ! Set a profile function \index{profile function} for all threads started from the \module{threading} module. The \var{func} will be passed to ! \cfuntion{sys.setprofile} for each thread, before its \method{run} method is called. \end{funcdesc} --- 92,105 ---- \begin{funcdesc}{settrace}{func} ! Set a trace function\index{trace function} for all threads started from the \module{threading} module. The \var{func} will be passed to ! \function{sys.settrace()} for each thread, before its \method{run()} method is called. \end{funcdesc} \begin{funcdesc}{setprofile}{func} ! Set a profile function\index{profile function} for all threads started from the \module{threading} module. The \var{func} will be passed to ! \function{sys.setprofile()} for each thread, before its \method{run()} method is called. \end{funcdesc} From rhettinger@users.sourceforge.net Sun Jun 29 21:36:25 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 29 Jun 2003 13:36:25 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_itertools.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv26692 Modified Files: test_itertools.py Log Message: More tests * Test with infinite inputs (using take() on the output) * Test whether GC can find and eliminate cycles. Index: test_itertools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_itertools.py 28 Jun 2003 05:44:36 -0000 1.14 --- test_itertools.py 29 Jun 2003 20:36:23 -0000 1.15 *************** *** 33,36 **** --- 33,39 ---- raise StopIteration + def take(n, seq): + 'Convenience function for partially consuming a long of infinite iterable' + return list(islice(seq, n)) class TestBasicOps(unittest.TestCase): *************** *** 39,42 **** --- 42,46 ---- self.assertEqual(list(chain('abc')), list('abc')) self.assertEqual(list(chain('')), []) + self.assertEqual(take(4, chain('abc', 'def')), list('abcd')) self.assertRaises(TypeError, chain, 2, 3) *************** *** 44,47 **** --- 48,52 ---- self.assertEqual(zip('abc',count()), [('a', 0), ('b', 1), ('c', 2)]) self.assertEqual(zip('abc',count(3)), [('a', 3), ('b', 4), ('c', 5)]) + self.assertEqual(take(2, zip('abc',count(3))), [('a', 3), ('b', 4)]) self.assertRaises(TypeError, count, 2, 3) self.assertRaises(TypeError, count, 'a') *************** *** 50,54 **** def test_cycle(self): ! self.assertEqual(list(islice(cycle('abc'),10)), list('abcabcabca')) self.assertEqual(list(cycle('')), []) self.assertRaises(TypeError, cycle) --- 55,59 ---- def test_cycle(self): ! self.assertEqual(take(10, cycle('abc')), list('abcabcabca')) self.assertEqual(list(cycle('')), []) self.assertRaises(TypeError, cycle) *************** *** 59,62 **** --- 64,68 ---- self.assertEqual(list(ifilter(isEven, range(6))), [0,2,4]) self.assertEqual(list(ifilter(None, [0,1,0,2,0])), [1,2]) + self.assertEqual(take(4, ifilter(isEven, count())), [0,2,4,6]) self.assertRaises(TypeError, ifilter) self.assertRaises(TypeError, ifilter, lambda x:x) *************** *** 68,71 **** --- 74,78 ---- self.assertEqual(list(ifilterfalse(isEven, range(6))), [1,3,5]) self.assertEqual(list(ifilterfalse(None, [0,1,0,2,0])), [0,0,0]) + self.assertEqual(take(4, ifilterfalse(isEven, count())), [1,3,5,7]) self.assertRaises(TypeError, ifilterfalse) self.assertRaises(TypeError, ifilterfalse, lambda x:x) *************** *** 79,82 **** --- 86,90 ---- self.assertEqual(list(izip('abc', range(6))), zip('abc', range(6))) self.assertEqual(list(izip('abcdef', range(3))), zip('abcdef', range(3))) + self.assertEqual(take(3,izip('abcdef', count())), zip('abcdef', range(3))) self.assertEqual(list(izip('abcdef')), zip('abcdef')) self.assertRaises(TypeError, izip) *************** *** 97,100 **** --- 105,109 ---- [(0, 'a'), (1, 'a'), (2, 'a')]) self.assertEqual(list(repeat('a', 3)), ['a', 'a', 'a']) + self.assertEqual(take(3, repeat('a')), ['a', 'a', 'a']) self.assertEqual(list(repeat('a', 0)), []) self.assertEqual(list(repeat('a', -3)), []) *************** *** 108,111 **** --- 117,124 ---- self.assertEqual(list(imap(None, 'abc', range(5))), [('a',0),('b',1),('c',2)]) + self.assertEqual(list(imap(None, 'abc', count())), + [('a',0),('b',1),('c',2)]) + self.assertEqual(take(2,imap(None, 'abc', count())), + [('a',0),('b',1)]) self.assertEqual(list(imap(operator.pow, [])), []) self.assertRaises(TypeError, imap) *************** *** 118,121 **** --- 131,136 ---- self.assertEqual(list(starmap(operator.pow, zip(range(3), range(1,7)))), [0**1, 1**2, 2**3]) + self.assertEqual(take(3, starmap(operator.pow, izip(count(), count(1)))), + [0**1, 1**2, 2**3]) self.assertEqual(list(starmap(operator.pow, [])), []) self.assertRaises(TypeError, list, starmap(operator.pow, [[4,5]])) *************** *** 274,277 **** --- 289,331 ---- return chain(imap(lambda x:x, R(Ig(G(seqn))))) + class TestGC(unittest.TestCase): + + def makecycle(self, iterator, container): + container.append(iterator) + iterator.next() + del container, iterator + + def test_chain(self): + a = [] + self.makecycle(chain(a), a) + + def test_cycle(self): + a = [] + self.makecycle(cycle([a]*2), a) + + def test_ifilter(self): + a = [] + self.makecycle(ifilter(lambda x:True, [a]*2), a) + + def test_ifilterfalse(self): + a = [] + self.makecycle(ifilterfalse(lambda x:False, a), a) + + def test_izip(self): + a = [] + self.makecycle(izip([a]*2, [a]*3), a) + + def test_imap(self): + a = [] + self.makecycle(imap(lambda x:x, [a]*2), a) + + def test_islice(self): + a = [] + self.makecycle(islice([a]*2, None), a) + + def test_starmap(self): + a = [] + self.makecycle(starmap(lambda *t: t, [(a,a)]*2), a) + class TestVariousIteratorArgs(unittest.TestCase): *************** *** 421,425 **** >>> def some(pred, seq): ! ... "Returns True if pred(x) is True at least one element in the iterable" ... return bool(nth(ifilter(pred, seq), 0)) --- 475,479 ---- >>> def some(pred, seq): ! ... "Returns True if pred(x) is True for at least one element in the iterable" ... return bool(nth(ifilter(pred, seq), 0)) *************** *** 506,517 **** def test_main(verbose=None): ! test_classes = (TestBasicOps, TestVariousIteratorArgs) test_support.run_unittest(*test_classes) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): counts = [None] * 5 for i in xrange(len(counts)): test_support.run_unittest(*test_classes) counts[i] = sys.gettotalrefcount() print counts --- 560,573 ---- def test_main(verbose=None): ! test_classes = (TestBasicOps, TestVariousIteratorArgs, TestGC) test_support.run_unittest(*test_classes) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): + import gc counts = [None] * 5 for i in xrange(len(counts)): test_support.run_unittest(*test_classes) + gc.collect() counts[i] = sys.gettotalrefcount() print counts From bwarsaw@users.sourceforge.net Sun Jun 29 22:02:15 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun, 29 Jun 2003 14:02:15 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.800,1.800.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv845 Modified Files: Tag: r23b2-branch NEWS Log Message: All the news that's fit to print Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.800 retrieving revision 1.800.2.1 diff -C2 -d -r1.800 -r1.800.2.1 *** NEWS 29 Jun 2003 17:25:39 -0000 1.800 --- NEWS 29 Jun 2003 21:02:13 -0000 1.800.2.1 *************** *** 190,193 **** --- 190,197 ---- opener with proxy support. + - Iterators have been added for dbm keys. + + - random.Random objects can now be pickled. + Tools/Demos ----------- *************** *** 223,226 **** --- 227,236 ---- is gc'able, tp_free must not be NULL or _PyObject_Del. + - PyThreadState_SetAsyncExc(): A new API (deliberately accessible only + from C) to interrupt a thread by sending it an exception. It is + intentional that you have to write your own C extension to call it + from Python. + + New platforms ------------- *************** *** 260,263 **** --- 270,301 ---- - The Package Manager can now update itself. + SourceForge Bugs and Patches Applied + ------------------------------------ + + 430160, 471893, 501716, 542562, 549151, 569574, 595837, 596434, + 598163, 604210, 604716, 610332, 612627, 614770, 620190, 621891, + 622042, 639139, 640236, 644345, 649742, 649742, 658233, 660022, + 661318, 661676, 662807, 662923, 666219, 672855, 678325, 682347, + 683486, 684981, 685773, 686254, 692776, 692959, 693094, 696777, + 697989, 700827, 703666, 708495, 708604, 708901, 710733, 711902, + 713722, 715782, 718286, 719359, 719367, 723136, 723831, 723962, + 724588, 724767, 724767, 725942, 726150, 726446, 726869, 727051, + 727719, 727719, 727805, 728277, 728563, 728656, 729096, 729103, + 729293, 729297, 729300, 729317, 729395, 729622, 729817, 730170, + 730296, 730594, 730685, 730826, 730963, 731209, 731403, 731504, + 731514, 731626, 731635, 731643, 731644, 731644, 731689, 732124, + 732143, 732234, 732284, 732284, 732479, 732761, 732783, 732951, + 733667, 733781, 734118, 734231, 734869, 735051, 735293, 735527, + 735613, 735694, 736962, 736962, 737970, 738066, 739313, 740055, + 740234, 740301, 741806, 742126, 742741, 742860, 742860, 742911, + 744041, 744104, 744238, 744687, 744877, 745055, 745478, 745525, + 745620, 746012, 746304, 746366, 746801, 746953, 747348, 747667, + 747954, 748846, 748849, 748973, 748975, 749191, 749210, 749759, + 749831, 749911, 750008, 750092, 750542, 750595, 751038, 751107, + 751276, 751451, 751916, 751941, 751956, 751998, 752671, 753451, + 753602, 753617, 753845, 753925, 754014, 754340, 754447, 755031, + 755087, 755147, 755245, 755683, 755987, 756032, 756996, 757058, + 757229, 757818, 757821, 757822, 758112, 758910, 759227, 759889, + 760257, 760703, 760792, 761104, 761337, 761519, 761830, 762455 What's New in Python 2.3 beta 1? ================================ From bwarsaw@users.sourceforge.net Sun Jun 29 22:06:27 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun, 29 Jun 2003 14:06:27 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.800.2.1,1.800.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv1380 Modified Files: Tag: r23b2-branch NEWS Log Message: clarity Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.800.2.1 retrieving revision 1.800.2.2 diff -C2 -d -r1.800.2.1 -r1.800.2.2 *** NEWS 29 Jun 2003 21:02:13 -0000 1.800.2.1 --- NEWS 29 Jun 2003 21:06:21 -0000 1.800.2.2 *************** *** 298,301 **** --- 298,303 ---- 757229, 757818, 757821, 757822, 758112, 758910, 759227, 759889, 760257, 760703, 760792, 761104, 761337, 761519, 761830, 762455 + + What's New in Python 2.3 beta 1? ================================ From bwarsaw@users.sourceforge.net Sun Jun 29 22:12:22 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun, 29 Jun 2003 14:12:22 -0700 Subject: [Python-checkins] python/dist/src README,1.174,1.174.2.1 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv2201 Modified Files: Tag: r23b2-branch README Log Message: Update version number Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.174 retrieving revision 1.174.2.1 diff -C2 -d -r1.174 -r1.174.2.1 *** README 14 Jun 2003 05:29:27 -0000 1.174 --- README 29 Jun 2003 21:12:15 -0000 1.174.2.1 *************** *** 1,3 **** ! This is Python version 2.3 beta 1 ================================= --- 1,3 ---- ! This is Python version 2.3 beta 2 ================================= From jvr@users.sourceforge.net Sun Jun 29 22:54:14 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Sun, 29 Jun 2003 14:54:14 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac bundlebuilder.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv7851 Modified Files: bundlebuilder.py Log Message: - added --semi-standalone option that builds apps that depend on an installed Python, yet include any modules not in the std lib - reworked extension module inclusion code: put all .so files in a subdirectory of Contents/Resources/, but more importantly, correctly support extensions that are submodules. Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/bundlebuilder.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** bundlebuilder.py 20 Jun 2003 21:43:36 -0000 1.31 --- bundlebuilder.py 29 Jun 2003 21:54:12 -0000 1.32 *************** *** 218,222 **** SITE_PY = """\ import sys ! del sys.path[1:] # sys.path[0] is Contents/Resources/ """ --- 218,223 ---- SITE_PY = """\ import sys ! if not %(semi_standalone)s: ! del sys.path[1:] # sys.path[0] is Contents/Resources/ """ *************** *** 230,235 **** return path, MAGIC + '\0\0\0\0' + marshal.dumps(code) - SITE_CO = compile(SITE_PY, "<-bundlebuilder.py->", "exec") - # # Extension modules can't be in the modules zip archive, so a placeholder --- 231,234 ---- *************** *** 313,316 **** --- 312,319 ---- + LIB = os.path.join(sys.prefix, "lib", "python" + sys.version[:3]) + SITE_PACKAGES = os.path.join(LIB, "site-packages") + + class AppBuilder(BundleBuilder): *************** *** 346,349 **** --- 349,355 ---- standalone = 0 + # If True, build semi-standalone app (only includes third-party modules). + semi_standalone = 0 + # If set, use this for #! lines in stead of sys.executable python = None *************** *** 375,379 **** def setup(self): ! if self.standalone and self.mainprogram is None: raise BundleBuilderError, ("must specify 'mainprogram' when " "building a standalone application.") --- 381,386 ---- def setup(self): ! if ((self.standalone or self.semi_standalone) ! and self.mainprogram is None): raise BundleBuilderError, ("must specify 'mainprogram' when " "building a standalone application.") *************** *** 410,414 **** self.plist.CFBundleExecutable = self.name ! if self.standalone: self.findDependencies() --- 417,421 ---- self.plist.CFBundleExecutable = self.name ! if self.standalone or self.semi_standalone: self.findDependencies() *************** *** 439,443 **** makedirs(resdirpath) open(mainprogrampath, "w").write(ARGV_EMULATOR % locals()) ! if self.standalone: self.includeModules.append("argvemulator") self.includeModules.append("os") --- 446,450 ---- makedirs(resdirpath) open(mainprogrampath, "w").write(ARGV_EMULATOR % locals()) ! if self.standalone or self.semi_standalone: self.includeModules.append("argvemulator") self.includeModules.append("os") *************** *** 454,458 **** bootstrappath = pathjoin(execdir, self.name) makedirs(execdir) ! if self.standalone: # XXX we're screwed when the end user has deleted # /usr/bin/python --- 461,465 ---- bootstrappath = pathjoin(execdir, self.name) makedirs(execdir) ! if self.standalone or self.semi_standalone: # XXX we're screwed when the end user has deleted # /usr/bin/python *************** *** 472,476 **** def postProcess(self): ! if self.standalone: self.addPythonModules() if self.strip and not self.symlink: --- 479,483 ---- def postProcess(self): ! if self.standalone or self.semi_standalone: self.addPythonModules() if self.strip and not self.symlink: *************** *** 508,511 **** --- 515,522 ---- self.files.append((src, dst)) + def _getSiteCode(self): + return compile(SITE_PY % {"semi_standalone": self.semi_standalone}, + "<-bundlebuilder.py->", "exec") + def addPythonModules(self): self.message("Adding Python modules", 1) *************** *** 525,529 **** sitepath = pathjoin(self.bundlepath, "Contents", "Resources", "site" + PYC_EXT) ! writePyc(SITE_CO, sitepath) else: # Create individual .pyc files. --- 536,540 ---- sitepath = pathjoin(self.bundlepath, "Contents", "Resources", "site" + PYC_EXT) ! writePyc(self._getSiteCode(), sitepath) else: # Create individual .pyc files. *************** *** 582,587 **** # manually add our own site.py site = mf.add_module("site") ! site.__code__ = SITE_CO ! mf.scan_code(SITE_CO, site) # warnings.py gets imported implicitly from C --- 593,598 ---- # manually add our own site.py site = mf.add_module("site") ! site.__code__ = self._getSiteCode() ! mf.scan_code(site.__code__, site) # warnings.py gets imported implicitly from C *************** *** 601,621 **** modules.sort() for name, mod in modules: ! if mod.__file__ and mod.__code__ is None: # C extension - path = mod.__file__ filename = os.path.basename(path) if USE_ZIPIMPORT: # Python modules are stored in a Zip archive, but put ! # extensions in Contents/Resources/.a and add a tiny "loader" # program in the Zip archive. Due to Thomas Heller. ! dstpath = pathjoin("Contents", "Resources", filename) ! source = EXT_LOADER % {"name": name, "filename": filename} code = compile(source, "" % name, "exec") mod.__code__ = code ! else: ! # just copy the file ! dstpath = name.split(".")[:-1] + [filename] ! dstpath = pathjoin("Contents", "Resources", *dstpath) ! self.files.append((path, dstpath)) if mod.__code__ is not None: ispkg = mod.__path__ is not None --- 612,640 ---- modules.sort() for name, mod in modules: ! path = mod.__file__ ! if path and self.semi_standalone: ! # skip the standard library ! if path.startswith(LIB) and not path.startswith(SITE_PACKAGES): ! continue ! if path and mod.__code__ is None: # C extension filename = os.path.basename(path) + dstpath = name.split(".")[:-1] + [filename] + if name != "zlib": + # put all extension module in a separate folder + # inside Contents/Resources/ + dstpath = pathjoin("ExtensionModules", *dstpath) + else: + # zlib is neccesary for bootstrapping, so don't + # hide it in "ExtensionModules" + dstpath = pathjoin(*dstpath) if USE_ZIPIMPORT: # Python modules are stored in a Zip archive, but put ! # extensions in Contents/Resources/. Add a tiny "loader" # program in the Zip archive. Due to Thomas Heller. ! source = EXT_LOADER % {"name": name, "filename": dstpath} code = compile(source, "" % name, "exec") mod.__code__ = code ! self.files.append((path, pathjoin("Contents", "Resources", dstpath))) if mod.__code__ is not None: ispkg = mod.__path__ is not None *************** *** 661,665 **** import pprint pprint.pprint(self.__dict__) ! if self.standalone: self.reportMissing() --- 680,684 ---- import pprint pprint.pprint(self.__dict__) ! if self.standalone or self.semi_standalone: self.reportMissing() *************** *** 762,771 **** --standalone build a standalone application, which is fully independent of a Python installation --python=FILE Python to use in #! line in stead of current Python --lib=FILE shared library or framework to be copied into the bundle ! -x, --exclude=MODULE exclude module (with --standalone) ! -i, --include=MODULE include module (with --standalone) ! --package=PACKAGE include a whole package (with --standalone) --strip strip binaries (remove debug info) -v, --verbose increase verbosity level --- 781,793 ---- --standalone build a standalone application, which is fully independent of a Python installation + --semi-standalone build a standalone application, which depends on + an installed Python, yet includes all third-party + modules. --python=FILE Python to use in #! line in stead of current Python --lib=FILE shared library or framework to be copied into the bundle ! -x, --exclude=MODULE exclude module (with --(semi-)standalone) ! -i, --include=MODULE include module (with --(semi-)standalone) ! --package=PACKAGE include a whole package (with --(semi-)standalone) --strip strip binaries (remove debug info) -v, --verbose increase verbosity level *************** *** 789,793 **** "link-exec", "help", "verbose", "quiet", "argv", "standalone", "exclude=", "include=", "package=", "strip", "iconfile=", ! "lib=", "python=") try: --- 811,815 ---- "link-exec", "help", "verbose", "quiet", "argv", "standalone", "exclude=", "include=", "package=", "strip", "iconfile=", ! "lib=", "python=", "semi-standalone") try: *************** *** 837,840 **** --- 859,864 ---- elif opt == '--standalone': builder.standalone = 1 + elif opt == '--semi-standalone': + builder.semi_standalone = 1 elif opt == '--python': builder.python = arg From jvr@users.sourceforge.net Sun Jun 29 23:20:29 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Sun, 29 Jun 2003 15:20:29 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac bundlebuilder.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv11328 Modified Files: bundlebuilder.py Log Message: restore 2.2 compatibility: - don't use "abc" in aString - don't reorganize extension modules when not using zipimport Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/bundlebuilder.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** bundlebuilder.py 29 Jun 2003 21:54:12 -0000 1.32 --- bundlebuilder.py 29 Jun 2003 22:20:26 -0000 1.33 *************** *** 311,314 **** --- 311,317 ---- ] + def isFramework(): + return sys.exec_prefix.find("Python.framework") > 0 + LIB = os.path.join(sys.prefix, "lib", "python" + sys.version[:3]) *************** *** 401,405 **** if self.executable is None: ! if not self.standalone: self.symlink_exec = 1 self.executable = sys.executable --- 404,408 ---- if self.executable is None: ! if not self.standalone and not isFramework(): self.symlink_exec = 1 self.executable = sys.executable *************** *** 410,414 **** self.plist.NSPrincipalClass = "NSApplication" ! if self.standalone and "Python.framework" in sys.exec_prefix: self.addPythonFramework() --- 413,417 ---- self.plist.NSPrincipalClass = "NSApplication" ! if self.standalone and isFramework(): self.addPythonFramework() *************** *** 620,633 **** # C extension filename = os.path.basename(path) ! dstpath = name.split(".")[:-1] + [filename] ! if name != "zlib": ! # put all extension module in a separate folder ! # inside Contents/Resources/ ! dstpath = pathjoin("ExtensionModules", *dstpath) ! else: ! # zlib is neccesary for bootstrapping, so don't ! # hide it in "ExtensionModules" ! dstpath = pathjoin(*dstpath) if USE_ZIPIMPORT: # Python modules are stored in a Zip archive, but put # extensions in Contents/Resources/. Add a tiny "loader" --- 623,633 ---- # C extension filename = os.path.basename(path) ! pathitems = name.split(".")[:-1] + [filename] ! dstpath = pathjoin(*pathitems) if USE_ZIPIMPORT: + if name != "zlib": + # neatly pack all extension modules in a subdirectory, + # except zlib, since it's neccesary for bootstrapping. + dstpath = pathjoin("ExtensionModules", dstpath) # Python modules are stored in a Zip archive, but put # extensions in Contents/Resources/. Add a tiny "loader" From nnorwitz@users.sourceforge.net Mon Jun 30 02:54:06 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 29 Jun 2003 18:54:06 -0700 Subject: [Python-checkins] python/dist/src/Modules fcntlmodule.c,2.40,2.41 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv3552/Modules Modified Files: fcntlmodule.c Log Message: Fix typo, refer to proper argument name Index: fcntlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/fcntlmodule.c,v retrieving revision 2.40 retrieving revision 2.41 diff -C2 -d -r2.40 -r2.41 *** fcntlmodule.c 9 May 2003 10:45:20 -0000 2.40 --- fcntlmodule.c 30 Jun 2003 01:54:04 -0000 2.41 *************** *** 200,204 **** \n\ Perform the requested operation on file descriptor fd. The operation is\n\ ! defined by op and is operating system dependent. Typically these codes are\n\ retrieved from the fcntl or termios library modules.\n\ \n\ --- 200,204 ---- \n\ Perform the requested operation on file descriptor fd. The operation is\n\ ! defined by opt and is operating system dependent. Typically these codes are\n\ retrieved from the fcntl or termios library modules.\n\ \n\ From tim_one@users.sourceforge.net Mon Jun 30 03:14:30 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 29 Jun 2003 19:14:30 -0700 Subject: [Python-checkins] python/dist/src/Include patchlevel.h,2.68,2.69 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv5274/Include Modified Files: patchlevel.h Log Message: Bump version string to "2.3b2+". Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.68 retrieving revision 2.69 diff -C2 -d -r2.68 -r2.69 *** patchlevel.h 29 Jun 2003 00:57:17 -0000 2.68 --- patchlevel.h 30 Jun 2003 02:14:28 -0000 2.69 *************** *** 27,31 **** /* Version as a string */ ! #define PY_VERSION "2.3b2" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 27,31 ---- /* Version as a string */ ! #define PY_VERSION "2.3b2+" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From nnorwitz@users.sourceforge.net Mon Jun 30 04:25:22 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 29 Jun 2003 20:25:22 -0700 Subject: [Python-checkins] python/dist/src/Modules _ssl.c,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv13018/Modules Modified Files: _ssl.c Log Message: Fix SF #754870, SSL crash interpreter when remote side closes during connect Also fix a memory leak. Index: _ssl.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_ssl.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** _ssl.c 28 Jun 2003 07:40:23 -0000 1.12 --- _ssl.c 30 Jun 2003 03:25:19 -0000 1.13 *************** *** 111,115 **** unsigned long e = ERR_get_error(); if (e == 0) { ! if (ret == 0) { p = PY_SSL_ERROR_EOF; errstr = "EOF occurred in violation of protocol"; --- 111,115 ---- unsigned long e = ERR_get_error(); if (e == 0) { ! if (ret == 0 || !obj->Socket) { p = PY_SSL_ERROR_EOF; errstr = "EOF occurred in violation of protocol"; *************** *** 433,436 **** --- 433,437 ---- if (timedout) { PyErr_SetString(PySSLErrorObject, "The read operation timed out"); + Py_DECREF(buf); return NULL; } From nnorwitz@users.sourceforge.net Mon Jun 30 04:25:22 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun, 29 Jun 2003 20:25:22 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_socket_ssl.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv13018/Lib/test Modified Files: test_socket_ssl.py Log Message: Fix SF #754870, SSL crash interpreter when remote side closes during connect Also fix a memory leak. Index: test_socket_ssl.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket_ssl.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_socket_ssl.py 4 Dec 2002 03:26:57 -0000 1.6 --- test_socket_ssl.py 30 Jun 2003 03:25:20 -0000 1.7 *************** *** 3,6 **** --- 3,7 ---- from test import test_support import socket + import time # Optionally test SSL support. This requires the 'network' resource as given *************** *** 9,13 **** hasattr(socket, "ssl")) ! def test_main(): test_support.requires('network') if not hasattr(socket, "ssl"): --- 10,14 ---- hasattr(socket, "ssl")) ! def test_basic(): test_support.requires('network') if not hasattr(socket, "ssl"): *************** *** 28,31 **** --- 29,67 ---- buf = f.read() f.close() + + def test_rude_shutdown(): + try: + import thread + except ImportError: + return + + # some random port to connect to + PORT = 9934 + def listener(): + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.bind(('', PORT)) + s.listen(5) + s.accept() + del s + thread.exit() + + def connector(): + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.connect(('', PORT)) + try: + ssl_sock = socket.ssl(s) + except socket.sslerror: + pass + else: + raise test_support.TestFailed, \ + 'connecting to closed SSL socket failed' + + thread.start_new_thread(listener, ()) + time.sleep(1) + connector() + + def test_main(): + test_rude_shutdown() + test_basic() if __name__ == "__main__": From rhettinger@users.sourceforge.net Mon Jun 30 04:35:09 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 29 Jun 2003 20:35:09 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.800,1.801 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv14259 Modified Files: NEWS Log Message: Merge branch updates back into the main trunk Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.800 retrieving revision 1.801 diff -C2 -d -r1.800 -r1.801 *** NEWS 29 Jun 2003 17:25:39 -0000 1.800 --- NEWS 30 Jun 2003 03:35:06 -0000 1.801 *************** *** 190,193 **** --- 190,197 ---- opener with proxy support. + - Iterators have been added for dbm keys. + + - random.Random objects can now be pickled. + Tools/Demos ----------- *************** *** 223,226 **** --- 227,236 ---- is gc'able, tp_free must not be NULL or _PyObject_Del. + - PyThreadState_SetAsyncExc(): A new API (deliberately accessible only + from C) to interrupt a thread by sending it an exception. It is + intentional that you have to write your own C extension to call it + from Python. + + New platforms ------------- *************** *** 259,262 **** --- 269,302 ---- toplevel application class (in AppleScript terminology). - The Package Manager can now update itself. + + SourceForge Bugs and Patches Applied + ------------------------------------ + + 430160, 471893, 501716, 542562, 549151, 569574, 595837, 596434, + 598163, 604210, 604716, 610332, 612627, 614770, 620190, 621891, + 622042, 639139, 640236, 644345, 649742, 649742, 658233, 660022, + 661318, 661676, 662807, 662923, 666219, 672855, 678325, 682347, + 683486, 684981, 685773, 686254, 692776, 692959, 693094, 696777, + 697989, 700827, 703666, 708495, 708604, 708901, 710733, 711902, + 713722, 715782, 718286, 719359, 719367, 723136, 723831, 723962, + 724588, 724767, 724767, 725942, 726150, 726446, 726869, 727051, + 727719, 727719, 727805, 728277, 728563, 728656, 729096, 729103, + 729293, 729297, 729300, 729317, 729395, 729622, 729817, 730170, + 730296, 730594, 730685, 730826, 730963, 731209, 731403, 731504, + 731514, 731626, 731635, 731643, 731644, 731644, 731689, 732124, + 732143, 732234, 732284, 732284, 732479, 732761, 732783, 732951, + 733667, 733781, 734118, 734231, 734869, 735051, 735293, 735527, + 735613, 735694, 736962, 736962, 737970, 738066, 739313, 740055, + 740234, 740301, 741806, 742126, 742741, 742860, 742860, 742911, + 744041, 744104, 744238, 744687, 744877, 745055, 745478, 745525, + 745620, 746012, 746304, 746366, 746801, 746953, 747348, 747667, + 747954, 748846, 748849, 748973, 748975, 749191, 749210, 749759, + 749831, 749911, 750008, 750092, 750542, 750595, 751038, 751107, + 751276, 751451, 751916, 751941, 751956, 751998, 752671, 753451, + 753602, 753617, 753845, 753925, 754014, 754340, 754447, 755031, + 755087, 755147, 755245, 755683, 755987, 756032, 756996, 757058, + 757229, 757818, 757821, 757822, 758112, 758910, 759227, 759889, + 760257, 760703, 760792, 761104, 761337, 761519, 761830, 762455 + What's New in Python 2.3 beta 1? From rhettinger@users.sourceforge.net Mon Jun 30 05:18:50 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 29 Jun 2003 21:18:50 -0700 Subject: [Python-checkins] python/dist/src/Objects weakrefobject.c,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv19251/Objects Modified Files: weakrefobject.c Log Message: Fix SF 762891: "del p[key]" on proxy object raises SystemError() Index: weakrefobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/weakrefobject.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** weakrefobject.c 16 Apr 2003 21:13:23 -0000 1.11 --- weakrefobject.c 30 Jun 2003 04:18:48 -0000 1.12 *************** *** 390,394 **** if (!proxy_checkref(proxy)) return -1; ! return PyObject_SetItem(PyWeakref_GET_OBJECT(proxy), key, value); } --- 390,398 ---- if (!proxy_checkref(proxy)) return -1; ! ! if (value == NULL) ! return PyObject_DelItem(PyWeakref_GET_OBJECT(proxy), key); ! else ! return PyObject_SetItem(PyWeakref_GET_OBJECT(proxy), key, value); } From rhettinger@users.sourceforge.net Mon Jun 30 05:18:50 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 29 Jun 2003 21:18:50 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_weakref.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv19251/Lib/test Modified Files: test_weakref.py Log Message: Fix SF 762891: "del p[key]" on proxy object raises SystemError() Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** test_weakref.py 25 May 2003 17:44:31 -0000 1.26 --- test_weakref.py 30 Jun 2003 04:18:48 -0000 1.27 *************** *** 227,230 **** --- 227,241 ---- "object does not reflect attribute removal via proxy") + def test_proxy_deletion(self): + # Test clearing of SF bug #762891 + class Foo: + result = None + def __delitem__(self, accessor): + self.result = accessor + g = Foo() + f = weakref.proxy(g) + del f[0] + self.assertEqual(f.result, 0) + def test_getweakrefcount(self): o = C() From rhettinger@users.sourceforge.net Mon Jun 30 05:18:50 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 29 Jun 2003 21:18:50 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.801,1.802 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv19251/Misc Modified Files: NEWS Log Message: Fix SF 762891: "del p[key]" on proxy object raises SystemError() Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.801 retrieving revision 1.802 diff -C2 -d -r1.801 -r1.802 *** NEWS 30 Jun 2003 03:35:06 -0000 1.801 --- NEWS 30 Jun 2003 04:18:47 -0000 1.802 *************** *** 5,8 **** --- 5,41 ---- (editors: check NEWS.help for information about editing NEWS using ReST.) + What's New in Python 2.3 release candidate? + =========================================== + + Core and builtins + ----------------- + + Extension modules + ----------------- + + - weakref.proxy() can now handle "del obj[i]" for proxy objects + defining __delitem__. Formerly, it generated a SystemError. + + - SSL no longer crashes the interpreter when the remote side disconnects. + + Library + ------- + + Tools/Demos + ----------- + + Build + ----- + + C API + ----- + + Windows + ------- + + Mac + --- + + What's New in Python 2.3 beta 2? ================================ From rhettinger@users.sourceforge.net Mon Jun 30 05:27:33 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 29 Jun 2003 21:27:33 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.190,1.191 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv20115 Modified Files: tut.tex Log Message: SF bug #762990: Awful Grammar in Python Tutorial Fixed a nit. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.190 retrieving revision 1.191 diff -C2 -d -r1.190 -r1.191 *** tut.tex 29 Jun 2003 16:01:51 -0000 1.190 --- tut.tex 30 Jun 2003 04:27:31 -0000 1.191 *************** *** 3539,3543 **** a pointer is passed by the implementation; and if a function modifies an object passed as an argument, the caller will see the change --- this ! obviates the need for two different argument passing mechanisms as in Pascal. --- 3539,3543 ---- a pointer is passed by the implementation; and if a function modifies an object passed as an argument, the caller will see the change --- this ! eliminates the need for two different argument passing mechanisms as in Pascal. From doerwalter@users.sourceforge.net Mon Jun 30 12:57:54 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon, 30 Jun 2003 04:57:54 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_winsound.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv10956/Lib/test Modified Files: test_winsound.py Log Message: Don't require that a RuntimeError is raised when playing a second sound while the first one is still running, as the first one one might already have finished. Fixes part of SF bug #763052. Index: test_winsound.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_winsound.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_winsound.py 18 May 2003 00:47:46 -0000 1.5 --- test_winsound.py 30 Jun 2003 11:57:52 -0000 1.6 *************** *** 89,97 **** ) time.sleep(0.5) ! self.assertRaises( ! RuntimeError, ! winsound.PlaySound, ! 'SystemQuestion', winsound.SND_ALIAS | winsound.SND_NOSTOP ! ) winsound.PlaySound(None, winsound.SND_PURGE) --- 89,101 ---- ) time.sleep(0.5) ! try: ! winsound.PlaySound( ! 'SystemQuestion', ! winsound.SND_ALIAS | winsound.SND_NOSTOP ! ) ! except RuntimeError: ! pass ! else: # the first sound might already be finished ! pass winsound.PlaySound(None, winsound.SND_PURGE) From fdrake@users.sourceforge.net Mon Jun 30 13:18:54 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 30 Jun 2003 05:18:54 -0700 Subject: [Python-checkins] python/dist/src/Doc ACKS,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv13848 Modified Files: ACKS Log Message: Added missing name (textwrap.dedent() docs). Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ACKS,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** ACKS 3 Dec 2002 18:49:16 -0000 1.38 --- ACKS 30 Jun 2003 12:18:52 -0000 1.39 *************** *** 176,179 **** --- 176,180 ---- Kalle Svensson Jim Tittsler + Ville Vainio Martijn Vries Charles G. Waldman From fdrake@users.sourceforge.net Mon Jun 30 14:38:41 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 30 Jun 2003 06:38:41 -0700 Subject: [Python-checkins] python/dist/src/Doc/texinputs boilerplate.tex,1.80,1.81 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory sc8-pr-cvs1:/tmp/cvs-serv27865/texinputs Modified Files: boilerplate.tex Log Message: We are now post-beta 2. Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/boilerplate.tex,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** boilerplate.tex 29 Jun 2003 02:17:28 -0000 1.80 --- boilerplate.tex 30 Jun 2003 13:38:38 -0000 1.81 *************** *** 6,11 **** } ! \date{June 29, 2003} % XXX update before final release! \release{2.3} % software release, not documentation ! \setreleaseinfo{b2} % empty for final release \setshortversion{2.3} % major.minor only for software --- 6,11 ---- } ! \date{\today} % XXX update before final release! \release{2.3} % software release, not documentation ! \setreleaseinfo{b2+} % empty for final release \setshortversion{2.3} % major.minor only for software From jhylton@users.sourceforge.net Mon Jun 30 16:01:28 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 30 Jun 2003 08:01:28 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.42.10.10,1.42.10.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv10081 Modified Files: Tag: release22-maint httplib.py Log Message: Backport fix for SF bug 666219. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.42.10.10 retrieving revision 1.42.10.11 diff -C2 -d -r1.42.10.10 -r1.42.10.11 *** httplib.py 31 Jan 2003 14:07:31 -0000 1.42.10.10 --- httplib.py 30 Jun 2003 15:01:26 -0000 1.42.10.11 *************** *** 232,235 **** --- 232,239 ---- if self.debuglevel > 0: print "reply:", repr(line) + if not line: + # Presumably, the server closed the connection before + # sending a valid response. + raise BadStatusLine(line) try: [version, status, reason] = line.split(None, 2) From nnorwitz@users.sourceforge.net Mon Jun 30 20:22:14 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 30 Jun 2003 12:22:14 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_strptime.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv22282/Lib/test Modified Files: test_strptime.py Log Message: Fix typo in error message Index: test_strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** test_strptime.py 29 Jun 2003 15:57:50 -0000 1.15 --- test_strptime.py 30 Jun 2003 19:22:12 -0000 1.16 *************** *** 311,315 **** self.failUnless(strp_output[8] == -1, "LocaleTime().timezone has duplicate values but " ! "timzone value not set to -1") def test_date_time(self): --- 311,315 ---- self.failUnless(strp_output[8] == -1, "LocaleTime().timezone has duplicate values but " ! "timezone value not set to -1") def test_date_time(self): From theller@users.sourceforge.net Mon Jun 30 20:33:31 2003 From: theller@users.sourceforge.net (theller@users.sourceforge.net) Date: Mon, 30 Jun 2003 12:33:31 -0700 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.54,1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory sc8-pr-cvs1:/tmp/cvs-serv24036 Modified Files: dist.tex Log Message: Document the DISTUTILS_DEBUG variable. Closes sf #761401. Backport candidate. Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** dist.tex 13 May 2003 15:02:06 -0000 1.54 --- dist.tex 30 Jun 2003 19:33:29 -0000 1.55 *************** *** 787,790 **** --- 787,811 ---- + \subsection{Debugging the setup script} + \label{meta-data} + + Sometimes things go wrong, and the setup script doesn't do what the + developer wants. + + Distutils catches any exceptions when running the setup script, and + print a simple error message before the script is terminated. The + motivation for this behaviour is to not confuse administrators who + don't know much about Python and are trying to install a package. If + they get a big long traceback from deep inside the guts of Distutils, + they may think the package or the Python installation is broken + because they don't read all the way down to the bottom and see that + it's a permission problem. + + On the other hand, this doesn't help the developer to find the cause + of the failure. For this purpose, the DISTUTILS_DEBUG environment + variable can be set to anything except an empty string, and distutils + will now print detailed information what it is doing, and prints the + full traceback in case an exception occurrs. + \section{Writing the Setup Configuration File} \label{setup-config} From nnorwitz@users.sourceforge.net Mon Jun 30 22:47:49 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 30 Jun 2003 14:47:49 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libthreading.tex,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv15514/Doc/lib Modified Files: libthreading.tex Log Message: Add versionadded info for the 2 new threading module functions Index: libthreading.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libthreading.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** libthreading.tex 29 Jun 2003 18:12:23 -0000 1.17 --- libthreading.tex 30 Jun 2003 21:47:47 -0000 1.18 *************** *** 96,99 **** --- 96,100 ---- \function{sys.settrace()} for each thread, before its \method{run()} method is called. + \versionadded{2.3} \end{funcdesc} *************** *** 103,106 **** --- 104,108 ---- \function{sys.setprofile()} for each thread, before its \method{run()} method is called. + \versionadded{2.3} \end{funcdesc}