From tim.peters at gmail.com Mon Nov 1 02:26:33 2004 From: tim.peters at gmail.com (Tim Peters) Date: Mon Nov 1 02:26:40 2004 Subject: [Python-Dev] Tests broken on Windows In-Reply-To: <20041031195218.GA7395@surfboy> References: <1f7befae0410311127b31675c@mail.gmail.com> <20041031195218.GA7395@surfboy> Message-ID: <1f7befae04103117261e4d7f97@mail.gmail.com> [Johannes Gijsbers] > Hum, I didn't realize os.chmod() worked this differently on Windows. Well, it can't work the same. At the chmod() level, there are no "user", "group" or "world"/"other" concepts on Windows. There also aren't distinct "execute"/"search", "write" and "read" bits. There are "hidden", "system", and "archive" bits on Windows, which have no equivalents on Unix, and there's a "read only" bit on Windows, setting which is kind of like turning off 0222 on Unix. The only thing chmod() is useful for on Windows is fiddling the state of the "read only" bit. > Seems like I bumped into bug #755617 (os module: Need a better description > of "mode"). Per that bug, I googled for '_chmod msdn' and came up with the > attached patch. However, I don't have a Windows machine handy to test. Could > someone with a Windows machine try the patch? No cigar. The patched test appears to assume that if you strip write permission from a directory, that also makes it impossible to delete files within the directory. But directories on Windows aren't files -- they're directories . The attached patch allows the test to pass on WinXP, although I'm not sure about Win95/98/ME. If there are no objections, I'll check it in. I don't remember enough about Unix's equally obscure permission gimmicks to be sure that this patch will leave the test working on non-Windows boxes. -------------- next part -------------- Index: Lib/test/test_shutil.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_shutil.py,v retrieving revision 1.8 diff -u -r1.8 test_shutil.py --- Lib/test/test_shutil.py 31 Oct 2004 12:05:31 -0000 1.8 +++ Lib/test/test_shutil.py 1 Nov 2004 01:10:32 -0000 @@ -1,4 +1,3 @@ - # Copyright (C) 2003 Python Software Foundation import unittest @@ -20,21 +19,28 @@ def test_on_error(self): self.errorState = 0 os.mkdir(TESTFN) - f = open(os.path.join(TESTFN, 'a'), 'w') + self.childpath = os.path.join(TESTFN, 'a') + f = open(self.childpath, 'w') f.close() - # Make TESTFN unwritable. - os.chmod(TESTFN, stat.S_IRUSR) + old_dir_mode = os.stat(TESTFN).st_mode + old_child_mode = os.stat(self.childpath).st_mode + # Make unwritable. + os.chmod(self.childpath, stat.S_IREAD) + os.chmod(TESTFN, stat.S_IREAD) shutil.rmtree(TESTFN, onerror=self.check_args_to_onerror) - # Make TESTFN writable again. - os.chmod(TESTFN, stat.S_IRWXU) + # Make writable again. + os.chmod(TESTFN, old_dir_mode) + os.chmod(self.childpath, old_child_mode) + + # Clean up. shutil.rmtree(TESTFN) def check_args_to_onerror(self, func, arg, exc): if self.errorState == 0: self.assertEqual(func, os.remove) - self.assertEqual(arg, os.path.join(TESTFN, 'a')) + self.assertEqual(arg, self.childpath) self.assertEqual(exc[0], OSError) self.errorState = 1 else: From jlg at dds.nl Mon Nov 1 03:38:47 2004 From: jlg at dds.nl (Johannes Gijsbers) Date: Mon Nov 1 03:36:47 2004 Subject: [Python-Dev] Tests broken on Windows In-Reply-To: <1f7befae04103117261e4d7f97@mail.gmail.com> References: <1f7befae0410311127b31675c@mail.gmail.com> <20041031195218.GA7395@surfboy> <1f7befae04103117261e4d7f97@mail.gmail.com> Message-ID: <20041101023847.GA17801@surfboy> On Sun, Oct 31, 2004 at 08:26:33PM -0500, Tim Peters wrote: > The attached patch allows the test to pass on WinXP, although I'm not > sure about Win95/98/ME. If there are no objections, I'll check it in. > I don't remember enough about Unix's equally obscure permission > gimmicks to be sure that this patch will leave the test working on > non-Windows boxes. It works on my Debian machine, so no objections from me. Cheers, Johannes From python at rcn.com Mon Nov 1 04:02:52 2004 From: python at rcn.com (Raymond Hettinger) Date: Mon Nov 1 04:05:01 2004 Subject: [Python-Dev] Tests broken on Windows In-Reply-To: <20041101023847.GA17801@surfboy> Message-ID: <006601c4bfbf$478258c0$e841fea9@oemcomputer> > On Sun, Oct 31, 2004 at 08:26:33PM -0500, Tim Peters wrote: > > The attached patch allows the test to pass on WinXP, although I'm not > > sure about Win95/98/ME. If there are no objections, I'll check it in. > > I don't remember enough about Unix's equally obscure permission > > gimmicks to be sure that this patch will leave the test working on > > non-Windows boxes. > > It works on my Debian machine, so no objections from me. Run fine on WinME. Am still getting a failure for test_traceback.py's test_bug737473. Raymond From tim.peters at gmail.com Mon Nov 1 06:52:03 2004 From: tim.peters at gmail.com (Tim Peters) Date: Mon Nov 1 06:52:04 2004 Subject: [Python-Dev] Tests broken on Windows In-Reply-To: <006601c4bfbf$478258c0$e841fea9@oemcomputer> References: <20041101023847.GA17801@surfboy> <006601c4bfbf$478258c0$e841fea9@oemcomputer> Message-ID: <1f7befae04103121526ff7a94c@mail.gmail.com> [Raymond Hettinger] > Run fine on WinME. > > Am still getting a failure for test_traceback.py's test_bug737473. Fixed that already for WinXP. No current failures in the -uall test suite. Is there a bug report for this ME problem? Exactly how does it fail? Does it work if you force the test to take the time.sleep() path instead of the os.utime() path? Is posixmodule.c's posix_utime() taking the utime() or _wutime() path on ME? If the latter, does it work if you force it to take the utime() path instead? MS docs claim utime() and _wutime() work "under Windows 98/Me and Windows NT/2000/XP", but they could be lying: That link has a wonderful C example: if you study the sample output, it shows that the sample code they ran had no visible effect . From python at rcn.com Mon Nov 1 07:50:29 2004 From: python at rcn.com (Raymond Hettinger) Date: Mon Nov 1 07:52:40 2004 Subject: [Python-Dev] Tests broken on Windows In-Reply-To: <1f7befae04103121526ff7a94c@mail.gmail.com> Message-ID: <007c01c4bfdf$138f7f00$e841fea9@oemcomputer> > Fixed that already for WinXP. No current failures in the -uall test > suite. Is there a bug report for this ME problem? Exactly how does > it fail? Traceback (most recent call last): File "test_traceback.py", line 79, in test_bug737473 test_bug737473.test() File "c:\windows\temp\tmpsj7w5a\test_bug737473.py", line 2, in test ValueError > Does it work if you force the test to take the time.sleep() > path instead of the os.utime() path? Yes. > Is posixmodule.c's posix_utime() > taking the utime() or _wutime() path on ME? If the latter, does it > work if you force it to take the utime() path instead? MS docs claim > utime() and _wutime() work "under Windows 98/Me and Windows > NT/2000/XP", but they could be lying: > > us/vclib/html/_crt__utime.2c_._wutime.asp> > > That link has a wonderful C example: if you study the sample output, > it shows that the sample code they ran had no visible effect . Am challenged for time in the next couple of days. Will delve deeper at the first opportunity. For the time being, I think it would be best to use sleep() instead of utime(). While it costs three seconds, at least we know it to be a platform independent test. It is rather late in the game to be debugging OS specific problems introduced by a new check-in. Raymond From hyeshik at gmail.com Mon Nov 1 09:19:24 2004 From: hyeshik at gmail.com (Hye-Shik Chang) Date: Mon Nov 1 09:19:31 2004 Subject: [Python-Dev] Tests broken on Windows In-Reply-To: <007c01c4bfdf$138f7f00$e841fea9@oemcomputer> References: <1f7befae04103121526ff7a94c@mail.gmail.com> <007c01c4bfdf$138f7f00$e841fea9@oemcomputer> Message-ID: <4f0b69dc04110100194b7335f4@mail.gmail.com> On Mon, 1 Nov 2004 01:50:29 -0500, Raymond Hettinger wrote: > For the time being, I think it would be best to use sleep() instead of > utime(). While it costs three seconds, at least we know it to be a > platform independent test. It is rather late in the game to be > debugging OS specific problems introduced by a new check-in. Okay. I am convinced about using sleep() always. And two seconds will be enough to wait for new timestamp value. :) Will check it in right now. Hye-Shik From walter at livinglogic.de Mon Nov 1 15:17:22 2004 From: walter at livinglogic.de (=?ISO-8859-15?Q?Walter_D=F6rwald?=) Date: Mon Nov 1 15:17:25 2004 Subject: [Python-Dev] Code coverage tool updated Message-ID: <41864572.4000806@livinglogic.de> The Python code coverage tool available at http://coverage.livinglogic.de/ has been updated. (It runs the Python test suite once a month and makes the resulting code coverage info available as a web application). The backend is now Oracle instead of Postgres and is on a much faster machine. The frontend has been replaced too, so the result should be much faster and more flexible. Bye, Walter D?rwald From tim.peters at gmail.com Mon Nov 1 15:40:55 2004 From: tim.peters at gmail.com (Tim Peters) Date: Mon Nov 1 15:40:58 2004 Subject: [Python-Dev] Tests broken on Windows In-Reply-To: <007c01c4bfdf$138f7f00$e841fea9@oemcomputer> References: <1f7befae04103121526ff7a94c@mail.gmail.com> <007c01c4bfdf$138f7f00$e841fea9@oemcomputer> Message-ID: <1f7befae0411010640413d9148@mail.gmail.com> > Exactly how does it fail? [Raymond Hettinger, on bug737473] > Traceback (most recent call last): > File "test_traceback.py", line 79, in test_bug737473 > test_bug737473.test() > File "c:\windows\temp\tmpsj7w5a\test_bug737473.py", line 2, in test > ValueError That helps. >> Does it work if you force the test to take the time.sleep() >> path instead of the os.utime() path? > Yes. Progress . ... > Am challenged for time in the next couple of days. Will delve deeper at > the first opportunity. > > For the time being, I think it would be best to use sleep() instead of > utime(). While it costs three seconds, at least we know it to be a > platform independent test. It is rather late in the game to be > debugging OS specific problems introduced by a new check-in. The checkin isn't that new anymore. Just try changing past = time.time() - 3 to past = time.time() - 6 I added a note to explaining why that may matter on FAT or FAT32 systems. From jlg at dds.nl Mon Nov 1 15:40:27 2004 From: jlg at dds.nl (Johannes Gijsbers) Date: Mon Nov 1 16:09:29 2004 Subject: [Python-Dev] Bug Day 4: this Sunday Message-ID: <20041101144027.GA16108@surfboy> The fourth Python Bug Day is coming up this Sunday, November 7 2004. When? ===== This Sunday, November 7, 2004. I'll be online at least from 11AM to 6PM CET (10AM to 5PM GMT/ 6AM to 1PM EDT). That's a rather short time for the people in the USian timezones, so I would like to see someone with CVS access from those zones extend the bug day. Anyone interested? Where? ====== * The #python-dev channel on irc.freenode.net. * In real life, at the Amaze office: Korte Leidsedwarsstraat 12 1017 RC Amsterdam tel: 020-4688336 More information ================ For instructions and more information, see http://www.python.org/moin/PythonBugDay Cheers, Johannes From mwh at python.net Mon Nov 1 18:22:03 2004 From: mwh at python.net (Michael Hudson) Date: Mon Nov 1 18:22:06 2004 Subject: [Python-Dev] Code coverage tool updated In-Reply-To: <41864572.4000806@livinglogic.de> ( =?iso-8859-1?q?Walter_D=F6rwald's_message_of?= "Mon, 01 Nov 2004 15:17:22 +0100") References: <41864572.4000806@livinglogic.de> Message-ID: <2mu0s95vt0.fsf@starship.python.net> Walter D?rwald writes: > The Python code coverage tool available at > http://coverage.livinglogic.de/ has been updated. (It runs the > Python test suite once a month and makes the resulting code > coverage info available as a web application). > > The backend is now Oracle instead of Postgres and is on a much > faster machine. The frontend has been replaced too, so the result > should be much faster and more flexible. Using the back button in a browser seems to break it fairly badly -- if you click on a file that has some results, then click 'back' you get a java.lang.NullPointerException! If you click on a file _without_ results and click 'back' you merely get a message in German that I don't understand... Cheers, mwh -- Programming languages should be designed not by piling feature on top of feature, but by removing the weaknesses and restrictions that make the additional features appear necessary. -- Revised(5) Report on the Algorithmic Language Scheme From skip at pobox.com Mon Nov 1 23:01:56 2004 From: skip at pobox.com (Skip Montanaro) Date: Mon Nov 1 23:02:20 2004 Subject: [Python-Dev] Code coverage tool updated In-Reply-To: <41864572.4000806@livinglogic.de> References: <41864572.4000806@livinglogic.de> Message-ID: <16774.45652.835103.327656@montanaro.dyndns.org> Walter> The Python code coverage tool available at Walter> http://coverage.livinglogic.de/ has been updated. (It runs the Walter> Python test suite once a month and makes the resulting code Walter> coverage info available as a web application). This looks very interesting, but the results seem a bit mystifying. For example, it says that Lib/Queue.py has 169 lines, none of which are coverable. It also shows that no lines were covered, which seems odd considering the fact the distribution does have a test_queue.py test module. Skip From satyarth.negi at gmail.com Tue Nov 2 10:13:12 2004 From: satyarth.negi at gmail.com (Satyarth Negi) Date: Tue Nov 2 10:13:16 2004 Subject: [Python-Dev] Help Needed ..Urgent Plzz Message-ID: <546a6a000411020113195cb03f@mail.gmail.com> Hello , I have a problem with a peice of code : ......... self.child = pexpect.spawn('ssh -l ' + user +' ' + host) self.child.setmaxread (1000) self.child.expect('[pP]assword:', 30) self.child.sendline(password) ........ When i run the script it gives me following error : " Exception exceptions.OSError: (10, 'No child processes') in > ignored" Then I added , self.child.close(False) before 3rd line , but even that is not working . Please help , im totaly stuck . Thanx in anticipation . Regards Satyarth Negi India From walter at livinglogic.de Tue Nov 2 12:58:21 2004 From: walter at livinglogic.de (=?ISO-8859-1?Q?Walter_D=F6rwald?=) Date: Tue Nov 2 12:58:25 2004 Subject: [Python-Dev] Code coverage tool updated In-Reply-To: <16774.45652.835103.327656@montanaro.dyndns.org> References: <41864572.4000806@livinglogic.de> <16774.45652.835103.327656@montanaro.dyndns.org> Message-ID: <4187765D.3000705@livinglogic.de> Skip Montanaro wrote: > Walter> The Python code coverage tool available at > Walter> http://coverage.livinglogic.de/ has been updated. (It runs the > Walter> Python test suite once a month and makes the resulting code > Walter> coverage info available as a web application). > > This looks very interesting, but the results seem a bit mystifying. For > example, it says that Lib/Queue.py has 169 lines, none of which are > coverable. It also shows that no lines were covered, which seems odd > considering the fact the distribution does have a test_queue.py test module. The same happened to string.py. The run from yesterday *does* include string.py as a covered file, but only two lines were covered, which is even stranger. Maybe the problem is the fact, that I'm using an old version of trace.py? I'll updated trace.py and rerun the job. Bye, Walter D?rwald From walter at livinglogic.de Tue Nov 2 12:58:35 2004 From: walter at livinglogic.de (=?ISO-8859-1?Q?Walter_D=F6rwald?=) Date: Tue Nov 2 12:58:38 2004 Subject: [Python-Dev] Code coverage tool updated In-Reply-To: <2mu0s95vt0.fsf@starship.python.net> References: <41864572.4000806@livinglogic.de> <2mu0s95vt0.fsf@starship.python.net> Message-ID: <4187766B.7060407@livinglogic.de> Michael Hudson wrote: > Walter D?rwald writes: > > >>The Python code coverage tool available at >>http://coverage.livinglogic.de/ has been updated. (It runs the >>Python test suite once a month and makes the resulting code >>coverage info available as a web application). >> >>The backend is now Oracle instead of Postgres and is on a much >>faster machine. The frontend has been replaced too, so the result >>should be much faster and more flexible. > > Using the back button in a browser seems to break it fairly badly -- > if you click on a file that has some results, then click 'back' you > get a java.lang.NullPointerException! I can reproduce that. I've forwarded this to the developer (who is currently on vacation and will be back in December). > If you click on a file > _without_ results and click 'back' you merely get a message in German > that I don't understand... This message basically says "Don't click the back button!". Bye, Walter D?rwald From FBatista at uniFON.com.ar Tue Nov 2 13:35:49 2004 From: FBatista at uniFON.com.ar (Batista, Facundo) Date: Tue Nov 2 13:37:26 2004 Subject: [Python-Dev] Help Needed ..Urgent Plzz Message-ID: [Satyarth Negi] #- Hello , I have a problem with a peice of code : #- #- ......... #- ........ Satyarth, this list is for development of Python itself, not for development of programs in Python. This post should go to the standard python newsgroup, comp.lang.python, which can be accessed as a news or as a mailing list (for further reference and ways to subscribe, check http://www.python.org/community/lists.html). . Facundo -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-dev/attachments/20041102/3c69cf07/attachment.html From anthony at interlink.com.au Tue Nov 2 13:46:38 2004 From: anthony at interlink.com.au (Anthony Baxter) Date: Tue Nov 2 13:46:16 2004 Subject: [Python-Dev] TRUNK FROZEN for 2.4b2 release from 0000UTC 3rd November (tomorrrow) Message-ID: <418781AE.70303@interlink.com.au> The trunk should be considered frozen for the 2.4b2 release from 0000 UTC tomorrow, Wed 3rd November. That's (if my sums are correct) 2nd November from 1900 US Eastern time, and 1600 US Pacific time. Or, to put it another way, in about 11 hours from when I'm sending this message. As usual, if you're not in the set (Martin, Fred, Anthony) please hold off on any checkins until the b2 release is done. Thanks, Anthony -- Anthony Baxter It's never too late to have a happy childhood. From anthony at interlink.com.au Tue Nov 2 13:48:49 2004 From: anthony at interlink.com.au (Anthony Baxter) Date: Tue Nov 2 13:49:22 2004 Subject: [Python-Dev] Bug Day 4: this Sunday In-Reply-To: <20041101144027.GA16108@surfboy> References: <20041101144027.GA16108@surfboy> Message-ID: <41878231.9060001@interlink.com.au> Johannes Gijsbers wrote: > This Sunday, November 7, 2004. I'll be online at least from 11AM to 6PM CET > (10AM to 5PM GMT/ 6AM to 1PM EDT). That's a rather short time for the people in > the USian timezones, so I would like to see someone with CVS access from those > zones extend the bug day. Anyone interested? Could I request that people are _really_ careful about checking in bugs that might lead to breakage, as this will be between 2.4b2, and what I _hope_ will be 2.4rc1. Thanks, Anthony -- Anthony Baxter It's never too late to have a happy childhood. From walter at livinglogic.de Tue Nov 2 18:55:40 2004 From: walter at livinglogic.de (=?ISO-8859-1?Q?Walter_D=F6rwald?=) Date: Tue Nov 2 18:55:44 2004 Subject: [Python-Dev] Code coverage tool updated In-Reply-To: <4187765D.3000705@livinglogic.de> References: <41864572.4000806@livinglogic.de> <16774.45652.835103.327656@montanaro.dyndns.org> <4187765D.3000705@livinglogic.de> Message-ID: <4187CA1C.9050508@livinglogic.de> Walter D?rwald wrote: > Skip Montanaro wrote: > >> Walter> The Python code coverage tool available at >> Walter> http://coverage.livinglogic.de/ has been updated. (It runs >> the >> Walter> Python test suite once a month and makes the resulting code >> Walter> coverage info available as a web application). >> >> This looks very interesting, but the results seem a bit mystifying. For >> example, it says that Lib/Queue.py has 169 lines, none of which are >> coverable. It also shows that no lines were covered, which seems odd >> considering the fact the distribution does have a test_queue.py test >> module. > > > The same happened to string.py. The run from yesterday *does* include > string.py as a covered file, but only two lines were covered, which is > even stranger. > > Maybe the problem is the fact, that I'm using an old version of > trace.py? I'll updated trace.py and rerun the job. This doesn't help. The following assert in trace.py raises an AssertionError: assert filename.endswith('.py') I've added print statements to find_executable_linenos() and got the following: [...] /home/coverage/LivingLogic/Python/PythonCodeCoverage/jobs/python/dist/src/Lib/sre_compile.py /home/coverage/LivingLogic/Python/PythonCodeCoverage/jobs/python/dist/src/Lib/test/__init__.py Traceback (most recent call last): File "../../../trace.py", line 790, in ? main() File "../../../trace.py", line 787, in main results.write_results(missing, summary=summary, coverdir=coverdir) File "../../../trace.py", line 301, in write_results lnotab = find_executable_linenos(filename) File "../../../trace.py", line 420, in find_executable_linenos assert filename.endswith('.py') AssertionError So what is ? Bye, Walter D?rwald From tim.peters at gmail.com Tue Nov 2 19:53:59 2004 From: tim.peters at gmail.com (Tim Peters) Date: Tue Nov 2 19:54:12 2004 Subject: [Python-Dev] Code coverage tool updated In-Reply-To: <4187CA1C.9050508@livinglogic.de> References: <41864572.4000806@livinglogic.de> <16774.45652.835103.327656@montanaro.dyndns.org> <4187765D.3000705@livinglogic.de> <4187CA1C.9050508@livinglogic.de> Message-ID: <1f7befae04110210537c35e514@mail.gmail.com> [Walter D?rwald] > This doesn't help. The following assert in trace.py raises > an AssertionError: > assert filename.endswith('.py') > > I've added print statements to find_executable_linenos() > and got the following: > > [...] > /home/coverage/LivingLogic/Python/PythonCodeCoverage/jobs/python/dist/src/Lib/sre_compile.py > /home/coverage/LivingLogic/Python/PythonCodeCoverage/jobs/python/dist/src/Lib/test/__init__.py > > Traceback (most recent call last): > File "../../../trace.py", line 790, in ? > main() > File "../../../trace.py", line 787, in main > results.write_results(missing, summary=summary, coverdir=coverdir) > File "../../../trace.py", line 301, in write_results > lnotab = find_executable_linenos(filename) > File "../../../trace.py", line 420, in find_executable_linenos > assert filename.endswith('.py') > AssertionError > > So what is ? I haven't followed this thread, but can answer that question literally : it's code synthesized for the seventh doctest example in Lib/_threading_local.py's module docstring. The file name is constructed by this line in doctest.py: # Use a special filename for compile(), so we can retrieve # the source code during interactive debugging (see # __patched_linecache_getlines). filename = '' % (test.name, examplenum) From bac at OCF.Berkeley.EDU Tue Nov 2 21:24:38 2004 From: bac at OCF.Berkeley.EDU (Brett C.) Date: Tue Nov 2 21:25:01 2004 Subject: [Python-Dev] TRUNK FROZEN for 2.4b2 release from 0000UTC 3rd November (tomorrrow) In-Reply-To: <418781AE.70303@interlink.com.au> References: <418781AE.70303@interlink.com.au> Message-ID: <4187ED06.70104@ocf.berkeley.edu> Anthony Baxter wrote: > The trunk should be considered frozen for the 2.4b2 release from 0000 > UTC tomorrow, Wed 3rd November. That's (if my sums are correct) 2nd > November from 1900 US Eastern time, and 1600 US Pacific time. Or, > to put it another way, in about 11 hours from when I'm sending this > message. > Is a deprecation of a function okay in the Mac C API? Specifically, PyMac_GetAppletScriptFile() is not being used by any known code and is a problem for http://www.python.org/sf/1035255 (removes dependency of compiling against some frameworks for the core on OS X). Since I didn't feel totally safe applying the patch for b2 since it changed compilation and I didn't get in early enough to get testing from CVS users I was planning on deprecating PyMac_GetAppletScriptFile() for 2.4 and removing it in 2.5 so I could apply the patch then. But it is a feature change so I wanted to get clearance first. As I said, to the best of my and Bob Ippolito's knowledge no one is using the function and it is a hinderance in removing unneeded linking against the core on OS X. Sorry I didn't do this sooner but I didn't think about deprecating the thing until late last night. -Brett From bob at redivi.com Tue Nov 2 21:46:19 2004 From: bob at redivi.com (Bob Ippolito) Date: Tue Nov 2 21:46:33 2004 Subject: [Python-Dev] TRUNK FROZEN for 2.4b2 release from 0000UTC 3rd November (tomorrrow) In-Reply-To: <4187ED06.70104@ocf.berkeley.edu> References: <418781AE.70303@interlink.com.au> <4187ED06.70104@ocf.berkeley.edu> Message-ID: <3FEE83B6-2D10-11D9-955F-000A95BA5446@redivi.com> On Nov 2, 2004, at 15:24, Brett C. wrote: > Anthony Baxter wrote: >> The trunk should be considered frozen for the 2.4b2 release from 0000 >> UTC tomorrow, Wed 3rd November. That's (if my sums are correct) 2nd >> November from 1900 US Eastern time, and 1600 US Pacific time. Or, >> to put it another way, in about 11 hours from when I'm sending this >> message. > > Is a deprecation of a function okay in the Mac C API? Specifically, > PyMac_GetAppletScriptFile() is not being used by any known code and is > a problem for http://www.python.org/sf/1035255 (removes dependency of > compiling against some frameworks for the core on OS X). Since I > didn't feel totally safe applying the patch for b2 since it changed > compilation and I didn't get in early enough to get testing from CVS > users I was planning on deprecating PyMac_GetAppletScriptFile() for > 2.4 and removing it in 2.5 so I could apply the patch then. > > But it is a feature change so I wanted to get clearance first. As I > said, to the best of my and Bob Ippolito's knowledge no one is using > the function and it is a hinderance in removing unneeded linking > against the core on OS X. > > Sorry I didn't do this sooner but I didn't think about deprecating the > thing until late last night. If it's absolutely necessary to keep this undocumented function that *nobody* uses in the API, I'll write a version that delegates the functionality to an extension module that has business linking to said frameworks. I really want to see this change for 2.4. -bob From anthony at interlink.com.au Wed Nov 3 03:34:39 2004 From: anthony at interlink.com.au (Anthony Baxter) Date: Wed Nov 3 03:34:14 2004 Subject: [Python-Dev] TRUNK FROZEN for 2.4b2 release from 0000UTC 3rd November (tomorrrow) In-Reply-To: <4187ED06.70104@ocf.berkeley.edu> References: <418781AE.70303@interlink.com.au> <4187ED06.70104@ocf.berkeley.edu> Message-ID: <418843BF.7020107@interlink.com.au> Brett C. wrote: > Anthony Baxter wrote: > >> The trunk should be considered frozen for the 2.4b2 release from 0000 >> UTC tomorrow, Wed 3rd November. That's (if my sums are correct) 2nd >> November from 1900 US Eastern time, and 1600 US Pacific time. Or, >> to put it another way, in about 11 hours from when I'm sending this >> message. >> > > Is a deprecation of a function okay in the Mac C API? Specifically, > PyMac_GetAppletScriptFile() is not being used by any known code and is a > problem for http://www.python.org/sf/1035255 (removes dependency of > compiling against some frameworks for the core on OS X). Since I didn't > feel totally safe applying the patch for b2 since it changed compilation > and I didn't get in early enough to get testing from CVS users I was > planning on deprecating PyMac_GetAppletScriptFile() for 2.4 and removing > it in 2.5 so I could apply the patch then. It sounds like it's fine to put in once the trunk is unfrozen. -- Anthony Baxter It's never too late to have a happy childhood. From bac at OCF.Berkeley.EDU Wed Nov 3 04:43:24 2004 From: bac at OCF.Berkeley.EDU (Brett C.) Date: Wed Nov 3 04:43:56 2004 Subject: [Python-Dev] TRUNK FROZEN for 2.4b2 release from 0000UTC 3rd November (tomorrrow) In-Reply-To: <418843BF.7020107@interlink.com.au> References: <418781AE.70303@interlink.com.au> <4187ED06.70104@ocf.berkeley.edu> <418843BF.7020107@interlink.com.au> Message-ID: <418853DC.10501@ocf.berkeley.edu> Anthony Baxter wrote: > Brett C. wrote: > >> Anthony Baxter wrote: >> >>> The trunk should be considered frozen for the 2.4b2 release from 0000 >>> UTC tomorrow, Wed 3rd November. That's (if my sums are correct) 2nd >>> November from 1900 US Eastern time, and 1600 US Pacific time. Or, >>> to put it another way, in about 11 hours from when I'm sending this >>> message. >>> >> >> Is a deprecation of a function okay in the Mac C API? Specifically, >> PyMac_GetAppletScriptFile() is not being used by any known code and is >> a problem for http://www.python.org/sf/1035255 (removes dependency of >> compiling against some frameworks for the core on OS X). Since I >> didn't feel totally safe applying the patch for b2 since it changed >> compilation and I didn't get in early enough to get testing from CVS >> users I was planning on deprecating PyMac_GetAppletScriptFile() for >> 2.4 and removing it in 2.5 so I could apply the patch then. > > > It sounds like it's fine to put in once the trunk is unfrozen. > OK, great. I will add the deprecation warning once the trunk is unfrozen and plan on applying the full patch for removing the compilation once 2.5 is open for work. Sorry I couldn't get my act together fast enough to get this in for 2.4, Bob. -Brett From tim.peters at gmail.com Wed Nov 3 05:40:05 2004 From: tim.peters at gmail.com (Tim Peters) Date: Wed Nov 3 05:40:10 2004 Subject: [Python-Dev] weakref gc semantics Message-ID: <1f7befae04110220402077a6fa@mail.gmail.com> This example bothers me a little, under current Python CVS: """ import gc, weakref def C_gone(ignored): print "An object of type C went away." class C: def __init__(self): self.wr = weakref.ref(self, C_gone) print "creating non-cyclic C instance" c = C() print "creating cyclic C instance and destroying old one" c = C() # triggers the print c.loop = c print "getting rid of the cyclic one" c = None # doesn't trigger the print gc.collect() # ditto """ Output: creating non-cyclic C instance creating cyclic C instance and destroying old one An object of type C went away. getting rid of the cyclic one An instance c of C gets a strong reference (self.wr) to a weak reference W to itself. At the end, c is in a cycle, but W isn't. W ends up reachable only *from* stuff in a cycle (namely c). gc suppresses the callback then because W is unreachable, not really because W is in a cycle. If self.wr had a __del__ method instead, it would have been executed. So it bothers me a little that the callback isn't: a reachable callback can have visible effects, and there really isn't ambiguity about which of c and W "dies first" (c does) in the example. The question is whether gc should really be looking at whether the weakref *callback* is reachable, regardless of whether the weakref itself is reachable (if the weakref is reachable, its callback is too, and 2.4b2 invokes it -- the only case in question is the one in the example, where the weakref and the weakref's referent are unreachable but the weakref's callback is reachable). Pythons 2.2.3 and 2.3.4 produce the same output, so no way do I want to change Python 2.4 at this late stage. It's a question for 2.5. It gets more complicated than the above, of course. For example, we can end up with weakrefs *in* cycles, with reachable callbacks, and then there's no good way to decide which callback to invoke first. That's the same ordering problem we have when objects with __del__ methods are in trash cycles. It's not intractable, though, because gc invokes weakref callbacks before tp_clear has been invoked on anything, and reachable weakref callbacks can't resurrect any trash (anything they can access is, by definition of "reachable", not trash). A hidden agenda is that I like weakref callbacks a lot more than __del__ methods, and would like to see them strong enough so that Python 3 could leave __del__ out. Planting a weakref to self *in* self (as in the example at the top) is one way to approach critical-resource cleanup in a __del__-free world (a weakref subclass could remember the critical resource when an instance was constructed, and the callback could access the critical resource to clean it up -- but, as the example shows, that doesn't work now if the containing instance ends up in cyclic trash; but there are other ways that do work). From just at letterror.com Wed Nov 3 08:38:54 2004 From: just at letterror.com (Just van Rossum) Date: Wed Nov 3 08:39:39 2004 Subject: [Python-Dev] TRUNK FROZEN for 2.4b2 release from 0000UTC 3rd November (tomorrrow) In-Reply-To: <418853DC.10501@ocf.berkeley.edu> Message-ID: Brett C. wrote: > OK, great. I will add the deprecation warning once the trunk is > unfrozen and plan on applying the full patch for removing the > compilation once 2.5 is open for work. > > Sorry I couldn't get my act together fast enough to get this in for > 2.4, Bob. I don't get it. This is about an undocumented Mac-specific API function that noone uses (not even Python itself) which was introduced in 2.3. It just needs to be ripped out. I don't mind if it's done after b2, but I agree with Bob that it needs to be taken out before 2.4 final. Jack, would you agree? Just From anthony at interlink.com.au Wed Nov 3 08:49:34 2004 From: anthony at interlink.com.au (Anthony Baxter) Date: Wed Nov 3 08:50:14 2004 Subject: [Python-Dev] TRUNK FROZEN for 2.4b2 release from 0000UTC 3rd November (tomorrrow) In-Reply-To: References: Message-ID: <41888D8E.5050705@interlink.com.au> Just van Rossum wrote: > I don't get it. This is about an undocumented Mac-specific API function > that noone uses (not even Python itself) which was introduced in 2.3. It > just needs to be ripped out. I don't mind if it's done after b2, but I > agree with Bob that it needs to be taken out before 2.4 final. Jack, > would you agree? FWIW, I don't mind having this done either way... From anthony at interlink.com.au Wed Nov 3 12:16:49 2004 From: anthony at interlink.com.au (Anthony Baxter) Date: Wed Nov 3 13:19:52 2004 Subject: [Python-Dev] interlocking dependencies on the path to a release Message-ID: <4188BE21.6040205@interlink.com.au> So I've been documenting the current state of the release process, and it's a bit messier than I'd like - particularly with people scattered across timezones. Here's the list of things that need to happen, and what depends on each. 1. Include/patchlevel.h 2. Doc build (depends on 1.) 3. Misc/NEWS, Lib/idlelib/NEWS.txt, Lib/idlelib/idlever.py 4. PCbuild/BUILDno.txt, pythoncore.dsp 5. Tag the tree (depends on 1, 3, 5) 6. export/build the tarballs (depends on 5) 7. Build the windows release (depends on 2, 5) 8. Update the webpages, sign the files (depends on 6, 7) 9. Send the email (depends on 8) Stage 2 is a Fred thing, stages 4 and 7 are Martin, most of the rest are things I do, although Fred will often do 1 because he needs it to do 2, and the timezone thing makes it easier for him to just do it. (*) The names 'Fred', 'Martin', and 'I' are just the names of the current set of release people - feel free to substitute roles in there instead. I'm not really going anywhere with this yet, but I'm curious if anyone can see any paths that might lead to a simpler result? It's particularly bad at the moment, with me being UTC+11, Martin UTC+1, and Fred UTC-4 (I might be off by an hour or two for Fred and Martin). From bac at OCF.Berkeley.EDU Wed Nov 3 23:57:26 2004 From: bac at OCF.Berkeley.EDU (Brett C.) Date: Wed Nov 3 23:57:57 2004 Subject: [Python-Dev] TRUNK FROZEN for 2.4b2 release from 0000UTC 3rd November (tomorrrow) In-Reply-To: <41888D8E.5050705@interlink.com.au> References: <41888D8E.5050705@interlink.com.au> Message-ID: <41896256.1040104@ocf.berkeley.edu> Anthony Baxter wrote: > Just van Rossum wrote: > >> I don't get it. This is about an undocumented Mac-specific API function >> that noone uses (not even Python itself) which was introduced in 2.3. It >> just needs to be ripped out. I don't mind if it's done after b2, but I >> agree with Bob that it needs to be taken out before 2.4 final. Jack, >> would you agree? > I think Bob also wanted to get the whole patch in that removed compiling the core against CoreFoundation and CoreServices. I am not comfortable doing that without more lead into a beta than this so I am holding off until 2.5 for that. > > FWIW, I don't mind having this done either way... > OK, then I will just rip it out and skip the deprecation warning. -Brett From bac at OCF.Berkeley.EDU Thu Nov 4 00:13:34 2004 From: bac at OCF.Berkeley.EDU (Brett C.) Date: Thu Nov 4 00:13:54 2004 Subject: [Python-Dev] interlocking dependencies on the path to a release In-Reply-To: <4188BE21.6040205@interlink.com.au> References: <4188BE21.6040205@interlink.com.au> Message-ID: <4189661E.7040002@ocf.berkeley.edu> Anthony Baxter wrote: > So I've been documenting the current state of the release process, > and it's a bit messier than I'd like - particularly with people > scattered across timezones. Here's the list of things that need > to happen, and what depends on each. > > 1. Include/patchlevel.h > 2. Doc build (depends on 1.) > 3. Misc/NEWS, Lib/idlelib/NEWS.txt, Lib/idlelib/idlever.py > 4. PCbuild/BUILDno.txt, pythoncore.dsp > 5. Tag the tree (depends on 1, 3, 5) > 6. export/build the tarballs (depends on 5) > 7. Build the windows release (depends on 2, 5) > 8. Update the webpages, sign the files (depends on 6, 7) > 9. Send the email (depends on 8) > The only thing I can see possibly making things easier is to script stuff. Steps 1, 3, and 4 could all be automated. And if generating the HTML for the reST text is a slight pain because of errors in the syntax we could try to check that more often or even designate that someone keeps random track that the syntax is good. Otherwise we could probably try to have some build script on creosote (web server for python.org) that tries to generate it nightly to catch errors early. Best solution I can think of is somehow come up with a way to remove the need for Martin to do 4 somehow. If that happens then Fred can do 1-2, Anthony can do 3-6, Martin does 7, and then Anthony finished up with 8-10. Without Martin doing 7-10 I don't see a good way to rework this. -Brett From bob at redivi.com Thu Nov 4 00:14:08 2004 From: bob at redivi.com (Bob Ippolito) Date: Thu Nov 4 00:14:18 2004 Subject: [Python-Dev] TRUNK FROZEN for 2.4b2 release from 0000UTC 3rd November (tomorrrow) In-Reply-To: <41896256.1040104@ocf.berkeley.edu> References: <41888D8E.5050705@interlink.com.au> <41896256.1040104@ocf.berkeley.edu> Message-ID: <103B4788-2DEE-11D9-8F1A-000A95BA5446@redivi.com> On Nov 3, 2004, at 17:57, Brett C. wrote: > Anthony Baxter wrote: >> Just van Rossum wrote: >>> I don't get it. This is about an undocumented Mac-specific API >>> function >>> that noone uses (not even Python itself) which was introduced in >>> 2.3. It >>> just needs to be ripped out. I don't mind if it's done after b2, but >>> I >>> agree with Bob that it needs to be taken out before 2.4 final. Jack, >>> would you agree? > > I think Bob also wanted to get the whole patch in that removed > compiling the core against CoreFoundation and CoreServices. I am not > comfortable doing that without more lead into a beta than this so I am > holding off until 2.5 for that. Argh! It's nothing crazy, it removes incorrect linker flags and delegates two Mac-specific API functions to where they belong. -bob From martin at v.loewis.de Thu Nov 4 00:17:59 2004 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Thu Nov 4 00:17:53 2004 Subject: [Python-Dev] Re: interlocking dependencies on the path to a release In-Reply-To: <4188BE21.6040205@interlink.com.au> References: <4188BE21.6040205@interlink.com.au> Message-ID: <41896727.7030206@v.loewis.de> Anthony Baxter wrote: > 1. Include/patchlevel.h > 2. Doc build (depends on 1.) > 3. Misc/NEWS, Lib/idlelib/NEWS.txt, Lib/idlelib/idlever.py > 4. PCbuild/BUILDno.txt, pythoncore.dsp > 5. Tag the tree (depends on 1, 3, 5) > 6. export/build the tarballs (depends on 5) > 7. Build the windows release (depends on 2, 5) > 8. Update the webpages, sign the files (depends on 6, 7) > 9. Send the email (depends on 8) > > > Stage 2 is a Fred thing, stages 4 and 7 are Martin, most of the rest > are things I do, although Fred will often do 1 because he needs it > to do 2, and the timezone thing makes it easier for him to just do > it. It would be possible to automate the bumps to version numbers, and you don't have to be on Windows to do 4, anymore (as the project file is now a fairly stable XML file). Also, it would be possible to bump version numbers immediately after a snapshot (alpha, beta) release, rather than just before. I tend to forget that I have to do 4, and remember at earliest when you announce the freeze. > (*) The names 'Fred', 'Martin', and 'I' are just the names of the > current set of release people - feel free to substitute roles in > there instead. I think it should be possible to come up with a release process that combines Fred's and my role, wrt. documentation creation (I create the chm file); theoretically, whoever builds the documentation should be able to do so on Windows as well. Also, I think it would be good to eliminate Fred's role altogether: the documentation build process should be much more automatic, and less relying on third-party tools. I think aiming at rewriting ht2html in Python for 2.5 would be a worthwhile goal (I have dropped the idea that conversion to xml would be worthwhile). Then, the release manager could trivially build the documentation. For that to work, it is necessary that the documentation builds out of the box; for that to happen, it is necessary that a broad audience can build the documentation, so that problems are detected long before the release (i.e. short after a checkin - or better yet, before). For the PostScript/PDF release, one certainly needs TeX, but that is free software. The same could be said about the Windows release, except that we stand little chance of ever dropping the requirement for special, non-free tools (Windows, MSVC). However, anybody possessing these tools and owning a sufficiently powerful machine should be able to release Python. Regards, Martin From martin at v.loewis.de Thu Nov 4 00:20:22 2004 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Thu Nov 4 00:20:16 2004 Subject: [Python-Dev] interlocking dependencies on the path to a release In-Reply-To: <4189661E.7040002@ocf.berkeley.edu> References: <4188BE21.6040205@interlink.com.au> <4189661E.7040002@ocf.berkeley.edu> Message-ID: <418967B6.4040106@v.loewis.de> Brett C. wrote: > Best solution I can think of is somehow come up with a way to remove the > need for Martin to do 4 somehow. This shouldn't be that bad as it currently is. *Anybody* could actually do this - there is no need to do it within the release process (except perhaps during a1). I don't see a problem with the CVS reporting numbers that wait for a release a few weeks. Regards, Martin From martin at v.loewis.de Thu Nov 4 00:26:59 2004 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Thu Nov 4 00:26:55 2004 Subject: [Python-Dev] TRUNK FROZEN for 2.4b2 release from 0000UTC 3rd November (tomorrrow) In-Reply-To: <103B4788-2DEE-11D9-8F1A-000A95BA5446@redivi.com> References: <41888D8E.5050705@interlink.com.au> <41896256.1040104@ocf.berkeley.edu> <103B4788-2DEE-11D9-8F1A-000A95BA5446@redivi.com> Message-ID: <41896943.9000906@v.loewis.de> Bob Ippolito wrote: > Argh! It's nothing crazy, it removes incorrect linker flags and > delegates two Mac-specific API functions to where they belong. I think Brett's thinking is that if this was a serious problem, it should have been fixed months ago. The fact that nobody bothered pushing that change before 2.4b1 indicates that the problem is not serious. As an incompatible change that fixes a non-serious problem, it shouldn't be applied before 2.5, in accordance with PEP 5 (which says that an incompatible change must see a deprecation first). That said, the release manager has said what he thinks about the issue, so anybody with commit privileges please do what they think is needed (I personally don't care much enough beyond writing this message). Regards, Martin From anthony at python.org Thu Nov 4 00:50:50 2004 From: anthony at python.org (Anthony Baxter) Date: Thu Nov 4 00:46:30 2004 Subject: [Python-Dev] RELEASED Python 2.4, beta 2 Message-ID: <41896EDA.5020805@python.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On behalf of the Python development team and the Python community, I'm happy to announce the second beta of Python 2.4. Python 2.4b2 is a beta release. We'd greatly appreciate it if you could download it, kick the tires and let us know of any problems you find, but it is probably not suitable for production usage. ~ http://www.python.org/2.4 Notable changes in beta2 include another bug fix in the intersection of weakrefs and the garbage collector, time.strptime() correctly handling %U and %W arguments, and a fix for a problem of old source code being cached and shown in tracebacks. There's a number of other bugfixes as well, see either the highlights, the What's New in Python 2.4, or the detailed NEWS file -- all available from the Python 2.4 webpage. This is the second beta release of Python 2.4. Python 2.4 is now in the beta part of the release cycle - there should be few or no new features, merely bug fixes. From here, we plan to have a release candidate in a couple of weeks, and a final release at the start of December - but obviously this plan is subject to change, based on any problems that might crop up. Please log any problems you have with this release in the SourceForge bug tracker (noting that you're using 2.4b2): ~ http://sourceforge.net/bugs/?group_id=5470 Enjoy the new release, Anthony Anthony Baxter anthony@python.org Python Release Manager (on behalf of the entire python-dev team) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFBiW7YDt3F8mpFyBYRAq7DAKCskVfPO4LEQlC3zijupOnd9snCWACgpMHX bH7xepODsyo1115TMQ9CQkw= =0UOq -----END PGP SIGNATURE----- From anthony at interlink.com.au Thu Nov 4 00:52:31 2004 From: anthony at interlink.com.au (Anthony Baxter) Date: Thu Nov 4 00:48:14 2004 Subject: [Python-Dev] TRUNK FROZEN for 2.4b2 release from 0000UTC 3rd November (tomorrrow) In-Reply-To: <103B4788-2DEE-11D9-8F1A-000A95BA5446@redivi.com> References: <41888D8E.5050705@interlink.com.au> <41896256.1040104@ocf.berkeley.edu> <103B4788-2DEE-11D9-8F1A-000A95BA5446@redivi.com> Message-ID: <41896F3F.8090803@interlink.com.au> Bob Ippolito wrote: > Argh! It's nothing crazy, it removes incorrect linker flags and > delegates two Mac-specific API functions to where they belong. I asked this question on #macpython, but didn't get a response - I understand the costs for removing this are slight, but I'm not sure what the benefits of not linking the frameworks in are? Anyone? From bob at redivi.com Thu Nov 4 01:03:56 2004 From: bob at redivi.com (Bob Ippolito) Date: Thu Nov 4 01:04:03 2004 Subject: [Python-Dev] TRUNK FROZEN for 2.4b2 release from 0000UTC 3rd November (tomorrrow) In-Reply-To: <41896943.9000906@v.loewis.de> References: <41888D8E.5050705@interlink.com.au> <41896256.1040104@ocf.berkeley.edu> <103B4788-2DEE-11D9-8F1A-000A95BA5446@redivi.com> <41896943.9000906@v.loewis.de> Message-ID: <051E8585-2DF5-11D9-8F1A-000A95BA5446@redivi.com> On Nov 3, 2004, at 18:26, Martin v. L?wis wrote: > Bob Ippolito wrote: >> Argh! It's nothing crazy, it removes incorrect linker flags and >> delegates two Mac-specific API functions to where they belong. > > I think Brett's thinking is that if this was a serious problem, > it should have been fixed months ago. The fact that nobody bothered > pushing that change before 2.4b1 indicates that the problem is not > serious. As an incompatible change that fixes a non-serious problem, > it shouldn't be applied before 2.5, in accordance with PEP 5 > (which says that an incompatible change must see a deprecation first). The thing is that the incompatible change is going in, but the compatible changes (the reason for the incompatible change) are not. This is very peculiar. -bob From bob at redivi.com Thu Nov 4 01:14:31 2004 From: bob at redivi.com (Bob Ippolito) Date: Thu Nov 4 01:14:40 2004 Subject: [Python-Dev] TRUNK FROZEN for 2.4b2 release from 0000UTC 3rd November (tomorrrow) In-Reply-To: <41896F3F.8090803@interlink.com.au> References: <41888D8E.5050705@interlink.com.au> <41896256.1040104@ocf.berkeley.edu> <103B4788-2DEE-11D9-8F1A-000A95BA5446@redivi.com> <41896F3F.8090803@interlink.com.au> Message-ID: <80269A7A-2DF6-11D9-8F1A-000A95BA5446@redivi.com> On Nov 3, 2004, at 18:52, Anthony Baxter wrote: > Bob Ippolito wrote: >> Argh! It's nothing crazy, it removes incorrect linker flags and >> delegates two Mac-specific API functions to where they belong. > > I asked this question on #macpython, but didn't get a response - I > understand the costs for removing this are slight, but I'm not sure > what the benefits of not linking the frameworks in are? Anyone? I don't see your question in my backlog of #macpython, my client must have been disconnected at that time? It should shrink the memory footprint of Python and cause it to start up a bit faster (unsure if this difference is going to be very measurable). It might also produce a binary that's compatible with both Darwin and Mac OS X (untested, I have no Darwin installation). -bob From Scott.Daniels at Acm.Org Thu Nov 4 01:33:02 2004 From: Scott.Daniels at Acm.Org (Scott David Daniels) Date: Thu Nov 4 01:31:49 2004 Subject: [Python-Dev] Re: RELEASED Python 2.4, beta 2 In-Reply-To: <41896EDA.5020805@python.org> References: <41896EDA.5020805@python.org> Message-ID: Anthony Baxter wrote: > On behalf of the Python development team and the Python community, I'm > happy to announce the second beta of Python 2.4. Congratulations, another gold star. -- -- Scott David Daniels Scott.Daniels@Acm.Org From jcarlson at uci.edu Thu Nov 4 01:52:27 2004 From: jcarlson at uci.edu (Josiah Carlson) Date: Thu Nov 4 02:00:45 2004 Subject: [Python-Dev] previously discussed binhex additions Message-ID: <20041103160824.F7F2.JCARLSON@uci.edu> Since it looks as though we're coming down to the wire on Python 2.4, I thought I would mention the previously discussed binhex additions. If desired, I would implement the long2bytes and bytes2long functions with documentation and test cases as described a month ago by Tim Peters: http://mail.python.org/pipermail/python-dev/2004-October/049206.html I could have it done this Saturday evening for testing/checking during Sunday's bug day. - Josiah From anthony at interlink.com.au Thu Nov 4 04:13:33 2004 From: anthony at interlink.com.au (Anthony Baxter) Date: Thu Nov 4 04:13:58 2004 Subject: [Python-Dev] Re: PEP 336, "Make None Callable", by Andrew McClelland In-Reply-To: References: Message-ID: <41899E5D.2080303@interlink.com.au> > Abstract > > None should be a callable object that when called with any > arguments has no side effect and returns None. My response to this is simply "yuck". This is a hack, abd I don't think it's worthwhile. If you want to test for None, test for None. Similarly, if you want a dictionary lookup to default to a no-op method, there's a perfectly simple way to spell it now: def defaultNoopMethod(*args, **kwargs): pass somedict.get(key, defaultNoopMethod) You can even do this as a one-liner using a lambda if you want. Anthony -- Anthony Baxter It's never too late to have a happy childhood. From tim.peters at gmail.com Thu Nov 4 04:25:41 2004 From: tim.peters at gmail.com (Tim Peters) Date: Thu Nov 4 04:25:43 2004 Subject: [Python-Dev] Re: PEP 336, "Make None Callable", by Andrew McClelland In-Reply-To: <41899E5D.2080303@interlink.com.au> References: <41899E5D.2080303@interlink.com.au> Message-ID: <1f7befae0411031925522b6bb@mail.gmail.com> [Anthony Baxter] >> Abstract >> >> None should be a callable object that when called with any >> arguments has no side effect and returns None. > My response to this is simply "yuck". This is a hack, abd I > don't think it's worthwhile. Maybe it's not a coincidence that it's listed in the PEP index next to "Reject Foolish Indentation" <0.9 wink>. IMO, it's worse than not worthwhile: it would be actively bad to implement this. TypeError: 'NoneType' object is not callable is a frequent runtime occurrence now, and performs a valuable service when it happens by correctly pointing out a programming error. Python's None isn't meant to be neutral -- it's meant to mean "nothing is there", and supplying nothing where something is required is a logic error. From anthony at interlink.com.au Thu Nov 4 04:29:37 2004 From: anthony at interlink.com.au (Anthony Baxter) Date: Thu Nov 4 04:42:12 2004 Subject: [Python-Dev] TRUNK UNFROZEN Message-ID: <4189A221.4020306@interlink.com.au> The trunk is open again for checkins. As before, we're in feature-freeze mode. Next release, which will hopefully be 2.4rc1, in 2 weeks time. -- Anthony Baxter It's never too late to have a happy childhood. From bac at OCF.Berkeley.EDU Thu Nov 4 05:24:53 2004 From: bac at OCF.Berkeley.EDU (Brett C.) Date: Thu Nov 4 05:25:11 2004 Subject: [Python-Dev] TRUNK FROZEN for 2.4b2 release from 0000UTC 3rd November (tomorrrow) In-Reply-To: <051E8585-2DF5-11D9-8F1A-000A95BA5446@redivi.com> References: <41888D8E.5050705@interlink.com.au> <41896256.1040104@ocf.berkeley.edu> <103B4788-2DEE-11D9-8F1A-000A95BA5446@redivi.com> <41896943.9000906@v.loewis.de> <051E8585-2DF5-11D9-8F1A-000A95BA5446@redivi.com> Message-ID: <4189AF15.9060407@ocf.berkeley.edu> Bob Ippolito wrote: > > On Nov 3, 2004, at 18:26, Martin v. L?wis wrote: > >> Bob Ippolito wrote: >> >>> Argh! It's nothing crazy, it removes incorrect linker flags and >>> delegates two Mac-specific API functions to where they belong. >> >> >> I think Brett's thinking is that if this was a serious problem, >> it should have been fixed months ago. The fact that nobody bothered >> pushing that change before 2.4b1 indicates that the problem is not >> serious. As an incompatible change that fixes a non-serious problem, >> it shouldn't be applied before 2.5, in accordance with PEP 5 >> (which says that an incompatible change must see a deprecation first). > Exactly. It's too late in the release cycle for me to put it in unless Anthony says it is okay. > > The thing is that the incompatible change is going in, but the > compatible changes (the reason for the incompatible change) are not. > This is very peculiar. > Not really. Only one function is being removed. The function rearrangement is not under discussion here. Plus there is the issue of testing. I obviously checked it out and it seems to work, but this is build stuff which can be touchy. If Anthony clears applying all the full patch I will, but otherwise I am playing it safe and waiting until 2.5 . -Brett From python at rcn.com Thu Nov 4 05:54:14 2004 From: python at rcn.com (Raymond Hettinger) Date: Thu Nov 4 05:57:08 2004 Subject: [Python-Dev] previously discussed binhex additions In-Reply-To: <20041103160824.F7F2.JCARLSON@uci.edu> Message-ID: <002801c4c22a$6e4a6200$e841fea9@oemcomputer> > Since it looks as though we're coming down to the wire on Python 2.4, I > thought I would mention the previously discussed binhex additions. Too late for Py2.4. Bugfixes only. Not too early to submit a Py2.5 patch. Raymond From anthony at interlink.com.au Thu Nov 4 05:58:40 2004 From: anthony at interlink.com.au (Anthony Baxter) Date: Thu Nov 4 05:59:14 2004 Subject: [Python-Dev] TRUNK FROZEN for 2.4b2 release from 0000UTC 3rd November (tomorrrow) In-Reply-To: <4189AF15.9060407@ocf.berkeley.edu> References: <41888D8E.5050705@interlink.com.au> <41896256.1040104@ocf.berkeley.edu> <103B4788-2DEE-11D9-8F1A-000A95BA5446@redivi.com> <41896943.9000906@v.loewis.de> <051E8585-2DF5-11D9-8F1A-000 Message-ID: <4189B700.4010004@interlink.com.au> Brett C. wrote: > Not really. Only one function is being removed. The function > rearrangement is not under discussion here. Plus there is the issue of > testing. I obviously checked it out and it seems to work, but this is > build stuff which can be touchy. > > If Anthony clears applying all the full patch I will, but otherwise I am > playing it safe and waiting until 2.5 . Bear in mind that we've had _no_ macpython releases in the 2.4 cycle so far, that I'm aware of. This is really a platform-specific build issue. From python at rcn.com Thu Nov 4 06:06:10 2004 From: python at rcn.com (Raymond Hettinger) Date: Thu Nov 4 06:09:12 2004 Subject: [Python-Dev] TRUNK FROZEN for 2.4b2 release from 0000UTC 3rdNovember (tomorrrow) In-Reply-To: <051E8585-2DF5-11D9-8F1A-000A95BA5446@redivi.com> Message-ID: <000001c4c22c$1daf6500$e841fea9@oemcomputer> [Bob Ippolito] > The thing is that the incompatible change is going in, but the > compatible changes (the reason for the incompatible change) are not. > This is very peculiar. [Anthony] > Bear in mind that we've had _no_ macpython releases in the 2.4 cycle > so far, that I'm aware of. This is really a platform-specific build > issue. Poor Bob, this reasonable request has been kicked around too much. It is a simple thing that strips unnecessary stuff out of the build. Will someone who has a Mac please apply. Raymond From tim.peters at gmail.com Thu Nov 4 06:25:32 2004 From: tim.peters at gmail.com (Tim Peters) Date: Thu Nov 4 06:25:35 2004 Subject: [Python-Dev] Re: weakref gc semantics In-Reply-To: <1f7befae04110220402077a6fa@mail.gmail.com> References: <1f7befae04110220402077a6fa@mail.gmail.com> Message-ID: <1f7befae041103212576c59c42@mail.gmail.com> [Tim] > This example bothers me a little, under current Python CVS: > > """ > import gc, weakref > > def C_gone(ignored): > print "An object of type C went away." > > class C: > def __init__(self): > self.wr = weakref.ref(self, C_gone) > > print "creating non-cyclic C instance" > c = C() > > print "creating cyclic C instance and destroying old one" > c = C() # triggers the print > c.loop = c > > print "getting rid of the cyclic one" > c = None # doesn't trigger the print > gc.collect() # ditto > """ Recapping, it bothers me because the callback doesn't trigger now when c is part of cyclic trash, but if c.wr were an instance with a __del__ method instead, the __del__ method *would* trigger. There are (at least) two easy-to-code and pretty-easy-to-explain ways to get that callback invoked safely. One I sketched last time, and is in the attached patch-callback.txt. (Patches here just have gcmodule.c code changes, no corresponding changes to comments.) The difference is that it invokes a callback on a weakref to trash iff the callback is reachable, instead of invoking a callback on a weakref to trash iff the weakref it's attached to is reachable. All the tests we've accumulated still pass with this change, and the example above does trigger a second print. Another approach is in the attached patch-finalizer.txt. This is more (I think) like what Neil was aiming at last week, and amounts to changing has_finalizer() to return true when it sees a weakref with a callback. Then the weakref, and everything reachable from it, gets moved to the reachable set. After that, no callback can access an unreachable object directly, so callbacks are safe to call on that count. We still (and in the other patch too) clear all weakrefs to trash before breaking cycles, so callbacks can't resurrect trash via active weakrefs either. But in the patch-finalizer case, the callbacks attached to weakrefs moved to the reachable set no longer get invoked "artificially" (forced by gc) -- they trigger iff their referents eventually go away. Some current tests fail with the patch-finalizer approach, but for shallow reasons: fewer callbacks get invoked, and some of the tests currently use "global" (reachable) weakref callbacks as a way to verify that gc really did clean up cyclic trash. Those stop getting invoked. Some of the tests use bound method objects as callbacks, and when a weakref contains a callback that's a bound method object, and the weakref gets moved to the reachable set, its callback gets moved there too, and so the instance wrt which the callback is a bound method becomes reachable too, and so the class of that instance also becomes reachable. As a result, gc doesn't get rid of any of that stuff, so the "external" callbacks never trigger. Instead, the weakrefs with the bound-method callbacks end up in gc.garbage. I don't like that, because if it's possible to get rid of __del__ methods, I'd really like to see gc.garbage go away too. Nothing we've done with weakrefs so far can add anything to gc.garbage, so I like them better on that count. Pragmatically, sticking a weakref in gc.garbage isn't of much use to the end-user now either, because a weakref's callback is neither clearable nor even discoverable now at the Python level. But that could be changed too. What I'm missing is a pile of practical use cases to distinguish these. Let's look at weak value dicts, for reasons that will become clear. An entry in a WVD d now is of the form key: W where W is an instance of a subclass of weakref.ref, and W has the associated key as an attribute. Every value in d shares the same callback, set up by WVD.__init__(): def __init__(self, *args, **kw): ... def remove(wr, selfref=ref(self)): self = selfref() if self is not None: del self.data[wr.key] self._remove = remove So the callback has a weakref to d, and when it's invoked extracts the specific key from the weakref instance and uses that to delete the appropriate key: W entry from d via the shared callback's own weakref to d. Now it's not clear *why* the callback has a weakref to d. It *could* have been written like this instead: def remove(wr): del self.data[wr.key] In fact, at one time it was written in that kind of way. Rev 1.13 of weakref.py changed it to use a weakref to self, and the motivations in the patch that started this are feeble: http://www.python.org/sf/417795 "It's bad to rely on the garbage collector" and "this could lead to uncollectable cycles if a subclass of Weak*Dictionary defines __del__". The proper responses were "no, it isn't" and "insane code deserves whatever it gets" <0.5 wink>. Anyway, if WVD *had* been left simple(r), it would be relevant to the choices above: if WVD d became part of cyclic trash, patch-finalizer would move all its weakrefs to the reachable set, and then d itself would be reachable too (via the shared callback's strong reference to self). As a result, none of the callbacks would trigger, and d would "leak" (it wouldn't get cleaned up, and wouldn't show up in gc.garbage either -- it would end up in an older generation, clogging gc forever after because it would remain forever after reachable from its (resurrected) weakrefs in gc.garbage). Under patch-callback, d would still go away (the simplest way to understand why is just that d *is* in cyclic trash, and patch-callback never moves anything to the reachable set because of weakrefs or weakref callbacks). The *current* implementation of WVD doesn't have this problem under patch-finalizer. If d is part of cyclic trash, all its weakrefs get moved to the reachable set, but d isn't directly reachable from their shared callback, so d is not moved to the reachable set. d's tp_clear() gets invoked by gc in its cycle-breaking phase, and that decrefs all of d's weakrefs that were moved to the unreachable set, and they go away then (without triggering their callbacks) via the normal refcount route. The point is that this is all pretty subtle, and it bothers me that "the obvious" way to implement WVD (the pre-patch-417795 way) would lead to a worse outcome under patch-finalizer, so I also fear that Python's current weakref users may be doing similar things now that would also suffer under patch-finalizer. OTOH, there's something conceptually nice about patch-finalizer -- it is the easiest approach to explain (well, except for approaches that allow segfaults to occur ...). On the third hand, gc.garbage appears poorly understood by users now, and patch-finalizer is actually easy to explain only to those who already understand gc.garbage. -------------- next part -------------- Index: Modules/gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.80 diff -u -r2.80 gcmodule.c --- Modules/gcmodule.c 1 Nov 2004 16:39:57 -0000 2.80 +++ Modules/gcmodule.c 4 Nov 2004 03:37:50 -0000 @@ -566,9 +566,8 @@ * to imagine how calling it later could create a problem for us. wr * is moved to wrcb_to_call in this case. */ - if (IS_TENTATIVELY_UNREACHABLE(wr)) + if (IS_TENTATIVELY_UNREACHABLE(wr->wr_callback)) continue; - assert(IS_REACHABLE(wr)); /* Create a new reference so that wr can't go away * before we can process it again. @@ -577,9 +576,8 @@ /* Move wr to wrcb_to_call, for the next pass. */ wrasgc = AS_GC(wr); - assert(wrasgc != next); /* wrasgc is reachable, but - next isn't, so they can't - be the same */ + if (wrasgc == next) + next = wrasgc->gc.gc_next; gc_list_move(wrasgc, &wrcb_to_call); } } @@ -593,7 +591,6 @@ gc = wrcb_to_call.gc.gc_next; op = FROM_GC(gc); - assert(IS_REACHABLE(op)); assert(PyWeakref_Check(op)); wr = (PyWeakReference *)op; callback = wr->wr_callback; @@ -621,6 +618,7 @@ if (wrcb_to_call.gc.gc_next == gc) { /* object is still alive -- move it */ gc_list_move(gc, old); + gc->gc.gc_refs = GC_REACHABLE; } else ++num_freed; -------------- next part -------------- Index: Modules/gcmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/gcmodule.c,v retrieving revision 2.80 diff -u -r2.80 gcmodule.c --- Modules/gcmodule.c 1 Nov 2004 16:39:57 -0000 2.80 +++ Modules/gcmodule.c 4 Nov 2004 03:27:10 -0000 @@ -413,6 +413,9 @@ assert(delstr != NULL); return _PyInstance_Lookup(op, delstr) != NULL; } + else if (PyWeakref_Check(op) && + ((PyWeakReference *)op)->wr_callback != NULL) + return 1; else if (PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) return op->ob_type->tp_del != NULL; else @@ -566,10 +569,6 @@ * to imagine how calling it later could create a problem for us. wr * is moved to wrcb_to_call in this case. */ - if (IS_TENTATIVELY_UNREACHABLE(wr)) - continue; - assert(IS_REACHABLE(wr)); - /* Create a new reference so that wr can't go away * before we can process it again. */ From jcarlson at uci.edu Thu Nov 4 09:43:07 2004 From: jcarlson at uci.edu (Josiah Carlson) Date: Thu Nov 4 09:51:01 2004 Subject: [Python-Dev] previously discussed binhex additions In-Reply-To: <002801c4c22a$6e4a6200$e841fea9@oemcomputer> References: <20041103160824.F7F2.JCARLSON@uci.edu> <002801c4c22a$6e4a6200$e841fea9@oemcomputer> Message-ID: <20041104004215.F809.JCARLSON@uci.edu> "Raymond Hettinger" wrote: > > > Since it looks as though we're coming down to the wire on Python 2.4, > I > > thought I would mention the previously discussed binhex additions. > > Too late for Py2.4. > Bugfixes only. > Not too early to submit a Py2.5 patch. I'll wait until 2.4 is released then. If there's no rush, then I guess I'm not in one. - Josiah From FBatista at uniFON.com.ar Thu Nov 4 13:48:34 2004 From: FBatista at uniFON.com.ar (Batista, Facundo) Date: Thu Nov 4 13:50:13 2004 Subject: [Python-Dev] Policy about old Python versions Message-ID: Sometimes, reviewing bugs, I found some ones referring problems about old Python versions. Is there a policy about supporting old Python versions? At some time an old version becomes "deprecated"? For example, an open bug about a problem of Python 2.1, that is solved in Python 2.2 and subsequents, when should be closed? Thank you! . Facundo From walter at livinglogic.de Thu Nov 4 13:54:51 2004 From: walter at livinglogic.de (=?ISO-8859-1?Q?Walter_D=F6rwald?=) Date: Thu Nov 4 13:54:56 2004 Subject: [Python-Dev] Code coverage tool updated In-Reply-To: <1f7befae04110210537c35e514@mail.gmail.com> References: <41864572.4000806@livinglogic.de> <16774.45652.835103.327656@montanaro.dyndns.org> <4187765D.3000705@livinglogic.de> <4187CA1C.9050508@livinglogic.de> <1f7befae04110210537c35e514@mail.gmail.com> Message-ID: <418A269B.6010207@livinglogic.de> Tim Peters wrote: > [Walter D?rwald] > >>This doesn't help. The following assert in trace.py raises >>an AssertionError: >> assert filename.endswith('.py') >> >>[...] >> >>So what is ? > > I haven't followed this thread, but can answer that question literally > : it's code synthesized for the seventh doctest example in > Lib/_threading_local.py's module docstring. The file name is > constructed by this line in doctest.py: > > # Use a special filename for compile(), so we can retrieve > # the source code during interactive debugging (see > # __patched_linecache_getlines). > filename = '' % (test.name, examplenum) I guess it's not worth it to try to fix doctest/trace to provide sourcecode for doctest code, but IMHO trace should be able to survive a doctest. Removing the assert statement, so that trace.py runs to completion shows a different problem: There are only 32 files covered according to the trace output. The complete test log can be found here: http://styx.livinglogic.de/~walter/brokentrace.txt The trace call looked like this: ./python ../../../trace.py --count --summary --missing Lib/test/regrtest.py with ../../../trace.py being the trace.py from current CVS with the assert statement removed. So am I doing something wrong or is trace.py broken? Bye, Walter D?rwald From aahz at pythoncraft.com Thu Nov 4 15:16:32 2004 From: aahz at pythoncraft.com (Aahz) Date: Thu Nov 4 15:16:35 2004 Subject: [Python-Dev] Policy about old Python versions In-Reply-To: References: Message-ID: <20041104141632.GA27459@panix.com> On Thu, Nov 04, 2004, Batista, Facundo wrote: > > Sometimes, reviewing bugs, I found some ones referring problems about > old Python versions. > > Is there a policy about supporting old Python versions? At some time > an old version becomes "deprecated"? > > For example, an open bug about a problem of Python 2.1, that is solved > in Python 2.2 and subsequents, when should be closed? As soon as the new version is released, if there is no bugfix planned for that issue. Two versions later (i.e. 2.3 in this case) even if it looks like it ought to be fixed in 2.1 -- we haven't been doing bugfixes more than one version old. -- Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/ WiFi is the SCSI of the 21st Century -- there are fundamental technical reasons for sacrificing a goat. (with no apologies to John Woods) From misa at redhat.com Thu Nov 4 16:38:19 2004 From: misa at redhat.com (Mihai Ibanescu) Date: Thu Nov 4 16:38:23 2004 Subject: [Python-Dev] Overflow in socketmodule.c? Message-ID: <20041104153819.GS13571@abulafia.devel.redhat.com> Hello, Can someone confirm this is indeed an overflow by one in socketmodule.c? static PyObject * socket_inet_ntop(PyObject *self, PyObject *args) { int af; char* packed; int len; const char* retval; #ifdef ENABLE_IPV6 char ip[MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) + 1]; #else char ip[INET_ADDRSTRLEN + 1]; #endif /* Guarantee NUL-termination for PyString_FromString() below */ memset((void *) &ip[0], '\0', sizeof(ip) + 1); If it is I'll go ahead and file it. Thanks, Misa From gjc at inescporto.pt Thu Nov 4 16:56:07 2004 From: gjc at inescporto.pt (Gustavo J. A. M. Carneiro) Date: Thu Nov 4 16:56:30 2004 Subject: [Python-Dev] Overflow in socketmodule.c? In-Reply-To: <20041104153819.GS13571@abulafia.devel.redhat.com> References: <20041104153819.GS13571@abulafia.devel.redhat.com> Message-ID: <1099583767.31972.15.camel@spectrum.inescn.pt> Qui, 2004-11-04 ?s 10:38 -0500, Mihai Ibanescu escreveu: > Hello, > > Can someone confirm this is indeed an overflow by one in socketmodule.c? > > > static PyObject * > socket_inet_ntop(PyObject *self, PyObject *args) > { > int af; > char* packed; > int len; > const char* retval; > #ifdef ENABLE_IPV6 > char ip[MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) + 1]; > #else > char ip[INET_ADDRSTRLEN + 1]; > #endif > > /* Guarantee NUL-termination for PyString_FromString() below */ > memset((void *) &ip[0], '\0', sizeof(ip) + 1); > > > If it is I'll go ahead and file it. Indeed, looks like buffer overflow to me.. > > Thanks, > Misa > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: http://mail.python.org/mailman/options/python-dev/gjc%40inescporto.pt -- Gustavo J. A. M. Carneiro The universe is always one step beyond logic. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3086 bytes Desc: not available Url : http://mail.python.org/pipermail/python-dev/attachments/20041104/2ddbd9ea/smime.bin From tim at zope.com Thu Nov 4 18:19:54 2004 From: tim at zope.com (Tim Peters) Date: Thu Nov 4 18:20:01 2004 Subject: [Python-Dev] patch-finalizer vs Zope3 Message-ID: <20041104171957.A0C633B8038@smtp.zope.com> FYI, and without taking time for non-trivial analysis. I ran the non-ZEO Zope3 tests with a Python patched to treat weakrefs with callbacks as reachable (this was patch-finalizer.txt, attached to a msg I sent to python-dev last night). The first test to leave stuff in gc.garbage then: The following test left garbage: test_created (bugtracker.browser.tests.test_bug.BugBaseViewTest) 65 where 65 is len(gc.garbage) after the test finished. From there it climbed steadily. By the time the functional tests ended, the Python process was about 575MB, and gc.garbage contained 324,056 weakrefs. I haven't investigated why it happens, but that it *does* happen in an app that believes it's well-behaved suggests that "practicality beats purity" would win in the end (i.e., no matter how elegant the approach, if it's too hard to live with, it won't fly). Of course nothing is left in gc.garbage here under 2.3.4 or 2.4b2, or under 2.4b2 + patch-callback. Under the latter, the Python process tops out at about 150MB. These were all with debug builds of Python, so process sizes are substantially larger than with release builds (the object header is 2 pointers bigger in a debug build, and every object gotten via pymalloc grows 16 debug pad bytes, and everything gotten via PyMem_XYZ() gets pymalloc debug padding too). From jim at zope.com Thu Nov 4 18:24:53 2004 From: jim at zope.com (Jim Fulton) Date: Thu Nov 4 18:24:57 2004 Subject: [Python-Dev] Re: patch-finalizer vs Zope3 In-Reply-To: <20041104171957.A0C633B8038@smtp.zope.com> References: <20041104171957.A0C633B8038@smtp.zope.com> Message-ID: <418A65E5.6070403@zope.com> Tim Peters wrote: > FYI, and without taking time for non-trivial analysis. I ran the non-ZEO > Zope3 tests with a Python patched to treat weakrefs with callbacks as > reachable (this was patch-finalizer.txt, attached to a msg I sent to > python-dev last night). > > The first test to leave stuff in gc.garbage then: > > The following test left garbage: > test_created (bugtracker.browser.tests.test_bug.BugBaseViewTest) > 65 > > where 65 is len(gc.garbage) after the test finished. From there it climbed > steadily. By the time the functional tests ended, the Python process was > about 575MB, and gc.garbage contained 324,056 weakrefs. > > I haven't investigated why it happens, but that it *does* happen in an app > that believes it's well-behaved It's all a question of your definition of good behavior. ;) > suggests that "practicality beats purity" > would win in the end (i.e., no matter how elegant the approach, if it's too > hard to live with, it won't fly). Treating weakrefs with callbacks as reachable is a *big* change, though in subtle ways. I agree that this is too big for 2.4, but I *do* think it should be considered for 2.5. Jim -- Jim Fulton mailto:jim@zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org From nas at arctrix.com Thu Nov 4 18:38:35 2004 From: nas at arctrix.com (Neil Schemenauer) Date: Thu Nov 4 18:38:39 2004 Subject: [Python-Dev] Re: weakref gc semantics In-Reply-To: <1f7befae041103212576c59c42@mail.gmail.com> References: <1f7befae04110220402077a6fa@mail.gmail.com> <1f7befae041103212576c59c42@mail.gmail.com> Message-ID: <20041104173835.GA15004@mems-exchange.org> On Thu, Nov 04, 2004 at 12:25:32AM -0500, Tim Peters wrote: > One I sketched last time, and is in the attached patch-callback.txt. > (Patches here just have gcmodule.c code changes, no corresponding > changes to comments.) The difference is that it invokes a callback on > a weakref to trash iff the callback is reachable, instead of invoking > a callback on a weakref to trash iff the weakref it's attached to is > reachable. I like this idea best. I don't see why it should be hard to explain. Instead of saying: If you want the weakref callback to be invoked, ensure the WEAKREF outlives the referent. we say: If you want the weakref callback to be invoked, ensure the CALLBACK outlives the referent. I think there may be one small problem though. Callbacks get passed the weakref object. Doesn't that break the rule that trash should not be exposed to Python code while the collection is taking place? Neil From jim at zope.com Thu Nov 4 18:47:00 2004 From: jim at zope.com (Jim Fulton) Date: Thu Nov 4 18:47:08 2004 Subject: [Python-Dev] Re: weakref gc semantics In-Reply-To: <20041104173835.GA15004@mems-exchange.org> References: <1f7befae04110220402077a6fa@mail.gmail.com> <1f7befae041103212576c59c42@mail.gmail.com> <20041104173835.GA15004@mems-exchange.org> Message-ID: <418A6B14.8080206@zope.com> Neil Schemenauer wrote: > On Thu, Nov 04, 2004 at 12:25:32AM -0500, Tim Peters wrote: > >>One I sketched last time, and is in the attached patch-callback.txt. >>(Patches here just have gcmodule.c code changes, no corresponding >>changes to comments.) The difference is that it invokes a callback on >>a weakref to trash iff the callback is reachable, instead of invoking >>a callback on a weakref to trash iff the weakref it's attached to is >>reachable. > > > I like this idea best. I don't see why it should be hard to > explain. Instead of saying: > > If you want the weakref callback to be invoked, ensure the > WEAKREF outlives the referent. > > we say: > > If you want the weakref callback to be invoked, ensure the > CALLBACK outlives the referent. > > I think there may be one small problem though. Callbacks get passed > the weakref object. Doesn't that break the rule that trash should > not be exposed to Python code while the collection is taking place? Exactly, that's why I prefer the other approach. Jim -- Jim Fulton mailto:jim@zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org From misa at redhat.com Thu Nov 4 18:47:26 2004 From: misa at redhat.com (Mihai Ibanescu) Date: Thu Nov 4 18:47:29 2004 Subject: [Python-Dev] Overflow in socketmodule.c? In-Reply-To: <1099583767.31972.15.camel@spectrum.inescn.pt> References: <20041104153819.GS13571@abulafia.devel.redhat.com> <1099583767.31972.15.camel@spectrum.inescn.pt> Message-ID: <20041104174726.GT13571@abulafia.devel.redhat.com> On Thu, Nov 04, 2004 at 03:56:07PM +0000, Gustavo J. A. M. Carneiro wrote: > Qui, 2004-11-04 ?s 10:38 -0500, Mihai Ibanescu escreveu: > > Hello, > > > > Can someone confirm this is indeed an overflow by one in socketmodule.c? > > > > > > static PyObject * > > socket_inet_ntop(PyObject *self, PyObject *args) > > { > > int af; > > char* packed; > > int len; > > const char* retval; > > #ifdef ENABLE_IPV6 > > char ip[MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) + 1]; > > #else > > char ip[INET_ADDRSTRLEN + 1]; > > #endif > > > > /* Guarantee NUL-termination for PyString_FromString() below */ > > memset((void *) &ip[0], '\0', sizeof(ip) + 1); > > > > > > If it is I'll go ahead and file it. > > Indeed, looks like buffer overflow to me.. Filed as SF bug 105470 Misa From martin at v.loewis.de Thu Nov 4 18:51:56 2004 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Thu Nov 4 18:51:48 2004 Subject: [Python-Dev] Policy about old Python versions In-Reply-To: References: Message-ID: <418A6C3C.3050008@v.loewis.de> Batista, Facundo wrote: > Sometimes, reviewing bugs, I found some ones referring problems about old > Python versions. > > Is there a policy about supporting old Python versions? At some time an old > version becomes "deprecated"? > > For example, an open bug about a problem of Python 2.1, that is solved in > Python 2.2 and subsequents, when should be closed? It is (IMO) fine to close anything now that is fixed in 2.3 and newer. The proper "Resolution" is "Fixed", with a Comment "Fixed in 2.3". There likely will be one more 2.3 release, so you might not want to close something as "Fixed in 2.4" that is still incorrect in 2.3; instead, consider backporting the patch (we are all volunteers, so this is clearly not mandatory). If you find something is fixed in 2.4, but have no time to find out how precisely it was fixed, still leave a comment saying so. After the next 2.3 release, people are still free to backport to older branches - after all, distributors may chose to roll out patches collected even after the last release of some 2.x. However, in general, expect that 2.3 and older needs no further attention RSN, and "backporting" will mean "to 2.4". Regards, Martin From martin at v.loewis.de Thu Nov 4 19:05:28 2004 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Thu Nov 4 19:05:20 2004 Subject: [Python-Dev] Overflow in socketmodule.c? In-Reply-To: <20041104153819.GS13571@abulafia.devel.redhat.com> References: <20041104153819.GS13571@abulafia.devel.redhat.com> Message-ID: <418A6F68.8080304@v.loewis.de> Mihai Ibanescu wrote: > Can someone confirm this is indeed an overflow by one in socketmodule.c? Yes. With some luck (e.g. on x86 with gcc), it might not cause buffer overruns, as a) the compiler overallocates on the stack because of padding, anyway, and b) the overwriting might write into the next variable (i.e. retval), which is uninitialized at this point, anyway. Regards, Martin From tim at zope.com Thu Nov 4 19:38:38 2004 From: tim at zope.com (Tim Peters) Date: Thu Nov 4 19:38:43 2004 Subject: [Python-Dev] RE: patch-finalizer vs Zope3 In-Reply-To: <418A65E5.6070403@zope.com> Message-ID: <20041104183839.AABEF3B8038@smtp.zope.com> [Jim Fulton] > Treating weakrefs with callbacks as reachable is a *big* change, though > in subtle ways. It sure appears to have "more consequences" than I guessed it would. > I agree that this is too big for 2.4, but I *do* think it should be > considered for 2.5. Me too. It ensures that a callback is never ignored unless a referent definitely outlives a weakref with that callback, even at the cost of resurrecting trash weakrefs (to make their callbacks safe to call). "Definitely outlives" is usually easy to talk about in CPython because of refcount lifetime semantics, but hard to make sense of operationally without refcount semantics. When they're both in cyclic trash, a weakref and its referent both become unreachable truly at the same instant. The approach so far has then been to say (in effect): Fine, then it's legitimate to impose any linear order on death, and if we say the weakref dies first, then there's no issue remaining -- just as in non-cyclic trash, when a weakref dies before its referent, the wr's callback will never be invoked. That's defensible but not compelling. I'm still not sure any other approach is compelling either. patch-finalizer effectly reverses the current approach, saying: Fine, then it's legitimate to impose any linear order on death, and if we say the referent dies first, then there's no issue remaining -- just as in non-cyclic trash, when the referent dies before its weakref, the wr's callback will be invoked(*). (*) Except we have to resurrect the weakref to make this possible, and that may also end up resurrecting the referent, and then neither actually goes away, and so the callback doesn't actually get invoked either (although it may get invoked later, if the user fiddles with the stuff in gc.garbage enough to make that possible). All I can say is that the callback better be damned important to justify all the extra pain . still-seeking-use-cases-ly y'rs - tim From foom at fuhm.net Thu Nov 4 19:44:22 2004 From: foom at fuhm.net (James Y Knight) Date: Thu Nov 4 19:44:26 2004 Subject: [Python-Dev] weakref gc semantics In-Reply-To: <1f7befae04110220402077a6fa@mail.gmail.com> References: <1f7befae04110220402077a6fa@mail.gmail.com> Message-ID: <8AFE1902-2E91-11D9-AF2F-000A95A50FB2@fuhm.net> On Nov 2, 2004, at 11:40 PM, Tim Peters wrote: > a reachable callback can have visible effects, and there > really isn't ambiguity about which of c and W "dies first" (c does) in > the example. An unreachable callback function can also have visible effects. > The question is whether gc should really be looking at whether the > weakref *callback* is reachable, regardless of whether the weakref > itself is reachable (if the weakref is reachable, its callback is too, > and 2.4b2 invokes it -- the only case in question is the one in the > example, where the weakref and the weakref's referent are unreachable > but the weakref's callback is reachable). From what I'm hearing here, the following two pieces of code would then have different behavior under patch-callback: """ def C_gone(ignored): print "An object of type C went away." class C: def __init__(self): self.wr = weakref.ref(self, C_gone) """ and """ class C: def __init__(self): def C_gone(ignored): print "An object of type C went away." self.wr = weakref.ref(self, C_gone) """ If that's correct, it sounds like a bad idea to me. James From tim.peters at gmail.com Thu Nov 4 20:32:51 2004 From: tim.peters at gmail.com (Tim Peters) Date: Thu Nov 4 20:32:57 2004 Subject: [Python-Dev] Re: weakref gc semantics In-Reply-To: <20041104173835.GA15004@mems-exchange.org> References: <1f7befae04110220402077a6fa@mail.gmail.com> <1f7befae041103212576c59c42@mail.gmail.com> <20041104173835.GA15004@mems-exchange.org> Message-ID: <1f7befae04110411327af9bf3d@mail.gmail.com> [Neil Schemenauer] > I like this idea [patch-callback] best. I don't see why it should be hard to > explain. Instead of saying: > > If you want the weakref callback to be invoked, ensure the > WEAKREF outlives the referent. > > we say: > > If you want the weakref callback to be invoked, ensure the > CALLBACK outlives the referent. The former is accurate independent of whether we're talking about cyclic trash now, but that latter would not be. For example, def callback(ignore): print 'hi' class C: pass c = C() w = weakref.ref(c, callback) w = None c = None The callback outlives c, but the callback doesn't get invoked, because w didn't outlive c. The callback does get invoked if the order of the last two lines is swapped. It's easy to explain this in terms of which of {c, w} goes away first, but not in terms of callback's lifetime. > I think there may be one small problem though. Callbacks get passed > the weakref object. Doesn't that break the rule that trash should > not be exposed to Python code while the collection is taking place? That's why I'm not touching anything here again for 2.4 . For builtin weakrefs to trash, it doesn't matter -- they get cleared before gc invokes any callbacks, so the worst a callback on a builtin-weakref-to-trash-object could do with its argument is resurrect a weakref than returns None if you call it. BFD. But I think we could concoct tests where instances of a weakref subclass did arbitrary damage in callbacks, via attributes bound to trash objects. The current "invoke the callback iff the weakref is reachable" avoids getting in trouble there, and I had weakref subclasses in the back of my mind when "settling" for that. We should write some nasty tests of weakref subclasses with callbacks interacting with gc -- there aren't any now. From tim.peters at gmail.com Thu Nov 4 21:11:32 2004 From: tim.peters at gmail.com (Tim Peters) Date: Thu Nov 4 21:11:38 2004 Subject: [Python-Dev] weakref gc semantics In-Reply-To: <8AFE1902-2E91-11D9-AF2F-000A95A50FB2@fuhm.net> References: <1f7befae04110220402077a6fa@mail.gmail.com> <8AFE1902-2E91-11D9-AF2F-000A95A50FB2@fuhm.net> Message-ID: <1f7befae041104121160f2b4ec@mail.gmail.com> [James Y Knight] > An unreachable callback function can also have visible effects. Quite true -- it might even reformat your hard drives . > ... > From what I'm hearing here, the following two pieces of code would then > have different behavior under patch-callback: > > """ > def C_gone(ignored): > print "An object of type C went away." > > class C: > def __init__(self): > self.wr = weakref.ref(self, C_gone) > """ > > and > > """ > class C: > def __init__(self): > def C_gone(ignored): > print "An object of type C went away." > self.wr = weakref.ref(self, C_gone) > """ > > If that's correct, it sounds like a bad idea to me. Assuming you're assuming the same driver is getting used after these snippets, yes, under patch-callback an instance of C in cyclic trash in the first case would trigger the callback, but not in the second case. I don't know why you believe that's bad: perhaps you could articulate a precise set of rules for what would be "good"? Maybe that's even the set of rules Python 2.4b2 actually uses. They seem more or less arbitrary to me (and so do patch-callback's -- and so do patch-finalizer's). For example, you can fiddle your examples above to get the same kind of "hmm, in one case it does, in the other case it doesn't" outcome in 2.4b2 by manipulating whether the weakref is externally reachable, instead of manipulating the reachability of the callback. Is that change in *what* you fiddle essentially different, so that it's "not bad" to get different outcomes when weakref reachability is fiddled? I don't think it's obvious, but under patch-finalizer they both get the same outcome (the callback is invoked, and the weakref gets deallocated before gc.garbage gets built). OTOH, if you make C_gone a method of C, and use self.C_gone as the callback, then the outcome is different: then the callback doesn't get called, and c is actually resurrected under patch-finalizer, even in the driver's first print "creating non-cyclic C instance" c = C() case (although the print stmt is no longer truthful then). From barry at python.org Thu Nov 4 22:06:08 2004 From: barry at python.org (Barry Warsaw) Date: Thu Nov 4 22:06:18 2004 Subject: [Python-Dev] Re: interlocking dependencies on the path to a release In-Reply-To: <41896727.7030206@v.loewis.de> References: <4188BE21.6040205@interlink.com.au> <41896727.7030206@v.loewis.de> Message-ID: <1099602368.17767.77.camel@geddy.wooz.org> On Wed, 2004-11-03 at 18:17, "Martin v. L?wis" wrote: > I think aiming at rewriting ht2html > in Python for 2.5 would be a worthwhile goal (I have dropped the > idea that conversion to xml would be worthwhile). Did you mean the Doc/perl stuff instead of ht2html? The latter is already Python (but you knew that). > Then, the release manager could trivially build the documentation. > For that to work, it is necessary that the documentation builds out > of the box; for that to happen, it is necessary that a broad audience > can build the documentation, so that problems are detected long > before the release (i.e. short after a checkin - or better yet, > before). For the PostScript/PDF release, one certainly needs TeX, > but that is free software. Actually, building the html documentation isn't hard, and I generally do it whenever I'm making a change to .tex files. I may not always write Fred-happy markup but I try to make sure it's at least syntactically correct. It's also a useful thing to have around for when there's no net access. -Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 307 bytes Desc: This is a digitally signed message part Url : http://mail.python.org/pipermail/python-dev/attachments/20041104/cdd83d0e/attachment.pgp From greg at cosc.canterbury.ac.nz Fri Nov 5 01:45:15 2004 From: greg at cosc.canterbury.ac.nz (Greg Ewing) Date: Fri Nov 5 01:45:22 2004 Subject: [Python-Dev] Re: weakref gc semantics In-Reply-To: <20041104173835.GA15004@mems-exchange.org> References: <1f7befae04110220402077a6fa@mail.gmail.com> <1f7befae041103212576c59c42@mail.gmail.com> <20041104173835.GA15004@mems-exchange.org> Message-ID: <418ACD1B.9060000@cosc.canterbury.ac.nz> Neil Schemenauer wrote: > I think there may be one small problem though. Callbacks get passed > the weakref object. Doesn't that break the rule that trash should > not be exposed to Python code while the collection is taking place? Maybe the callback shouldn't be passed the weakref object? I don't see what good that does anyway, since the weakref is just an empty shell by then, isn't it? Greg From tim.peters at gmail.com Fri Nov 5 02:42:15 2004 From: tim.peters at gmail.com (Tim Peters) Date: Fri Nov 5 02:42:21 2004 Subject: [Python-Dev] Re: weakref gc semantics In-Reply-To: <418ACD1B.9060000@cosc.canterbury.ac.nz> References: <1f7befae04110220402077a6fa@mail.gmail.com> <1f7befae041103212576c59c42@mail.gmail.com> <20041104173835.GA15004@mems-exchange.org> <418ACD1B.9060000@cosc.canterbury.ac.nz> Message-ID: <1f7befae04110417421a072d75@mail.gmail.com> [Greg Ewing] > Maybe the callback shouldn't be passed the weakref object? > I don't see what good that does anyway, since the weakref > is just an empty shell by then, isn't it? If it's a builtin weakref object, yes. Weakref subclasses can add useful data, though. The way Python's weak dictionaries exploit this was explained earlier in the thread. From anthony at interlink.com.au Fri Nov 5 03:53:54 2004 From: anthony at interlink.com.au (Anthony Baxter) Date: Fri Nov 5 03:54:20 2004 Subject: [Python-Dev] Policy about old Python versions In-Reply-To: <20041104141632.GA27459@panix.com> References: <20041104141632.GA27459@panix.com> Message-ID: <418AEB42.8040306@interlink.com.au> Aahz wrote: > As soon as the new version is released, if there is no bugfix planned > for that issue. Two versions later (i.e. 2.3 in this case) even if it > looks like it ought to be fixed in 2.1 -- we haven't been doing bugfixes > more than one version old. That's not to say that if someone wants to cut a 2.2.4 or 2.1.4 I'm going to stop them. I've no interest in maintaining more than trunk plus the most recent maint branch. As for the original query, about what to do with bugs filed against 2.1.x - I'd suggest closing them. There's a vanishingly small chance that there will ever be another 2.1 or 2.2 release. Anthony From bac at OCF.Berkeley.EDU Fri Nov 5 06:37:53 2004 From: bac at OCF.Berkeley.EDU (Brett C.) Date: Fri Nov 5 06:38:14 2004 Subject: [Python-Dev] TRUNK FROZEN for 2.4b2 release from 0000UTC 3rdNovember (tomorrrow) In-Reply-To: <000001c4c22c$1daf6500$e841fea9@oemcomputer> References: <000001c4c22c$1daf6500$e841fea9@oemcomputer> Message-ID: <418B11B1.8000106@ocf.berkeley.edu> Raymond Hettinger wrote: > [Bob Ippolito] > >>The thing is that the incompatible change is going in, but the >>compatible changes (the reason for the incompatible change) are not. >>This is very peculiar. > > > [Anthony] > >>Bear in mind that we've had _no_ macpython releases in the 2.4 cycle >>so far, that I'm aware of. This is really a platform-specific build >>issue. > > > > Poor Bob, this reasonable request has been kicked around too much. > > It is a simple thing that strips unnecessary stuff out of the build. > Will someone who has a Mac please apply. > If someone else wants to apply it I have uploaded my revision of Bob's patch to SF (just make sure to run autoconf; patch is at http://www.python.org/sf/1035255 ). And I don't see why a Mac user needs to apply it since I have personally tested it to the best of my abilities. But as I have said I will not apply unless Anthony gives me a clear "yes" to do so. Call me over-cautious and annoying. -Brett From mwh at python.net Fri Nov 5 12:48:16 2004 From: mwh at python.net (Michael Hudson) Date: Fri Nov 5 12:48:18 2004 Subject: [Python-Dev] Re: weakref gc semantics In-Reply-To: <1f7befae04110411327af9bf3d@mail.gmail.com> (Tim Peters's message of "Thu, 4 Nov 2004 14:32:51 -0500") References: <1f7befae04110220402077a6fa@mail.gmail.com> <1f7befae041103212576c59c42@mail.gmail.com> <20041104173835.GA15004@mems-exchange.org> <1f7befae04110411327af9bf3d@mail.gmail.com> Message-ID: <2m7jp05xfj.fsf@starship.python.net> Tim Peters writes: [stuff i admittedly haven't thought terribly hard about] > The former is accurate independent of whether we're talking about > cyclic trash now, but that latter would not be. For example, > > def callback(ignore): > print 'hi' > > class C: > pass > > c = C() > w = weakref.ref(c, callback) > w = None > c = None > > The callback outlives c, but the callback doesn't get invoked, because > w didn't outlive c. The callback does get invoked if the order of the > last two lines is swapped. It's easy to explain this in terms of > which of {c, w} goes away first, but not in terms of callback's > lifetime. As disclaimed above, I haven't thought about this a great deal, but I would expect it to be the lifetime of the weakref which matters -- in the not-all-that-unlikley case of the callback not being a lambda or local function, it is *always* going to be reachable, and indeed is never going to die until the process exits... I take it the changes you're proposing aren't going to change the semantics of the quoted code? Cheers, mwh -- I'm about to search Google for contract assassins to go to Iomega and HP's programming groups and kill everyone there with some kind of electrically charged rusty barbed thing. -- http://bofhcam.org/journal/journal.html, 2002-01-08 From mwh at python.net Fri Nov 5 12:50:51 2004 From: mwh at python.net (Michael Hudson) Date: Fri Nov 5 12:50:55 2004 Subject: [Python-Dev] Re: interlocking dependencies on the path to a release In-Reply-To: <41896727.7030206@v.loewis.de> ( =?iso-8859-1?q?Martin_v._L=F6wis's_message_of?= "Thu, 04 Nov 2004 00:17:59 +0100") References: <4188BE21.6040205@interlink.com.au> <41896727.7030206@v.loewis.de> Message-ID: <2m3bzo5xb8.fsf@starship.python.net> "Martin v. L?wis" writes: > Also, I think it would be good to eliminate Fred's role altogether: > the documentation build process should be much more automatic, and > less relying on third-party tools. I think aiming at rewriting ht2html > in Python for 2.5 would be a worthwhile goal (I have dropped the > idea that conversion to xml would be worthwhile). Err, do you mean latex2html? If so, I'm not at all sure that's realistic. Cheers, mwh -- After a heavy night I travelled on, my face toward home - the comma being by no means guaranteed. -- paraphrased from cam.misc From jim at zope.com Fri Nov 5 15:25:20 2004 From: jim at zope.com (Jim Fulton) Date: Fri Nov 5 15:25:31 2004 Subject: [Python-Dev] Re: weakref gc semantics In-Reply-To: <418ACD1B.9060000@cosc.canterbury.ac.nz> References: <1f7befae04110220402077a6fa@mail.gmail.com> <1f7befae041103212576c59c42@mail.gmail.com> <20041104173835.GA15004@mems-exchange.org> <418ACD1B.9060000@cosc.canterbury.ac.nz> Message-ID: <418B8D50.4090908@zope.com> Greg Ewing wrote: > Neil Schemenauer wrote: > >> I think there may be one small problem though. Callbacks get passed >> the weakref object. Doesn't that break the rule that trash should >> not be exposed to Python code while the collection is taking place? > > > Maybe the callback shouldn't be passed the weakref object? > I don't see what good that does anyway, since the weakref > is just an empty shell by then, isn't it? No. It can still be used as a key. It still has it's original hash value and will compare equal to other weakrefs to the same original object. Weak-key dictionaries depend on this. In addition, as Tim points out, it could be a weakref-subclass instance and could have additional useful data. Jim -- Jim Fulton mailto:jim@zope.com Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org From tim.peters at gmail.com Fri Nov 5 16:05:23 2004 From: tim.peters at gmail.com (Tim Peters) Date: Fri Nov 5 16:05:26 2004 Subject: [Python-Dev] Re: weakref gc semantics In-Reply-To: <418B8D50.4090908@zope.com> References: <1f7befae04110220402077a6fa@mail.gmail.com> <1f7befae041103212576c59c42@mail.gmail.com> <20041104173835.GA15004@mems-exchange.org> <418ACD1B.9060000@cosc.canterbury.ac.nz> <418B8D50.4090908@zope.com> Message-ID: <1f7befae041105070549529618@mail.gmail.com> [Greg Ewing] >> Maybe the callback shouldn't be passed the weakref object? >> I don't see what good that does anyway, since the weakref >> is just an empty shell by then, isn't it? [Jim Fulton] > No. It can still be used as a key. It still has it's original > hash value and will compare equal to other weakrefs to the same > original object. Weak-key dictionaries depend on this. Right. > In addition, as Tim points out, it could be a weakref-subclass instance > and could have additional useful data. Adn weak-value dictionaries depend on that; from weakref.py: class KeyedRef(ref): """Specialized reference that includes a key corresponding to the value. This is used in the WeakValueDictionary to avoid having to create a function object for each key stored in the mapping. A shared callback object can use the 'key' attribute of a KeyedRef instead of getting a reference to the key from an enclosing scope. """ ... From pje at telecommunity.com Fri Nov 5 16:24:24 2004 From: pje at telecommunity.com (Phillip J. Eby) Date: Fri Nov 5 16:23:34 2004 Subject: [Python-Dev] Re: interlocking dependencies on the path to a release In-Reply-To: <2m3bzo5xb8.fsf@starship.python.net> References: <41896727.7030206@v.loewis.de> <4188BE21.6040205@interlink.com.au> <41896727.7030206@v.loewis.de> Message-ID: <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> At 11:50 AM 11/5/04 +0000, Michael Hudson wrote: >"Martin v. L?wis" writes: > > > Also, I think it would be good to eliminate Fred's role altogether: > > the documentation build process should be much more automatic, and > > less relying on third-party tools. I think aiming at rewriting ht2html > > in Python for 2.5 would be a worthwhile goal (I have dropped the > > idea that conversion to xml would be worthwhile). > >Err, do you mean latex2html? If so, I'm not at all sure that's >realistic. I've dabbled in the guts of latex2html before; it's certainly not pretty. IMO a better long term option might be to use the Python docutils and migrate to reStructuredText, since there are a bevy of backends available for latex, PDF, HTML, etc. They would probably need more work before they'll be suitable to handle the entire doc generation process, though. From tim.peters at gmail.com Fri Nov 5 16:45:42 2004 From: tim.peters at gmail.com (Tim Peters) Date: Fri Nov 5 16:45:47 2004 Subject: [Python-Dev] Re: weakref gc semantics In-Reply-To: <2m7jp05xfj.fsf@starship.python.net> References: <1f7befae04110220402077a6fa@mail.gmail.com> <1f7befae041103212576c59c42@mail.gmail.com> <20041104173835.GA15004@mems-exchange.org> <1f7befae04110411327af9bf3d@mail.gmail.com> <2m7jp05xfj.fsf@starship.python.net> Message-ID: <1f7befae04110507454a504cf6@mail.gmail.com> [Michael Hudson] > As disclaimed above, I haven't thought about this a great deal, but I > would expect it to be the lifetime of the weakref which matters -- in > the not-all-that-unlikley case of the callback not being a lambda or > local function, it is *always* going to be reachable, and indeed is > never going to die until the process exits... A difficulty remaining is that when a weakref and its referent both become unreachable simultaneously, relative lifetime becomes fuzzy. Even when, in the "simple" examples, I write weakref = None referent = None # callback doesn't trigger or referent = None # callback does trigger weakref = None the idea that relative lifetime controls the outcome in a *predictable* way depends on that CPython uses refcounting as its primary gc strategy. Indeed, Python the language (as opposed to CPython the implementation) really can't guarantee that the callback does or doesn't trigger in either simple example above. These fuzzy issues have become important because the lack of clarity about exact intended semantics has left us with segfault-producing bugs in the interaction between cyclic gc and weakrefs, and we've been thru more than one round of those now. A complication is that, perhaps contrary to initial expectation, outside of contrived tests I'm not sure callbacks that *aren't* "lambdas or local functions" actually exist. In the core, the two flavors of weak dict use very different strategies, but both end up using a unique function per dict instance as the callback, created in the weak dict's __init__ and bound to an attribute of the dict. So these are guaranteed to create "fuzzy situations" when a weak dict becomes part of cyclic trash (the dict, and the weakrefs it holds, and their callbacks, generally all become unreachable at the same instant). > I take it the changes you're proposing aren't going to change the > semantics of the quoted code? I'm not proposing anything specific, and if it comes to it I bet I could live with 2.4b2 forever. Its rules seem ultimately arbitrary, though, so aren't really attractive. Other rules are possible, and should be considered. For the first time, I think we finally have a deep understanding of what we can and cannot *get away* with now wrt preventing segfault bugs (and other related nastiness). But that understanding doesn't reduce the universe of acceptable (bug-free and defensible) policies to what 2.4b2 implements. In any case, no change to gcmodule.c's weakref policy would change anything about how CPython behaves in cases where refcounting does the whole job. So the answer to your literal question is "no". The behaviors of > def callback(ignore): > print 'hi' > > class C: > pass > > c = C() > w = weakref.ref(c, callback) > w = None > c = None kinds of examples are wholly determined by refcount lifetime semantics in CPython, and that won't change. From trentm at ActiveState.com Fri Nov 5 19:29:40 2004 From: trentm at ActiveState.com (Trent Mick) Date: Fri Nov 5 19:31:04 2004 Subject: [Python-Dev] Re: interlocking dependencies on the path to a release In-Reply-To: <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> References: <41896727.7030206@v.loewis.de> <4188BE21.6040205@interlink.com.au> <41896727.7030206@v.loewis.de> <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> Message-ID: <418BC694.9010306@activestate.com> Phillip J. Eby wrote: > I've dabbled in the guts of latex2html before; it's certainly not pretty. > > IMO a better long term option might be to use the Python docutils and > migrate to reStructuredText, since there are a bevy of backends > available for latex, PDF, HTML, etc. They would probably need more work > before they'll be suitable to handle the entire doc generation process, > though. What do people think about docbook? I'm impressed with the kind of doc output that, for example, the PHP guys and Mark Pilgrim's Dive Into Python and the Subversion Book, can generate from docbook sources. I'm not suggesting any whole hog re-write of the Python docs anytime soon, just wanted to feel it out. Trent -- Trent Mick trentm@activestate.com From trentm at ActiveState.com Fri Nov 5 19:26:02 2004 From: trentm at ActiveState.com (Trent Mick) Date: Fri Nov 5 19:42:48 2004 Subject: [Python-Dev] Policy about old Python versions In-Reply-To: <418AEB42.8040306@interlink.com.au> References: <20041104141632.GA27459@panix.com> <418AEB42.8040306@interlink.com.au> Message-ID: <418BC5BA.7090108@activestate.com> Anthony Baxter wrote: > As for the original query, about what to do with bugs filed against > 2.1.x - I'd suggest closing them. There's a vanishingly small chance > that there will ever be another 2.1 or 2.2 release. Maybe a "Known Issues in Python 2.1" PEP which refers to these bug numbers and then close the bugs? I don't want to make more work for people, though. Trent -- Trent Mick trentm@activestate.com From bac at OCF.Berkeley.EDU Fri Nov 5 20:42:43 2004 From: bac at OCF.Berkeley.EDU (Brett C.) Date: Fri Nov 5 20:43:06 2004 Subject: [Python-Dev] Re: interlocking dependencies on the path to a release In-Reply-To: <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> References: <41896727.7030206@v.loewis.de> <4188BE21.6040205@interlink.com.au> <41896727.7030206@v.loewis.de> <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> Message-ID: <418BD7B3.7050306@ocf.berkeley.edu> Phillip J. Eby wrote: > At 11:50 AM 11/5/04 +0000, Michael Hudson wrote: > >> "Martin v. L?wis" writes: >> >> > Also, I think it would be good to eliminate Fred's role altogether: >> > the documentation build process should be much more automatic, and >> > less relying on third-party tools. I think aiming at rewriting ht2html >> > in Python for 2.5 would be a worthwhile goal (I have dropped the >> > idea that conversion to xml would be worthwhile). >> >> Err, do you mean latex2html? If so, I'm not at all sure that's >> realistic. > > > I've dabbled in the guts of latex2html before; it's certainly not pretty. > > IMO a better long term option might be to use the Python docutils and > migrate to reStructuredText, since there are a bevy of backends > available for latex, PDF, HTML, etc. They would probably need more work > before they'll be suitable to handle the entire doc generation process, > though. > This has been proposed before but has been shot down. If I remember correctly the reasoning was that LaTeX gave us more control and thus served the purpose better for the official docs. -Brett From pje at telecommunity.com Fri Nov 5 21:04:21 2004 From: pje at telecommunity.com (Phillip J. Eby) Date: Fri Nov 5 21:03:32 2004 Subject: [Python-Dev] Re: interlocking dependencies on the path to a release In-Reply-To: <418BD7B3.7050306@ocf.berkeley.edu> References: <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> <41896727.7030206@v.loewis.de> <4188BE21.6040205@interlink.com.au> <41896727.7030206@v.loewis.de> <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> Message-ID: <5.1.1.6.0.20041105145001.02dee410@mail.telecommunity.com> At 11:42 AM 11/5/04 -0800, Brett C. wrote: >Phillip J. Eby wrote: >>At 11:50 AM 11/5/04 +0000, Michael Hudson wrote: >>>Err, do you mean latex2html? If so, I'm not at all sure that's >>>realistic. >> >>I've dabbled in the guts of latex2html before; it's certainly not pretty. >>IMO a better long term option might be to use the Python docutils and >>migrate to reStructuredText, since there are a bevy of backends available >>for latex, PDF, HTML, etc. They would probably need more work before >>they'll be suitable to handle the entire doc generation process, though. > >This has been proposed before but has been shot down. If I remember >correctly the reasoning was that LaTeX gave us more control and thus >served the purpose better for the official docs. More control of what? I thought that reST was specifically designed to accommodate all of the Python-specific markup we're using in the latex docs. As a matter of language expressiveness, as far as I can tell, reST accomodates marking up both short strings and long blocks, with application-specific markup, so I don't really understand why there shouldn't be a largely 1:1 mapping between the markup systems. To be fair, however, here are the downsides I'm aware of: * There are more tools that support editing LaTeX than reST * Python code would have to be written to replace the current Python-specific LaTeX macros with reST "interpreted text modes" and "block directives" * Conversion could be very time consuming, for the parts that can't be automated * There is a risk that the needed back-ends may not be sufficiently mature or feature-rich. For example, I don't think there's an HTML back-end that can generate pages for different nodes, with navigation links. I don't know if there's a GNU 'info' backend, either. Anyway, I thought the whole point behind the docutils initiative was to create a doc format that could be used anywhere Python needs docs, ala Perl's POD. If there are problems with reST, maybe we should let the docutils folks know what additional requirements exist, so that it can (eventually) be used for this purpose. From tim.peters at gmail.com Fri Nov 5 21:07:46 2004 From: tim.peters at gmail.com (Tim Peters) Date: Fri Nov 5 22:54:39 2004 Subject: [Python-Dev] patch-finalizer vs Zope3 In-Reply-To: <20041104171957.A0C633B8038@smtp.zope.com> References: <20041104171957.A0C633B8038@smtp.zope.com> Message-ID: <1f7befae041105120727ae399e@mail.gmail.com> [Tim Peters] > FYI, and without taking time for non-trivial analysis. I ran the non-ZEO > Zope3 tests with a Python patched to treat weakrefs with callbacks as > reachable (this was patch-finalizer.txt, attached to a msg I sent to > python-dev last night). > > The first test to leave stuff in gc.garbage then: > > The following test left garbage: > test_created (bugtracker.browser.tests.test_bug.BugBaseViewTest) > 65 > > where 65 is len(gc.garbage) after the test finished. OK, that actually wasn't the first test to produce garbage, it was just the first time test.py *noticed* gc.garbage wasn't empty. The first test to produce garbage was BuddyCityState, and it produces garbage in isolation: C:\Code\Zope3>\code\python\PCbuild\python_d.exe test.py -vv . BuddyCityState Configuration file found. Running UNIT tests at level 1 Running UNIT tests from C:\Code\Zope3 BuddyCityState (buddydemo.buddy) ... ok The following test left garbage: BuddyCityState (buddydemo.buddy) 28 entries in gc.garbage: 0: 0x12B5930 is 1: 0xB5EAB8 is 2: 0x3C8D4D0 is )> 3: 0x12B5578 is 4: 0x3C8D6C8 is )> 5: 0x1197230 is 6: 0x118ACE8 is 7: 0x118A818 is 8: 0x118A5E8 is 9: 0xDB9690 is 10: 0x3C8DAB8 is )> 11: 0xDA0188 is 12: 0x3C8DB28 is )> 13: 0x3C8DA10 is )> 14: 0x3C8DA10 is )> 15: 0x3C8D968 is )> 16: 0x118AC08 is 17: 0x1177F18 is 18: 0x1177D58 is 19: 0x1177C40 is 20: 0x3C8DD20 is )> 21: 0x3C8DC78 is )> 22: 0x3C8DBD0 is )> 23: 0x3C8D9D8 is )> 24: 0x3C8D8C0 is )> 25: 0x3C8D8C0 is )> 26: 0x3C8D8C0 is )> 27: 0x3C8D818 is )> [703156 refs] C:\Code\Zope3> It appears generally true that, like in that test, gc.garbage gets filled with (hundreds of thousands of) weakrefs specifically due to adaptation machinery. By inspection, there are a lot of weakrefs flying around there . From tim.peters at gmail.com Fri Nov 5 23:06:41 2004 From: tim.peters at gmail.com (Tim Peters) Date: Fri Nov 5 23:06:46 2004 Subject: [Python-Dev] Code coverage tool updated In-Reply-To: <418A269B.6010207@livinglogic.de> References: <41864572.4000806@livinglogic.de> <16774.45652.835103.327656@montanaro.dyndns.org> <4187765D.3000705@livinglogic.de> <4187CA1C.9050508@livinglogic.de> <1f7befae04110210537c35e514@mail.gmail.com> <418A269B.6010207@livinglogic.de> Message-ID: <1f7befae0411051406711618cf@mail.gmail.com> [Walter D?rwald] > I guess it's not worth it to try to fix doctest/trace to > provide sourcecode for doctest code, but IMHO trace should > be able to survive a doctest. Sure! The assert also triggers for "@test" on my box, BTW -- and also did in 2.3.4. > Removing the assert statement, so that trace.py runs to > completion shows a different problem: There are only > 32 files covered according to the trace output. The > complete test log can be found here: > http://styx.livinglogic.de/~walter/brokentrace.txt > > The trace call looked like this: > ./python ../../../trace.py --count --summary --missing Lib/test/regrtest.py > with ../../../trace.py being the trace.py from current > CVS with the assert statement removed. > > So am I doing something wrong or is trace.py broken? Sorry, I don't know. trace.py is like voting to me -- I'm highly in favor of it, but never have time for it <0.5 wink>. I only dropped in here to explain the source of the synthesized doctest "file name". FWIW, doing what you did with current CVS Python on Windows, I get results similar to yours: only 30-some modules reported at the end. Under my 2.3.4 installation instead, the same thing reports on over 300 modules, so best guess is that trace.py is indeed suffering breakage introduced in 2.4. No idea about specifics, though. From kbk at shore.net Sat Nov 6 04:08:08 2004 From: kbk at shore.net (Kurt B. Kaiser) Date: Sat Nov 6 04:08:15 2004 Subject: [Python-Dev] Weekly Python Patch/Bug Summary Message-ID: <200411060308.iA6388E3022594@h006008a7bda6.ne.client2.attbi.com> Patch / Bug Summary ___________________ Patches : 241 open ( -2) / 2683 closed ( +5) / 2924 total ( +3) Bugs : 784 open ( -5) / 4567 closed (+22) / 5351 total (+17) RFE : 158 open ( +2) / 131 closed ( +0) / 289 total ( +2) New / Reopened Patches ______________________ New BaseSMTPServer module (2004-10-30) http://python.org/sf/1057417 opened by Mark D. Roth chr, ord, unichr documentation updates (2004-10-31) http://python.org/sf/1057588 opened by Mike Brown bdist_rpm not able to compile multiple rpm packages (2004-11-04) http://python.org/sf/1060577 opened by Mihai Ibanescu Patches Closed ______________ No ValueError for safe_substitute() (2004-10-29) http://python.org/sf/1056967 closed by bwarsaw typo in comment (unicodeobject.h) (2004-10-28) http://python.org/sf/1056231 closed by rhettinger ref. manual talks of 'sequence' instead of 'iterable' (2003-10-23) http://python.org/sf/829073 closed by fdrake Fix for Unix macro expansion in citetitle (2004-10-26) http://python.org/sf/1054715 closed by fdrake Remove CoreServices / CoreFoundation dependencies in core (2004-09-26) http://python.org/sf/1035255 closed by rhettinger New / Reopened Bugs ___________________ add link in time module to calendar.timegm() (2004-10-30) CLOSED http://python.org/sf/1057535 opened by Jeff Shute compiler.transformer, "from module import *" (2004-10-31) http://python.org/sf/1057835 opened by Felix Wiemann os.utime() doesn't work on WinME (2004-11-01) CLOSED http://python.org/sf/1057992 opened by Raymond Hettinger test_traceback.py fails on WinME (2004-11-01) CLOSED http://python.org/sf/1057993 opened by Raymond Hettinger Can't read some http URLs using neither urllib, nor urllib2 (2004-11-01) http://python.org/sf/1058059 opened by Vsevolod Novikov Blatantly false statement in the Unicode section (2004-11-01) CLOSED http://python.org/sf/1058351 opened by Olivier Verdier r'\10' as replacement pattern loops in compilation (2004-11-02) http://python.org/sf/1058786 opened by Nick Maclaren Legacy requirements: Incorrect comments? (2004-11-02) http://python.org/sf/1058937 opened by Geoffrey T. Dairiki install_lib fails under Python 2.1 (2004-11-02) http://python.org/sf/1058960 opened by Geoffrey T. Dairiki distutil bdist hardcodes the python location (2004-11-02) http://python.org/sf/1059244 opened by Steve Menard errors=ignore broken on StreamWriter? (2004-11-03) CLOSED http://python.org/sf/1059748 opened by Wummel incorrect "'yield' outside function" error (2004-11-04) http://python.org/sf/1060135 opened by Willem Broekema os.utime does not work on directories under Windows (2004-11-04) CLOSED http://python.org/sf/1060212 opened by Boyle Buffer overflow in socketmodule.c (2004-11-04) http://python.org/sf/1060396 opened by Mihai Ibanescu Remove .min() and .max() from Decimal (2004-11-04) http://python.org/sf/1060644 reopened by facundobatista Remove .min() and .max() from Decimal (2004-11-04) http://python.org/sf/1060644 opened by Facundo Batista Error in difflib docs (2004-11-05) CLOSED http://python.org/sf/1060825 opened by Kent Johnson email.Parser does not recognize attachment (2004-11-05) CLOSED http://python.org/sf/1060941 opened by Martin Muenstermann Bugs Closed ___________ weakref callback vs gc vs threads (2004-10-27) http://python.org/sf/1055820 closed by tim_one add link in time module to calendar.timegm() (2004-10-31) http://python.org/sf/1057535 closed by jlgijsbers os.rmtree error handling was always broken (2004-10-18) http://python.org/sf/1048941 closed by jlgijsbers minor error in os.access (2004-10-29) http://python.org/sf/1056498 closed by jlgijsbers Attempt to run all atexit handlers (2004-10-22) http://python.org/sf/1052242 closed by montanaro email.Utils not mentioned (2004-09-17) http://python.org/sf/1030118 closed by bwarsaw os.utime() doesn't work on WinME (2004-11-01) http://python.org/sf/1057992 closed by rhettinger test_traceback.py fails on WinME (2004-11-01) http://python.org/sf/1057993 closed by perky email.Message does not allow iteration (2004-08-26) http://python.org/sf/1017329 closed by bwarsaw Blatantly false statement in the Unicode section (2004-11-02) http://python.org/sf/1058351 closed by perky File write examples are inadequate (2002-10-09) http://python.org/sf/621057 closed by fdrake Clarify trailing comma in func arg list (2003-09-01) http://python.org/sf/798652 closed by fdrake Install-time module compilation fails with 2.4b1 (2004-10-18) http://python.org/sf/1049003 closed by loewis errors=ignore broken on StreamWriter? (2004-11-03) http://python.org/sf/1059748 closed by lemburg latex2html convert bug (2003-12-30) http://python.org/sf/867556 closed by quiver os.utime does not work on directories under Windows (2004-11-04) http://python.org/sf/1060212 closed by tim_one Remove .min() and .max() from Decimal (2004-11-04) http://python.org/sf/1060644 closed by rhettinger LaTeX not required (2004-05-05) http://python.org/sf/948517 closed by fdrake ambiguity in os.tmpfile (2004-10-28) http://python.org/sf/1056515 closed by fdrake Duplicated <link rel (2004-02-18) http://python.org/sf/899423 closed by fdrake Error in difflib docs (2004-11-05) http://python.org/sf/1060825 closed by rhettinger email.Parser does not recognize attachment (2004-11-05) http://python.org/sf/1060941 closed by bwarsaw New / Reopened RFE __________________ lock-free data structures? (2004-11-03) http://python.org/sf/1059545 opened by Markus Elfring From martin at v.loewis.de Sat Nov 6 11:10:45 2004 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Sat Nov 6 11:10:35 2004 Subject: [Python-Dev] Re: interlocking dependencies on the path to a release In-Reply-To: <2m3bzo5xb8.fsf@starship.python.net> References: <4188BE21.6040205@interlink.com.au> <41896727.7030206@v.loewis.de> <2m3bzo5xb8.fsf@starship.python.net> Message-ID: <418CA325.50105@v.loewis.de> Michael Hudson wrote: > Err, do you mean latex2html? If so, I'm not at all sure that's > realistic. We'll see. What I consider the difficult part of such a project (parsing the TeX) is already implemented, so we only need the HTML generation now. That should be straight-forward, even if laborious. Regards, Martin From martin at v.loewis.de Sat Nov 6 11:12:55 2004 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Sat Nov 6 11:12:44 2004 Subject: [Python-Dev] Re: interlocking dependencies on the path to a release In-Reply-To: <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> References: <41896727.7030206@v.loewis.de> <4188BE21.6040205@interlink.com.au> <41896727.7030206@v.loewis.de> <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> Message-ID: <418CA3A7.709@v.loewis.de> Phillip J. Eby wrote: > I've dabbled in the guts of latex2html before; it's certainly not pretty. I wouldn't look into the source of latex2html at all. Instead, I would rewrite it from scratch, worrying only that the output stays the same (or sufficiently similar). > IMO a better long term option might be to use the Python docutils and > migrate to reStructuredText, since there are a bevy of backends > available for latex, PDF, HTML, etc. They would probably need more work > before they'll be suitable to handle the entire doc generation process, > though. I'm not convinced this would be a good idea. Having TeX as the primary source allows to produce well-formatted printed documentation. Regards, Martin From martin at v.loewis.de Sat Nov 6 11:14:09 2004 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Sat Nov 6 11:13:58 2004 Subject: [Python-Dev] Re: interlocking dependencies on the path to a release In-Reply-To: <418BC694.9010306@activestate.com> References: <41896727.7030206@v.loewis.de> <4188BE21.6040205@interlink.com.au> <41896727.7030206@v.loewis.de> <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> <418BC694.9010306@activestate.com> Message-ID: <418CA3F1.4050702@v.loewis.de> Trent Mick wrote: > What do people think about docbook? It's been a plan for several years now, and I spend some time into advancing the existing tools. Now I'm not convinced anymore that this is desirable - people don't want to learn new markup languages every day. Regards, Martin From martin at v.loewis.de Sat Nov 6 11:18:49 2004 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Sat Nov 6 11:18:39 2004 Subject: [Python-Dev] Re: interlocking dependencies on the path to a release In-Reply-To: <5.1.1.6.0.20041105145001.02dee410@mail.telecommunity.com> References: <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> <41896727.7030206@v.loewis.de> <4188BE21.6040205@interlink.com.au> <41896727.7030206@v.loewis.de> <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> <5.1.1.6.0.20041105145001.02dee410@mail.telecommunity.com> Message-ID: <418CA509.2050103@v.loewis.de> Phillip J. Eby wrote: > More control of what? I thought that reST was specifically designed to > accommodate all of the Python-specific markup we're using in the latex > docs. How do you create a module index and a "global" index in reST? How do you express document inclusion (in the spirit of \input)? > As a matter of language expressiveness, as far as I can tell, reST > accomodates marking up both short strings and long blocks, with > application-specific markup, so I don't really understand why there > shouldn't be a largely 1:1 mapping between the markup systems. It's not about source code display. It is about the other 200 typographic features that we use in the Python documentation. > * Conversion could be very time consuming, for the parts that can't be > automated If the conversion cannot be fully automatic, that would indicate that there will be a loss of information. Likely, this loss is unacceptable. > Anyway, I thought the whole point behind the docutils initiative was to > create a doc format that could be used anywhere Python needs docs, ala > Perl's POD. I'm still uncertain what the point behind the docutils initiative is. Regards, Martin From mwh at python.net Sat Nov 6 13:58:10 2004 From: mwh at python.net (Michael Hudson) Date: Sat Nov 6 13:58:12 2004 Subject: [Python-Dev] Re: interlocking dependencies on the path to a release In-Reply-To: <418BC694.9010306@activestate.com> (Trent Mick's message of "Fri, 05 Nov 2004 10:29:40 -0800") References: <41896727.7030206@v.loewis.de> <4188BE21.6040205@interlink.com.au> <41896727.7030206@v.loewis.de> <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> <418BC694.9010306@activestate.com> Message-ID: <2mk6sz3zj1.fsf@starship.python.net> Trent Mick writes: > Phillip J. Eby wrote: >> I've dabbled in the guts of latex2html before; it's certainly not pretty. >> IMO a better long term option might be to use the Python docutils >> and migrate to reStructuredText, since there are a bevy of backends >> available for latex, PDF, HTML, etc. They would probably need more >> work before they'll be suitable to handle the entire doc generation >> process, though. > > What do people think about docbook? Where did this conversation start again? Is it just that generating HTML currently involves "Probably the longest Perl script anyone ever attempted to maintain."? Suggestions for alternative documentation formats are a common theme in Python-land; *reasons* for changing format are much harder to find... I think it is probably possible to remove Fred from the critical path of performing a Python release, because due in large part to his work, building the Python docs just isn't that difficult (heck, my latex2html install hasn't rotted and died in *years*). I'm pretty sure it's possible on the starship, too. Of course, if Fred doesn't do the doc bits, someone else has to -- I don't know if Martin or Anthony want to take on yet another task. There might be something to be said for finding someone in a more convenient timezone. Is the process of scattering files around on creosote automated? Cheers, mwh -- ucking keyoar -- from Twisted.Quotes From ncoghlan at iinet.net.au Sat Nov 6 16:09:47 2004 From: ncoghlan at iinet.net.au (Nick Coghlan) Date: Sat Nov 6 16:09:57 2004 Subject: [Python-Dev] Re: interlocking dependencies on the path to a release In-Reply-To: <418CA3A7.709@v.loewis.de> References: <41896727.7030206@v.loewis.de> <4188BE21.6040205@interlink.com.au> <41896727.7030206@v.loewis.de> <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> <418CA3A7.709@v.loewis.de> Message-ID: <418CE93B.7010605@iinet.net.au> Martin v. L?wis wrote: > Phillip J. Eby wrote: > >> I've dabbled in the guts of latex2html before; it's certainly not pretty. > > > I wouldn't look into the source of latex2html at all. Instead, I would > rewrite it from scratch, worrying only that the output stays the same > (or sufficiently similar). Being able to easily build the current docs on a Windows system would be convenient. Even a full install of Cygwin doesn't include all the tools needed to build by the current process (latex2html is the main offender - I believe it *can* be made to work with Cygwin, but it's a separate download that requires a few other tweaks, and installation of a couple more support tools) >> IMO a better long term option might be to use the Python docutils and >> migrate to reStructuredText, since there are a bevy of backends >> available for latex, PDF, HTML, etc. They would probably need more >> work before they'll be suitable to handle the entire doc generation >> process, though. > > I'm not convinced this would be a good idea. Having TeX as the primary > source allows to produce well-formatted printed documentation. A _reST to TeX converter that added the extra typesetting info might be an interesting tool. So things with simple typesetting needs can be written in _reST, while complex typesetting is still possible with all the power of TeX. (I don't see how _reST could be given the same typesetting power without losing its elegant simplicity). Cheers, Nick. -- Nick Coghlan | Brisbane, Australia Email: ncoghlan@email.com | Mobile: +61 409 573 268 From pje at telecommunity.com Sat Nov 6 17:34:55 2004 From: pje at telecommunity.com (Phillip J. Eby) Date: Sat Nov 6 17:34:09 2004 Subject: [Python-Dev] Re: interlocking dependencies on the path to a release In-Reply-To: <418CA3A7.709@v.loewis.de> References: <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> <41896727.7030206@v.loewis.de> <4188BE21.6040205@interlink.com.au> <41896727.7030206@v.loewis.de> <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> Message-ID: <5.1.1.6.0.20041106112258.0251eb70@mail.telecommunity.com> At 11:12 AM 11/6/04 +0100, Martin v. L?wis wrote: >Phillip J. Eby wrote: >>IMO a better long term option might be to use the Python docutils and >>migrate to reStructuredText, since there are a bevy of backends available >>for latex, PDF, HTML, etc. They would probably need more work before >>they'll be suitable to handle the entire doc generation process, though. > >I'm not convinced this would be a good idea. Having TeX as the primary >source allows to produce well-formatted printed documentation. If what you mean is that TeX itself does better formatting than e.g. the docutils PDF backend, I would note that there are two LaTeX backends for docutils: one a generic latex backend, and the other that's supposed to generate markup suitable for the current Python documentation toolchain. From pje at telecommunity.com Sat Nov 6 17:51:20 2004 From: pje at telecommunity.com (Phillip J. Eby) Date: Sat Nov 6 17:50:34 2004 Subject: [Python-Dev] Re: interlocking dependencies on the path to a release In-Reply-To: <418CA509.2050103@v.loewis.de> References: <5.1.1.6.0.20041105145001.02dee410@mail.telecommunity.com> <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> <41896727.7030206@v.loewis.de> <4188BE21.6040205@interlink.com.au> <41896727.7030206@v.loewis.de> <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> <5.1.1.6.0.20041105145001.02dee410@mail.telecommunity.com> Message-ID: <5.1.1.6.0.20041106113503.02527e40@mail.telecommunity.com> At 11:18 AM 11/6/04 +0100, Martin v. L?wis wrote: >Phillip J. Eby wrote: >>More control of what? I thought that reST was specifically designed to >>accommodate all of the Python-specific markup we're using in the latex docs. > >How do you create a module index and a "global" index in reST? By adding directives, or using interpreted text, as long as the feature is supported by a given output writer. >How do you express document inclusion (in the spirit of \input)? There's an "include" directive. I don't know what you mean by the "spirit of \input". >>As a matter of language expressiveness, as far as I can tell, reST >>accomodates marking up both short strings and long blocks, with >>application-specific markup, so I don't really understand why there >>shouldn't be a largely 1:1 mapping between the markup systems. > >It's not about source code display. It is about the other 200 >typographic features that we use in the Python documentation. I don't get what source code display has to do with it. I'm pointing out that the languages (Latex and reST) have comparable expressiveness in their markup facilities, e.g.: Latex: \foo{bar} reST: `bar`:foo Latex: \begin{foo} blah blah \end{foo} reST: .. foo:: blah blah The difference is merely that the meaning of reST's equivalents to macros and environments (i.e. "interpreted text roles" and "directives") are defined using Python code rather than Latex. Of course, a latex writer could still be used to generate latex output, if that is the preferred format for printing. By the way, please don't confuse my answering your questions here with me advocating an actual migration or conversion at this point: from the dicussion so far and my rechecking the status of the various available docutils writers, it's clear to me that the writers aren't yet mature enough to handle generating the Python documentation. But I don't currently see any issues on the *reader* end. That is, I have not yet seen any issues raised that rule out reST syntax as a documentation source format. (I'm not saying there aren't any, either, just that I haven't seen such an issue raised yet.) From martin at v.loewis.de Sat Nov 6 18:35:03 2004 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Sat Nov 6 18:34:51 2004 Subject: [Python-Dev] Re: interlocking dependencies on the path to a release In-Reply-To: <5.1.1.6.0.20041106112258.0251eb70@mail.telecommunity.com> References: <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> <41896727.7030206@v.loewis.de> <4188BE21.6040205@interlink.com.au> <41896727.7030206@v.loewis.de> <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> <5.1.1.6.0.20041106112258.0251eb70@mail.telecommunity.com> Message-ID: <418D0B47.3010302@v.loewis.de> Phillip J. Eby wrote: > If what you mean is that TeX itself does better formatting than e.g. the > docutils PDF backend, I would note that there are two LaTeX backends for > docutils: one a generic latex backend, and the other that's supposed to > generate markup suitable for the current Python documentation toolchain. That still might not be sufficient. reST certainly uses a specific subset of TeX's capabilities when generating LaTeX, so some features of TeX may simply be unaccessible when you have to stick to reST syntax. Regards, Martin From martin at v.loewis.de Sat Nov 6 18:42:58 2004 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Sat Nov 6 18:42:47 2004 Subject: [Python-Dev] Re: interlocking dependencies on the path to a release In-Reply-To: <5.1.1.6.0.20041106113503.02527e40@mail.telecommunity.com> References: <5.1.1.6.0.20041105145001.02dee410@mail.telecommunity.com> <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> <41896727.7030206@v.loewis.de> <4188BE21.6040205@interlink.com.au> <41896727.7030206@v.loewis.de> <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> <5.1.1.6.0.20041105145001.02dee410@mail.telecommunity.com> <5.1.1.6.0.20041106113503.02527e40@mail.telecommunity.com> Message-ID: <418D0D22.4010405@v.loewis.de> Phillip J. Eby wrote: >> How do you create a module index and a "global" index in reST? > > > By adding directives, or using interpreted text, as long as the feature > is supported by a given output writer. Ah, so you would make use of extensions; i.e. we would essentially clone reST. >> How do you express document inclusion (in the spirit of \input)? > > > There's an "include" directive. I don't know what you mean by the > "spirit of \input". If include means literal inclusion, it is in the spirit of \input. > The difference is merely that the meaning of reST's equivalents to > macros and environments (i.e. "interpreted text roles" and "directives") > are defined using Python code rather than Latex. Of course, a latex > writer could still be used to generate latex output, if that is the > preferred format for printing. I did not understand that, in order to use reST in a complex application, you have to write your own markup extensions, and then support those in all the backends you care about. If that is typical, then yes, reST should be able to represent everything we have in the documentation right now. It just means that we cannot expect reST to work *out-of-the-box*. Instead, we first need to implement the missing formatting elements for the backends we care for. That sounds like a significant project of its own. Regards, Martin From pje at telecommunity.com Sat Nov 6 19:45:00 2004 From: pje at telecommunity.com (Phillip J. Eby) Date: Sat Nov 6 19:44:15 2004 Subject: [Python-Dev] Re: interlocking dependencies on the path to a release In-Reply-To: <418D0D22.4010405@v.loewis.de> References: <5.1.1.6.0.20041106113503.02527e40@mail.telecommunity.com> <5.1.1.6.0.20041105145001.02dee410@mail.telecommunity.com> <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> <41896727.7030206@v.loewis.de> <4188BE21.6040205@interlink.com.au> <41896727.7030206@v.loewis.de> <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> <5.1.1.6.0.20041105145001.02dee410@mail.telecommunity.com> <5.1.1.6.0.20041106113503.02527e40@mail.telecommunity.com> Message-ID: <5.1.1.6.0.20041106130940.035910a0@mail.telecommunity.com> At 06:42 PM 11/6/04 +0100, Martin v. L?wis wrote: >Phillip J. Eby wrote: >>>How do you create a module index and a "global" index in reST? >> >>By adding directives, or using interpreted text, as long as the feature >>is supported by a given output writer. > >Ah, so you would make use of extensions; i.e. we would essentially >clone reST. If you mean clone the Python extensions to LaTeX, then yes. >>The difference is merely that the meaning of reST's equivalents to macros >>and environments (i.e. "interpreted text roles" and "directives") are >>defined using Python code rather than Latex. Of course, a latex writer >>could still be used to generate latex output, if that is the preferred >>format for printing. > >I did not understand that, in order to use reST in a complex >application, you have to write your own markup extensions, and >then support those in all the backends you care about. Just as was done for LaTeX, yes. (E.g. the Python latex2html postprocessing step, and the Python LaTeX macros.) >If that is typical, then yes, reST should be able to represent >everything we have in the documentation right now. It just means >that we cannot expect reST to work *out-of-the-box*. Instead, we >first need to implement the missing formatting elements for the >backends we care for. That sounds like a significant project of >its own. Potentially so. However, there are some significant shortcuts possible for many situations. reST includes an unparameterized macro facility, a 'raw' directive that passes markup through to the backend, and a 'role' directive to create markup roles for use with interpreted text. These roles apply "class" attributes to the DOM, that then end up as HTML or XML "class" attributes, or potentially as LaTeX macros or environments. For example, one might use: .. role:: var(emphasis) to define a text role that could be used to replace \var{foo} with :var:`foo`. So, I think there are some regularities that can be exploited, such that it's not an N*M project, for N features and M backends. Those features that can be implemented in terms of existing reST concepts (other than the 'raw' passthru) would only need implementation once. Indeed, if reST simply had a suitable directive for defining directives, I think that all of the merely typographical aspects of Python documentation markup could be defined in reST, as part of the documentation source. The main main areas of "missing" features in docutils backends that I'm aware of would fall under the headings of index generation (all backends), and multi-page HTML output with navigation links (HTML backend). From pje at telecommunity.com Sat Nov 6 19:48:44 2004 From: pje at telecommunity.com (Phillip J. Eby) Date: Sat Nov 6 19:47:58 2004 Subject: [Python-Dev] Re: interlocking dependencies on the path to a release In-Reply-To: <418D0B47.3010302@v.loewis.de> References: <5.1.1.6.0.20041106112258.0251eb70@mail.telecommunity.com> <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> <41896727.7030206@v.loewis.de> <4188BE21.6040205@interlink.com.au> <41896727.7030206@v.loewis.de> <5.1.1.6.0.20041105101943.02b94c80@mail.telecommunity.com> <5.1.1.6.0.20041106112258.0251eb70@mail.telecommunity.com> Message-ID: <5.1.1.6.0.20041106134543.020f4c30@mail.telecommunity.com> At 06:35 PM 11/6/04 +0100, Martin v. L?wis wrote: >Phillip J. Eby wrote: >>If what you mean is that TeX itself does better formatting than e.g. the >>docutils PDF backend, I would note that there are two LaTeX backends for >>docutils: one a generic latex backend, and the other that's supposed to >>generate markup suitable for the current Python documentation toolchain. > >That still might not be sufficient. reST certainly uses a specific subset >of TeX's capabilities when generating LaTeX, so some features >of TeX may simply be unaccessible when you have to stick to reST >syntax. There's a 'raw' directive that can be used for this: .. raw:: latex \setlength{\parindent}{0pt} The data will be ignored by non-latex backends. Similarly, you may use raw HTML with 'raw:: html'. See http://docutils.sourceforge.net/docs/ref/rst/directives.html#raw-data-pass-through From jcarlson at uci.edu Sun Nov 7 00:05:44 2004 From: jcarlson at uci.edu (Josiah Carlson) Date: Sun Nov 7 00:14:59 2004 Subject: [Python-Dev] Synchronous and Asynchronous servers in the standard library Message-ID: <20041106102107.F853.JCARLSON@uci.edu> A recent patch to offer an SMTP server (SocketServer derivative) sparked the below... Question: Does we (and by 'we' I mean those in charge of developing Python) want to offer both asynchronous (deriving from asyncore, asynchat, etc.) and synchronous versions of server software in the standard library? Observations: There is currently 1 async server, and 5 sync servers in the standard library. If we want to offer both sync and async versions, it makes sense to reduce programmer effort and share as much code as possible. Idea: Set up a framework that allows Python programmers to produce async and sync variants of their servers easily. I have a partial example 'implementation' below. It seems to make sense (if such a framework is desired) to place all such modules in a 'Server' package, and to describe precisely what is necessary to make such a package usable, used, and added to in a PEP called something like "A flexible server framework". Future Python: This would obviously be a 2.5 feature/module, and I would be willing to write both the PEP (perhaps after the 1st of January, 2005 as I have a journal paper write before then) (and afterwards) translate the current standard library servers to the framework. Depending on how popular the framework is through the lifetime of Python 2.5 (if it makes it into 2.5), it may make sense to deprecate the original servers in 2.6 or 2.7 (if ever). I would be willing to volunteer to maintain the server package, or at least as many of the protocols as I understand, for 2.5 and beyond (I don't know much about XMLRPC, so translation is about as much as I could probably do). - Josiah In the case of 'chatty' protocols like SMTP, POP, etc., where the following complete, merely a prototype... class SyncServerBase: def send(self, data): if data is None: self.sock.close() else: self.sock.write(data) def close_when_done(self): self.send(None) ... class AsyncServerBase(asyncore.dispatcher): def send(self, data): #handle buffering with deque, etc. def close_when_done(self): #toss a None into the queue ... class AsynchatMixin(asynchat.async_chat): #perhaps write a better buffered reader and writer... limit = None def readable(self): #handle optional request size limit return limit is None or len(self.ac_in_buffer) < self.limit def found_terminator(self): self.request = self.ac_in_buffer self.ac_in_buffer = '' self.handle_request() ... class SMTP_Handler: def SMTP_HELO(self, cmd): .... def SMTP_MAIL(self, cmd): ... self.send(response) ... ... class SMTP_Sync(SyncServerBase, SMTP_Handler): def handle_request(self): #does all of the reading necessary to read from a socket and #handle dispatch to SMTP_* class SMTP_Async(AsyncServerBase, AsynchatMixin, SMTP_Handler): terminator = '\r\n' def handle_request(self): #command line (or email content) is provided in self.request #handles dispatch to SMTP_*, reading a line/request is provided #in this case by the AsynchatMixin Etcetera. From tim.peters at gmail.com Sun Nov 7 04:31:33 2004 From: tim.peters at gmail.com (Tim Peters) Date: Sun Nov 7 04:31:41 2004 Subject: [Python-Dev] patch-finalizer vs Zope3 In-Reply-To: <1f7befae041105120727ae399e@mail.gmail.com> References: <20041104171957.A0C633B8038@smtp.zope.com> <1f7befae041105120727ae399e@mail.gmail.com> Message-ID: <1f7befae04110619317dfe0f4d@mail.gmail.com> [Tim, on a patch-finalizer consequence] > OK, that actually wasn't the first test to produce garbage, it was > just the first time test.py *noticed* gc.garbage wasn't empty. The > first test to produce garbage was BuddyCityState, and it produces > garbage in isolation: > ... Man, this sure brings back miserable memories of how hard it could be to debug leaks due to cycles before Neil added gcmodule.c! The best tool we had then was my Cyclops.py, but I stopped keeping that up to date because there was obviously no more need for it . Desktop boxes have gotten a lot more capable since then, and apps have grown in ambition to match. Here we ran one measly test from the huge Zope3 test suite; it ran in an eye blink (maybe two). From the first weakref in gc.garbage alone, it turned out that more than 42,000 distinct cycles were reachable, breaking into a bit fewer than 4,000 strongly connected components, the latter ranging in size from 2 objects (almost all a new-style class and its mro) to about 40,000. A text file account of these SCCs consumed about 20MB. So what you do? I don't know. These are always solvable, but they're rarely easy. I always end up writing a small pile of new graph analysis code specifically exploiting peculiarities of the case at hand. In this case I also changed gcmodule.c a little, to put trash reachable from resurrected trash weakrefs into gc.garbage too, but unlike gc.DEBUG_SAVEALL not to also put *all* trash in gc.garbage. That was key to figuring out what the original trash cycles were. "The answer" in this case appears to be in Zope3's zope/interface/adapter.py's AdapterRegistry.__init__: class AdapterRegistry(object): """Adapter registry """ # Implementation note: # We are like a weakref dict ourselves. We can't use a weakref # dict because we have to use spec.weakref() rather than # weakref.ref(spec) to get weak refs to specs. _surrogateClass = Surrogate def __init__(self): default = self._surrogateClass(Default, self) self._default = default null = self._surrogateClass(Null, self) self._null = null # Create separate lookup object and copy it's methods surrogates = {Default.weakref(): default, Null.weakref(): null} def _remove(k): try: del surrogates[k] except KeyError: pass lookup = AdapterLookup(self, surrogates, _remove) The rest doesn't appear to matter. As the attached smoking gun shows, a weakref W has an instance of the nested _remove function as its callback(*). The _remove function has a cell object, pointing to the lexically enclosing `surrogates` dict. That dict in turn has W as a key. So there's a cycle, and refcounting alone can't clean it up. All of this stuff *was* trash, but because patch-finalizer decides to call W reachable, the cell and the `surrogates` dict became reachable too, and none of it got cleaned up (nor, of course, did anything else reachable from this cycle). When 2.4b2 looks at this case, it clears W because its referent is trash, and ignore's W's callback because W is also trash. Since, had it been called, the only thing the callback would have done is mutate other trash, it didn't hurt not to call it. But it remains a stretch to believe that "ignoring callbacks on trash weakrefs is harmless" is a necessary outcome. Still, whatever else this may or may not imply, it convinces me we can't adopt a patch-finalizer-ish approach without serious effort at making leaks "due to it" more easily analyzable. (*) A weakref W's callback is discoverable after all in Python, just by calling gc.get_referents(W). This is something I've rediscovered about 6 times by now, and it always catches me by surprise . -------------- next part -------------- cycle obj 0: cycle starts here 0x3c84f20 weakref to obj 1: 0x3c89a30 obj 2: 0x3c8b658 (,) obj 3: 0x3c8b968 obj 4: 0x3c6a620 {: )>, : )>, : )>, : )>, : )>, : )>, : )>, : )>, : )>, : )>, : )>, : )>, : )>, : )>, : )>} cycle ends here 0x3c84f20 weakref to From tim.peters at gmail.com Sun Nov 7 06:07:37 2004 From: tim.peters at gmail.com (Tim Peters) Date: Sun Nov 7 06:07:39 2004 Subject: [Python-Dev] patch-finalizer vs Zope3 In-Reply-To: <1f7befae04110619317dfe0f4d@mail.gmail.com> References: <20041104171957.A0C633B8038@smtp.zope.com> <1f7befae041105120727ae399e@mail.gmail.com> <1f7befae04110619317dfe0f4d@mail.gmail.com> Message-ID: <1f7befae04110621071e42e173@mail.gmail.com> [Tim] ... > surrogates = {Default.weakref(): default, Null.weakref(): null} > def _remove(k): > try: > del surrogates[k] > except KeyError: > pass FYI, if I fiddle that part to use the same kind of odd spelling Python's weak dicts stumbled into for other reasons: surrogates = {Default.weakref(): default, Null.weakref(): null} self._surrogates = surrogates # new def _remove(k, selfref=weakref.ref(self)): # changed self = selfref() # new if self is not None: # new try: del self._surrogates[k] # changed except KeyError: pass then the Zope3 unit tests don't leave anything in gc.garbage under 2.4b2 + patch-finalizer. A spattering of tests fail (2 failures + 3 errors), though, due to new TypeError: can't pickle weakref objects exceptions. Note that in this case the callbacks get invoked but are impotent: self isn't strongly reachable from the callbacks, so self is left in the unreachable set, and so the `selfref` weakref (which does not have a callback) gets cleared before gc starts breaking cycles: all the callbacks see selfref() return None. From astrand at lysator.liu.se Sun Nov 7 11:20:47 2004 From: astrand at lysator.liu.se (Peter Astrand) Date: Sun Nov 7 11:20:54 2004 Subject: [Python-Dev] Re: Bug [ 959379 ] Implicit close() should check for errors In-Reply-To: <417EAD88.7080105@v.loewis.de> References: <417E81B1.8080601@v.loewis.de> <417EAD88.7080105@v.loewis.de> Message-ID: On Tue, 26 Oct 2004, "Martin v. L?wis" wrote: > Peter Astrand wrote: > > + PySys_WriteStderr("close failed: %s\n", strerror(errno)); > > This should use HAVE_STRERROR. Like this?: diff -u -r2.192 fileobject.c --- dist/src/Objects/fileobject.c 11 Jun 2004 04:49:03 -0000 2.192 +++ dist/src/Objects/fileobject.c 7 Nov 2004 10:13:04 -0000 @@ -300,12 +300,19 @@ static void file_dealloc(PyFileObject *f) { + int sts = 0; if (f->weakreflist != NULL) PyObject_ClearWeakRefs((PyObject *) f); if (f->f_fp != NULL && f->f_close != NULL) { Py_BEGIN_ALLOW_THREADS - (*f->f_close)(f->f_fp); + sts = (*f->f_close)(f->f_fp); Py_END_ALLOW_THREADS + if (sts == EOF) +#ifdef HAVE_STRERROR + PySys_WriteStderr("close failed: [Errno %d] %s\n", errno, strerror(errno)); +#else + PySys_WriteStderr("close failed: [Errno %d]\n", errno); +#endif } PyMem_Free(f->f_setbuf); Py_XDECREF(f->f_name); /Peter ?strand From anthony at interlink.com.au Sun Nov 7 15:32:35 2004 From: anthony at interlink.com.au (Anthony Baxter) Date: Sun Nov 7 15:32:53 2004 Subject: [Python-Dev] Synchronous and Asynchronous servers in the standard library In-Reply-To: <20041106102107.F853.JCARLSON@uci.edu> References: <20041106102107.F853.JCARLSON@uci.edu> Message-ID: <418E3203.9060002@interlink.com.au> Josiah Carlson wrote: > A recent patch to offer an SMTP server (SocketServer derivative) sparked > the below... > > Question: > Does we (and by 'we' I mean those in charge of developing Python) want > to offer both asynchronous (deriving from asyncore, asynchat, etc.) and > synchronous versions of server software in the standard library? Personally, I think that encouraging anyone to develop new software on top of asyncore/asynchat is a _terrible_ idea. Anthony From jhylton at gmail.com Sun Nov 7 16:09:34 2004 From: jhylton at gmail.com (Jeremy Hylton) Date: Sun Nov 7 16:09:40 2004 Subject: [Python-Dev] Synchronous and Asynchronous servers in the standard library In-Reply-To: <418E3203.9060002@interlink.com.au> References: <20041106102107.F853.JCARLSON@uci.edu> <418E3203.9060002@interlink.com.au> Message-ID: On Mon, 08 Nov 2004 01:32:35 +1100, Anthony Baxter wrote: > Josiah Carlson wrote: > > A recent patch to offer an SMTP server (SocketServer derivative) sparked > > the below... > > > > Question: > > Does we (and by 'we' I mean those in charge of developing Python) want > > to offer both asynchronous (deriving from asyncore, asynchat, etc.) and > > synchronous versions of server software in the standard library? > > Personally, I think that encouraging anyone to develop new software on > top of asyncore/asynchat is a _terrible_ idea. I agree. Jeremy From allison at sumeru.stanford.EDU Sun Nov 7 17:11:20 2004 From: allison at sumeru.stanford.EDU (Dennis Allison) Date: Sun Nov 7 17:11:38 2004 Subject: [Python-Dev] Synchronous and Asynchronous servers in the standard library In-Reply-To: Message-ID: The question, then, is what base should be used for developing asynchonous servers? On Sun, 7 Nov 2004, Jeremy Hylton wrote: > On Mon, 08 Nov 2004 01:32:35 +1100, Anthony Baxter > wrote: > > Josiah Carlson wrote: > > > A recent patch to offer an SMTP server (SocketServer derivative) sparked > > > the below... > > > > > > Question: > > > Does we (and by 'we' I mean those in charge of developing Python) want > > > to offer both asynchronous (deriving from asyncore, asynchat, etc.) and > > > synchronous versions of server software in the standard library? > > > > Personally, I think that encouraging anyone to develop new software on > > top of asyncore/asynchat is a _terrible_ idea. > > I agree. > > Jeremy From foom at fuhm.net Sun Nov 7 17:13:59 2004 From: foom at fuhm.net (James Y Knight) Date: Sun Nov 7 17:14:05 2004 Subject: [Python-Dev] Synchronous and Asynchronous servers in the standard library In-Reply-To: <20041106102107.F853.JCARLSON@uci.edu> References: <20041106102107.F853.JCARLSON@uci.edu> Message-ID: <087A5D6A-30D8-11D9-9BCD-000A95A50FB2@fuhm.net> On Nov 6, 2004, at 6:05 PM, Josiah Carlson wrote: > A recent patch to offer an SMTP server (SocketServer derivative) > sparked > the below... > > Question: > Does we (and by 'we' I mean those in charge of developing Python) want > to offer both asynchronous (deriving from asyncore, asynchat, etc.) and > synchronous versions of server software in the standard library? I'd like to introduce you to Twisted (http://www.twistedmatrix.com). More cooperation and code-sharing between Twisted and Python core developers would certainly be nice. But I don't think the right direction to go for that is writing a bunch of half-assed async servers in Python core. I guarantee you it isn't going to be trivial to do nicely. There has been a small amount of discussion about contributing parts of the Twisted core into Python, but so far no one has volunteered to head that project. So, if you're interested, perhaps you'd like to take it on. I suspect even that will be a lot of work -- you'd have to get consensus on which parts, if any, would be included. Figure out acceptable solutions to versioning skew between twisted releases and python's included copy. Etc. James From arigo at tunes.org Sun Nov 7 17:27:10 2004 From: arigo at tunes.org (Armin Rigo) Date: Sun Nov 7 17:51:29 2004 Subject: [Python-Dev] segfault/Py_FatalError at exit with threads Message-ID: <20041107162710.GA26684@vicky.ecs.soton.ac.uk> Hi, Someone familiar with pystate.c and PyGILState_*() should assign himself to bug http://www.python.org/sf/1061968 -- I don't know all the intricaties of the locking mecanisms to fix it myself... Armin From carribeiro at gmail.com Sun Nov 7 18:00:26 2004 From: carribeiro at gmail.com (Carlos Ribeiro) Date: Sun Nov 7 18:00:44 2004 Subject: [Python-Dev] Re: PEP 336, "Make None Callable", by Andrew McClelland In-Reply-To: <41899E5D.2080303@interlink.com.au> References: <41899E5D.2080303@interlink.com.au> Message-ID: <864d3709041107090070849085@mail.gmail.com> On Thu, 04 Nov 2004 14:13:33 +1100, Anthony Baxter wrote: > > > Abstract > > > > None should be a callable object that when called with any > > arguments has no side effect and returns None. > > My response to this is simply "yuck". This is a hack, abd I > don't think it's worthwhile. If you want to test for None, test > for None. Similarly, if you want a dictionary lookup to default > to a no-op method, there's a perfectly simple way to spell it now: > > def defaultNoopMethod(*args, **kwargs): pass > somedict.get(key, defaultNoopMethod) > > You can even do this as a one-liner using a lambda if you want. Just a question, and I sincerely hope it's not a dumb one. Python already have a noop statement ("pass"). Now, what is being requested is a standard noop callable. Does it make sense -- both in theorethical and practical terms -- to allow a statement such as "pass" to be used in both situations? In other words, does it make sense to have a "unification" of sorts? Thanks for any pointers, -- Carlos Ribeiro Consultoria em Projetos blog: http://rascunhosrotos.blogspot.com blog: http://pythonnotes.blogspot.com mail: carribeiro@gmail.com mail: carribeiro@yahoo.com From martin at v.loewis.de Sun Nov 7 19:08:08 2004 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Sun Nov 7 19:08:11 2004 Subject: [Python-Dev] Re: Bug [ 959379 ] Implicit close() should check for errors In-Reply-To: References: <417E81B1.8080601@v.loewis.de> <417EAD88.7080105@v.loewis.de> Message-ID: <418E6488.6060804@v.loewis.de> Peter Astrand wrote: > Like this?: Yes, look good - please check it in. Martin From martin at v.loewis.de Sun Nov 7 19:20:50 2004 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Sun Nov 7 19:20:53 2004 Subject: [Python-Dev] Re: PEP 336, "Make None Callable", by Andrew McClelland In-Reply-To: <864d3709041107090070849085@mail.gmail.com> References: <41899E5D.2080303@interlink.com.au> <864d3709041107090070849085@mail.gmail.com> Message-ID: <418E6782.6060004@v.loewis.de> Carlos Ribeiro wrote: > Just a question, and I sincerely hope it's not a dumb one. Python > already have a noop statement ("pass"). Now, what is being requested > is a standard noop callable. Does it make sense -- both in > theorethical and practical terms -- to allow a statement such as > "pass" to be used in both situations? In other words, does it make > sense to have a "unification" of sorts? No. Theoretically, the "pass" statement exists for purely syntactical purposes: namely, to put a statement where a statement is required, but no meaningful statement can be found. As a result, "pass" has no run-time semantics: it is not the case that it is executed and does nothing, instead, it is simply not executed. The proposed "function with no effect" would be quite different: it would have a run-time semantics, which would be to ignore all arguments, and return None. Practically, it would be very confusing if the keyword "pass" suddenly started to denote a function. Traditionally, keywords have never denoted expressions. It might be that True, False, and None become keywords some day, but these would *only* be use as expressions. It is unpythonic to give an expression meaning to a statement (just as assignment is not an expression, either). The simplest solution to achieve the rationale of the PEP would be to add a function operator.nop. Of course, writing def nop(*args):pass isn't that more difficult than writing from operator import nop Regards, Martin From jcarlson at uci.edu Sun Nov 7 19:39:43 2004 From: jcarlson at uci.edu (Josiah Carlson) Date: Sun Nov 7 19:47:33 2004 Subject: [Python-Dev] Synchronous and Asynchronous servers in the standard library In-Reply-To: <087A5D6A-30D8-11D9-9BCD-000A95A50FB2@fuhm.net> References: <20041106102107.F853.JCARLSON@uci.edu> <087A5D6A-30D8-11D9-9BCD-000A95A50FB2@fuhm.net> Message-ID: <20041107093047.F85C.JCARLSON@uci.edu> James Y Knight wrote: > > On Nov 6, 2004, at 6:05 PM, Josiah Carlson wrote: > > > A recent patch to offer an SMTP server (SocketServer derivative) > > sparked > > the below... > > > > Question: > > Does we (and by 'we' I mean those in charge of developing Python) want > > to offer both asynchronous (deriving from asyncore, asynchat, etc.) and > > synchronous versions of server software in the standard library? > > I'd like to introduce you to Twisted (http://www.twistedmatrix.com). > > More cooperation and code-sharing between Twisted and Python core > developers would certainly be nice. But I don't think the right > direction to go for that is writing a bunch of half-assed async servers > in Python core. I guarantee you it isn't going to be trivial to do > nicely. There has been a small amount of discussion about contributing > parts of the Twisted core into Python, but so far no one has > volunteered to head that project. So, if you're interested, perhaps > you'd like to take it on. I suspect even that will be a lot of work -- > you'd have to get consensus on which parts, if any, would be included. > Figure out acceptable solutions to versioning skew between twisted > releases and python's included copy. Etc. It seems as though there has already been discussion of getting portions of Twisted into the Python standard library. Being as I have not developed with Twisted, nor am I really a part of the Twisted community, I'm not sure that I am really the right person to try to figure out what parts of Twisted should or should not be included with Python 2.5. Regardless of the asyncore vs Twisted issue, a proper (meta) framework should separate out the calls for "what happens to the internal state when the server receives a reqest like 'foo'", and how the data actually gets to those calls. If done correctly, if/when portions of Twisted make it into the standard library, it shouldn't be terribly difficult to offer a mechanism to use Twisted as a base (for someone with Twisted and stdlib Twisted experience), if such a thing is desired. I suppose the question comes down to; should there be a meta framework for developing servers in Python that specifies a separation between the protocol logic and how data gets to that protocol logic? The desire is for a mechanism to allow people to create a single version of a server in their favorite framework (SocketServer, asyncore, Twisted, or other), and for others to be able to use them in their favorite framework with little difficulty. - Josiah From pje at telecommunity.com Sun Nov 7 20:15:57 2004 From: pje at telecommunity.com (Phillip J. Eby) Date: Sun Nov 7 20:15:21 2004 Subject: [Python-Dev] Synchronous and Asynchronous servers in the standard library In-Reply-To: <20041107093047.F85C.JCARLSON@uci.edu> References: <087A5D6A-30D8-11D9-9BCD-000A95A50FB2@fuhm.net> <20041106102107.F853.JCARLSON@uci.edu> <087A5D6A-30D8-11D9-9BCD-000A95A50FB2@fuhm.net> Message-ID: <5.1.1.6.0.20041107135655.020fbd00@mail.telecommunity.com> At 10:39 AM 11/7/04 -0800, Josiah Carlson wrote: >It seems as though there has already been discussion of getting portions >of Twisted into the Python standard library. Being as I have not >developed with Twisted, nor am I really a part of the Twisted community, >I'm not sure that I am really the right person to try to figure out what >parts of Twisted should or should not be included with Python 2.5. > >Regardless of the asyncore vs Twisted issue, a proper (meta) framework >should separate out the calls for "what happens to the internal state >when the server receives a reqest like 'foo'", and how the data actually >gets to those calls. If done correctly, if/when portions of Twisted >make it into the standard library, it shouldn't be terribly difficult to >offer a mechanism to use Twisted as a base (for someone with Twisted and >stdlib Twisted experience), if such a thing is desired. > >I suppose the question comes down to; should there be a meta framework >for developing servers in Python that specifies a separation between the >protocol logic and how data gets to that protocol logic? The desire is >for a mechanism to allow people to create a single version of a server >in their favorite framework (SocketServer, asyncore, Twisted, or other), >and for others to be able to use them in their favorite framework with >little difficulty. I believe that this may be an unrealistic goal, even though I have done something rather similar myself. There is a myriad assortment of policy issues you'll have to swim upstream past, just to get to the mechanism issues. For example, Twisted assumes its reactor is an interpreter-global, maybe even process-global event loop, whereas asyncore and peak.events allow multiple event loops. I've dabbled in integrating Twisted and peak.events, such that code written for peak.events can run with or without Twisted, and such that an asynchronous server can be run synchronously. So, it's certainly possible to do something like what you're describing, but I'm not sure it's worth the effort versus someone simply installing PEAK and/or Twisted. Now, if the Python standard library included a lightweight task switching facility akin to Armin's greenlets, it might be more practical to include asynchronous communications facilities in the stdlib. Essentially, one could implement a set of communication primitives that task-switched to a global scheduler, or one could supply the scheduler as part of the calls, or provide the primitives as methods of a scheduler, etc. This would bypass most of the architectural policy issues. However, without something like this, you are basically just going to be re-inventing either Twisted or peak.events, depending on whether you prefer a continuation-passing or generator-pseudothread architecture. From bob at redivi.com Sun Nov 7 20:19:09 2004 From: bob at redivi.com (Bob Ippolito) Date: Sun Nov 7 20:19:17 2004 Subject: [Python-Dev] Synchronous and Asynchronous servers in the standard library In-Reply-To: <20041107093047.F85C.JCARLSON@uci.edu> References: <20041106102107.F853.JCARLSON@uci.edu> <087A5D6A-30D8-11D9-9BCD-000A95A50FB2@fuhm.net> <20041107093047.F85C.JCARLSON@uci.edu> Message-ID: On Nov 7, 2004, at 13:39, Josiah Carlson wrote: > I suppose the question comes down to; should there be a meta framework > for developing servers in Python that specifies a separation between > the > protocol logic and how data gets to that protocol logic? The desire is > for a mechanism to allow people to create a single version of a server > in their favorite framework (SocketServer, asyncore, Twisted, or > other), > and for others to be able to use them in their favorite framework with > little difficulty. That's not really practical. You can't use synchronous protocol code in an asynchronous server without threads or Stackless... so what's the point? As for asynchronous frameworks that are compatible with the Python license, I'm only aware of asyncore (which people generally feel should be deprecated) and Twisted. I think the best course of action would be to create some stripped down derivative of Twisted. A couple changes off the top of my head would make it more suitable for the standard library: - Allow generators to be easily used for asynchrony (much easier to write synchronous-like code in that style, this has been demonstrated by several people) - Throw a blocking API on top because some people will want to use it in a blocking manner (Twisted's testing framework already has this functionality) - Allow more than one reactor per process (necessary to support the previous, because invariably people will use the blocking API from several threads) - Bring in some of the standard protocols (SMTP, HTTP, ...) but not the higher-level versions when available (twisted.web) because those are so much more volatile. -bob From jcarlson at uci.edu Sun Nov 7 22:37:10 2004 From: jcarlson at uci.edu (Josiah Carlson) Date: Sun Nov 7 22:44:36 2004 Subject: [Python-Dev] Synchronous and Asynchronous servers in the standard library In-Reply-To: References: <20041107093047.F85C.JCARLSON@uci.edu> Message-ID: <20041107132901.F868.JCARLSON@uci.edu> Bob Ippolito wrote: > That's not really practical. You can't use synchronous protocol code > in an asynchronous server without threads or Stackless... so what's the > point? As for asynchronous frameworks that are compatible with the > Python license, I'm only aware of asyncore (which people generally feel > should be deprecated) and Twisted. At least in the standard library right now, there is really one major difference between sync and async servers; how data gets to and from functions that implement the logic. > I think the best course of action would be to create some stripped down > derivative of Twisted. A couple changes off the top of my head would > make it more suitable for the standard library: > > - Allow generators to be easily used for asynchrony (much easier to > write synchronous-like code in that style, this has been demonstrated > by several people) > - Throw a blocking API on top because some people will want to use it > in a blocking manner (Twisted's testing framework already has this > functionality) > - Allow more than one reactor per process (necessary to support the > previous, because invariably people will use the blocking API from > several threads) > - Bring in some of the standard protocols (SMTP, HTTP, ...) but not > the higher-level versions when available (twisted.web) because those > are so much more volatile. This all sounds reasonable to me, though I am certain that I am not the right man for doing such a conversion. - Josiah From jcarlson at uci.edu Sun Nov 7 22:53:56 2004 From: jcarlson at uci.edu (Josiah Carlson) Date: Sun Nov 7 23:01:36 2004 Subject: [Python-Dev] Synchronous and Asynchronous servers in the standard library In-Reply-To: <5.1.1.6.0.20041107135655.020fbd00@mail.telecommunity.com> References: <20041107093047.F85C.JCARLSON@uci.edu> <5.1.1.6.0.20041107135655.020fbd00@mail.telecommunity.com> Message-ID: <20041107133719.F86E.JCARLSON@uci.edu> "Phillip J. Eby" wrote: > > I believe that this may be an unrealistic goal, even though I have done > something rather similar myself. There is a myriad assortment of policy > issues you'll have to swim upstream past, just to get to the mechanism > issues. For example, Twisted assumes its reactor is an interpreter-global, > maybe even process-global event loop, whereas asyncore and peak.events > allow multiple event loops. > > I've dabbled in integrating Twisted and peak.events, such that code written > for peak.events can run with or without Twisted, and such that an > asynchronous server can be run synchronously. So, it's certainly possible > to do something like what you're describing, but I'm not sure it's worth > the effort versus someone simply installing PEAK and/or Twisted. Since most people are saying that this would be ugly (at least in the realm of Twisted), I'll take back the offer. > Now, if the Python standard library included a lightweight task switching > facility akin to Armin's greenlets, it might be more practical to include > asynchronous communications facilities in the stdlib. Essentially, one > could implement a set of communication primitives that task-switched to a > global scheduler, or one could supply the scheduler as part of the calls, > or provide the primitives as methods of a scheduler, etc. This would > bypass most of the architectural policy issues. Re: greenlets If someone were ambitious, one could write an implementation of greenlets using standard threads for platforms without an optimized greenlets implementation. - Josiah From allison at sumeru.stanford.EDU Mon Nov 8 00:33:35 2004 From: allison at sumeru.stanford.EDU (Dennis Allison) Date: Mon Nov 8 00:33:45 2004 Subject: [Python-Dev] Synchronous and Asynchronous servers in the standard library In-Reply-To: <20041107133719.F86E.JCARLSON@uci.edu> Message-ID: It might be worthwhile to list what the existing problems are with the asyncore and asynchat libraries. There is also the problem that many applications, Zope among them, depend upon them. From andrew-pythondev at puzzling.org Mon Nov 8 01:19:01 2004 From: andrew-pythondev at puzzling.org (Andrew Bennetts) Date: Mon Nov 8 01:19:27 2004 Subject: [Python-Dev] Synchronous and Asynchronous servers in the standard library In-Reply-To: References: <20041107133719.F86E.JCARLSON@uci.edu> Message-ID: <20041108001901.GB477@frobozz> On Sun, Nov 07, 2004 at 03:33:35PM -0800, Dennis Allison wrote: > > It might be worthwhile to list what the existing problems are with the > asyncore and asynchat libraries. There is also the problem that many > applications, Zope among them, depend upon them. One such list is here: http://mail.zope.org/pipermail/zope3-dev/2002-October/003235.html -Andrew. From martin at v.loewis.de Mon Nov 8 06:50:25 2004 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Mon Nov 8 06:50:27 2004 Subject: [Python-Dev] Synchronous and Asynchronous servers in the standard library In-Reply-To: <20041108001901.GB477@frobozz> References: <20041107133719.F86E.JCARLSON@uci.edu> <20041108001901.GB477@frobozz> Message-ID: <418F0921.5040905@v.loewis.de> Andrew Bennetts wrote: > One such list is here: > http://mail.zope.org/pipermail/zope3-dev/2002-October/003235.html I fail to see any of these as problematic: 1. invokes readable/writable in each round, thereby not preserving state; presumably ok for select and poll, but bad (wasting performance for kqueue). I can't see this as a problem: asyncore does use select/poll, not kqueue. In doing so, it first processes all ready file descriptors before going to the next round, so in the next round, it needs to check all dispatchers again. There seems to be an implicit assertion that anything that uses select/poll must be evil, and the only true API is kqueue. I can't claim to understand the rationale for introducing kqueue in the first place, but if it is to improve performance, then I expect that any performance gained in kqueue over select goes away by using Python (e.g. adding an indirection in dispatching is probably more expensive than what kqueue would have saved). 2. ties together protocol and transport. So what? I don't want to use SMTP over UDP, or X.25. TCP, possibly together with TLS, is just fine. 3. tied to sockets. Again: so what? I can't follow the assertion that you cannot use pyOpenSSL because of that, but then, I haven't used pyOpenSSL. The only possible interpretation is that pyOpenSSL does not expose "raw" (pollable) socket objects, which would really sound like a limitation in pyOpenSSL, not in asyncore. a. Cannot use NT I/O completion ports. Again, what's wrong with select? Performance? I'd really like to see a Python application where the speed gain from IOCP is significant compared to using select. The limit of 64 sockets is serious, but Python bumps it to 512. b. cannot do the the TCP transfer code in the C networking core. I don't really understand that point. What is the TCP transfer code? Regards, Martin From ncoghlan at iinet.net.au Mon Nov 8 10:51:14 2004 From: ncoghlan at iinet.net.au (Nick Coghlan) Date: Mon Nov 8 10:51:18 2004 Subject: [Python-Dev] Re: PEP 336, "Make None Callable", by Andrew McClelland In-Reply-To: <418E6782.6060004@v.loewis.de> References: <41899E5D.2080303@interlink.com.au> <864d3709041107090070849085@mail.gmail.com> <418E6782.6060004@v.loewis.de> Message-ID: <418F4192.7020306@iinet.net.au> Martin v. L?wis wrote: > The simplest solution to achieve the rationale of the PEP would be > to add a function operator.nop. Of course, writing > > def nop(*args):pass > > isn't that more difficult than writing > > from operator import nop Although the def version above has problems with keyword arguments. Still, I'd be +0 on def nop(*args, **kwds): pass in the operator module, in the spirit of TOOWTDI. And I meant to add a resounding 'Aye!' to Tim's comment about the debugging value of None not being callable - that's an obvious indicator of 'I screwed up', whereas silently returning None as proposed in the PEP may trigger the error report an arbitrary distance from the original mistake. Cheers, Nick. -- Nick Coghlan | Brisbane, Australia Email: ncoghlan@email.com | Mobile: +61 409 573 268 From jlg at dds.nl Mon Nov 8 11:07:38 2004 From: jlg at dds.nl (Johannes Gijsbers) Date: Mon Nov 8 11:05:08 2004 Subject: [Python-Dev] Bug Day in review Message-ID: <20041108100738.GA5840@surfboy> Well, Python Bug Day 4 was held yesterday. 12 patches and 10 bugs were closed. Also, there are some bugs that are almost closable on http://python.org/moin/PythonBugDayStatus. These need to be reviewed by a committer. Things I noticed: * One one hand, no regressions were introduced, as far as I can tell. On the other hand, it's pretty hard to fix a lot of bugs if you're trying to keep regressions to a minimum. * Most people just don't know where to start with fixing the bugs. We had a list of 'easy-to-fix' bugs on the second bug day, and it worked out pretty well. We should probably prepare one for the next one as well. * The Python bug list may seem pretty large, but it isn't as bad it looks. Most of the bugs are either a corner case or a design limitation. Both types are hard to fix; there are very few glaringly obvious, easy-to-fix bugs left. * I'm still too much of a newbie developer to run a bug day completely by myself. I can help out people with the process of fixing bugs, but I can't simultaneously learn about new parts of the Python source. Conclusions for the next bug day: * I'm willing to organize another bug day, but I'm not going to do it alone. A combination of a more experienced developer (for the hard technical decisions/discussions) and me (for introducing new developers to the process) would probably work out better. * There should be a way to mark bugs as "easy-to-fix". I'll try to work in this into Roundup somehow, but until we migrate to that, I propose that if anyone (committer or otherwise) sees a bug that seems easy to fix for a new developer, (s)he should add it to the PythonBugDayStatus page. * Right before a release probably isn't the best time to hold a bug day. Cheers, Johannes From ncoghlan at iinet.net.au Mon Nov 8 13:40:53 2004 From: ncoghlan at iinet.net.au (Nick Coghlan) Date: Mon Nov 8 13:40:59 2004 Subject: [Python-Dev] Pre-PEP: Executing modules inside packages with '-m' Message-ID: <418F6955.5000509@iinet.net.au> A little later than planned, but I have a draft of the PEP to extend the -m switch to cover modules inside packages. I will note that the SF reference implementation linked to by the PEP is marginally out of date - under certain circumstances (e.g. "python -mpychecker.checker") the current patch on SF can overwrite the C-level argv[0] which I've realised may not be a great idea given the existence of the Py_GetArgcArgv API (the PEP text describes the planned workaround). Regards, Nick. -- Nick Coghlan | Brisbane, Australia Email: ncoghlan@email.com | Mobile: +61 409 573 268 -------------- next part -------------- PEP: XXX Title: Executing modules inside packages with '-m' Version: $Revision: 1.4 $ Last-Modified: $Date: 2003/09/22 04:51:50 $ Author: Nick Coghlan , Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 16-Oct-2004 Python-Version: 2.5 Post-History: 16-Oct-2004 Abstract ======== This PEP defines semantics for executing modules inside packages as scripts with the ``-m`` command line switch. The proposed semantics are that the containing package be imported prior to execution of the script. Rationale ========= Python 2.4 adds the command line switch ``-m`` to allow modules to be located using the Python module namespace for execution as scripts. The motivating examples were standard library modules such as ``pdb`` and ``profile``. A number of users and developers have requested extension of the feature to also support running modules located inside packages. One example provided is pychecker's ``pychecker.checker`` module. This capability was left out of the Python 2.4 implementation because the appropriate semantics are not entirely clear. The opinion on python-dev was that it was better to postpone the extension to Python 2.5, and go through the PEP process to help make sure we got it right. Scope of this proposal ========================== In Python 2.4, a module located using ``-m`` is executed just as if its filename had been provided on the command line. The goal of this PEP is to get as close as possible to making that statement also hold true for modules inside packages. Prior discussions suggest it should be noted that this PEP is **not** about any of the following: - changing the idiom for making Python modules also useful as scripts. - lifting the restriction of ``-m`` to modules of type PY_SOURCE or PY_COMPILED (i.e. ``.py``, ``.pyc``, ``.pyo``,``.pyw``). - addressing the problem of ``-m`` not understanding zip imports or Python's sys.metapath. The issues listed above are considered orthogonal to the specific feature addressed by this PEP. Current Behaviour ================= Before describing the new semantics, it's worth covering the existing semantics for Python 2.4 (as they are currently defined only by the source code). When ``-m`` is used on the command line, it immediately terminates the option list (like ``-c``). The argument is interpreted as the name of a top-level Python module (i.e. one which can be found on ``sys.path``). If the module is found, and is of type ``PY_SOURCE`` or ``PY_COMPILED``, then the command line is effectively reinterpreted from ``python -m `` to ``python ``. This includes setting ``sys.argv[0]`` correctly (some scripts rely on this - Python's own ``regrtest.py`` is one example). If the module is not found, or is not of the correct type, an error is printed. Proposed Semantics ================== The semantics proposed are fairly simple: if ``-m`` is used to execute a module inside a package as a script, then the containing package is imported before executing the module in accordance with the semantics for a top-level module. This is necessary due to the way Python's import machinery locates modules inside packages. A package may modify its own __path__ variable during initialisation. Accordingly, the only way for Python to reliably locate the module is by importing the containing package and inspecting its __path__ variable. Note that the package is *not* imported into the ``__main__`` module's namespace. The effects of these semantics that will be visible to the executed module are: - the containing package will be in sys.modules - any external effects of the package initialisation (e.g. installed import hooks) Reference Implementation ======================== A reference implementation is available on SourceForge [1]_. In this implementation , if the ``-m`` switch fails to locate the requested module at the top level, it effectively reinterprets the command from ``python -m