[issue1411] A typo in tutorial
Georg Brandl added the comment: Fixed in r58921. -- nosy: +georg.brandl resolution: - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1411 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1408] Inconsistence in multiply list
Georg Brandl added the comment: I'm sorry, this is no bug. List multiplication works by referencing, there is no way to implement it differently in a straightforward way. Note that in [a[:]] + [a[:]] the expression a[:] is evaluated twice, yielding two independent copies of a. In contrast, [a[:]] * 2 evaluates a[:] only once, before the list multiplication is done. Because of the same reason, [deepcopy(a)] * 2 doesn't work as you want. One way to do what you have in mind is [a[:] for i in range(2)] which evaluates the a[:] once for each iteration of the list comprehension loop. -- nosy: +georg.brandl resolution: - invalid status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1408 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1409] new keyword-only function parameters interact badly with nested functions
Christian Heimes added the comment: I set this bug to accepted because I was able to reproduce it yesterday. It's all in the history. Scroll down, pal! :) -- nosy: +tiran __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1409 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1409] new keyword-only function parameters interact badly with nested functions
Georg Brandl added the comment: I think you misunderstood the meaning of accepted in our tracker - it may mean I confirm that this is a bug somewhere else, here it means patch accepted. -- nosy: +georg.brandl __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1409 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1401] urllib2 302 POST
Senthil added the comment: Hello Andres, I think we are mixing up 2 or 3 things. Here are my comments. 1) urllib2 POST issue. - Discussion broke on this. No conclusion. 2) GET Request. If we create a GET request (handling 302 as 303) we should remove the content length header! I fail to find a reference for this statement in the RFC. Currently urllib2, gets the headers from the original request and passes the same headers to the redirected url. RFC mentions that we should not change the headers. I quoted the section previously. 3) Handling 30* headers the same way. Yes, urllib2 handles them in the way stating most of the clients apparently handle it the same way. Most of us are okay with it. (Practicality beats Purity). But when we find that something can be improved, we just to add/extend the same. I am working on urilib (sandbox/trunk/urilib) which has some extensions like cached redirection for temporary redirections etc. And for this issue, we just have to find the supporting evidence for: If we create a GET request (handling 302 as 303) we should remove the content length header! If we don't find it,then it is not a bug. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1401 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1401] urllib2 302 POST
Andres Riancho added the comment: As I said in my original bug report, if you don't remove the content-length header or add the data, you are sending an invalid request: START Request= GET http://f00/1.php HTTP/1.1 Content-length: 63 Accept-encoding: identity Accept: */* User-agent: w3af.sourceforge.net Host: f00 Content-type: application/x-www-form-urlencoded END REQUEST === I opened this bug report because this is a bug, not because i'm a RFC purist. I I have time, I'll test the urllib2 patch I coded yesterday and submit it for revision. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1401 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1409] new keyword-only function parameters interact badly with nested functions
Christian Heimes added the comment: Oh, I misinterpreted the meaning of accepted. Can somebody please add a confirmed resolution? __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1409 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1413] int literal methods inaccessible
Michal Božoň added the comment: .. OK, now I see than (1).__str__() works.. however, could be the parser fixed to 1.__str__() work too ? __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1413 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1351] Add getsize() to io instances
Christian Heimes added the comment: Does it's convenient and I'm too lazy to address it in my code whenever the problem arises? count as a darn good use case? No? Mh, I thought so :) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1351 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1414] Fix for refleak tests
Changes by Christian Heimes: -- assignee: gvanrossum keywords: patch, py3k nosy: gvanrossum, tiran priority: low severity: normal status: open title: Fix for refleak tests versions: Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1414 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1414] Fix for refleak tests
New submission from Christian Heimes: The patch prevents some tests from running multiple times in a test session. Added file: http://bugs.python.org/file8720/py3k_reftestfix.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1414 __Index: Lib/test/test_frozen.py === --- Lib/test/test_frozen.py (Revision 58916) +++ Lib/test/test_frozen.py (Arbeitskopie) @@ -4,10 +4,17 @@ from test.test_support import captured_stdout, run_unittest import unittest import sys, os +import warnings class FrozenTests(unittest.TestCase): def test_frozen(self): - +# multiple runs during a test session fail (e.g. a refleak check) +# because the tests depend on some output during the import of +# modules. +if __hello__ in sys.modules: +warnings.warn(multiple runs of test_frozen lead false errors, + RuntimeWarning) +return with captured_stdout() as stdout: try: import __hello__ Index: Lib/test/test_pkg.py === --- Lib/test/test_pkg.py (Revision 58916) +++ Lib/test/test_pkg.py (Arbeitskopie) @@ -6,6 +6,7 @@ import textwrap import traceback import unittest +import warnings from test import test_support @@ -51,7 +52,8 @@ def tearDown(self): sys.path[:] = self.syspath -cleanout(self.root) +if self.root is not None: +cleanout(self.root) def run_code(self, code): exec(textwrap.dedent(code), globals(), {self: self}) @@ -195,6 +197,11 @@ ['__doc__', '__file__', '__name__', 'spam']) def test_6(self): +# multiple runs during a test session fail +if t6 in sys.modules: +warnings.warn(multiple runs of test_6 lead false errors, + RuntimeWarning) +return hier = [ (t6, None), (t6 __init__.py, @@ -221,6 +228,11 @@ self.run_code(s) def test_7(self): +# multiple runs during a test session fail +if t7 in sys.modules: +warnings.warn(multiple runs of test_7 lead false errors, + RuntimeWarning) +return hier = [ (t7.py, ), (t7, None), Index: Lib/test/test_tcl.py === --- Lib/test/test_tcl.py (Revision 58916) +++ Lib/test/test_tcl.py (Arbeitskopie) @@ -2,11 +2,13 @@ import unittest import os +import sys from test import test_support from Tkinter import Tcl from _tkinter import TclError class TclTest(unittest.TestCase): +tk_loaded = False def setUp(self): self.interp = Tcl() @@ -120,16 +122,20 @@ if 'DISPLAY' not in os.environ: # skipping test of clean upgradeability return +if TKLOADED in os.environ: +# workaround for problem when this test runs multiple times in a +# row during refleak test. +# Calling Tk_Init again after a previous call failed might deadlock +return tcl = Tcl() self.assertRaises(TclError,tcl.winfo_geometry) tcl.loadtk() +os.environ[TKLOADED] = yes self.assertEqual('1x1+0+0', tcl.winfo_geometry()) tcl.destroy() def testLoadTkFailure(self): -import os old_display = None -import sys if sys.platform.startswith(('win', 'darwin', 'cygwin')): return # no failure possible on windows? if 'DISPLAY' in os.environ: ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1395] py3k: duplicated line endings when using read(1)
Raghuram Devarakonda added the comment: On 11/8/07, Guido van Rossum [EMAIL PROTECTED] wrote: I do think there is something iffy here -- the 2.x version of this test opens the files in binary mode. I wonder what end users are supposed to do. I think that requirement (need to open in binary mode) is no more present in 3.0. As per revision 56777 (#1767398), csv module seems to support unicode strings and as such I would expect that files *should not* be opened in binary mode (This requires doc change both in csv doc and what's new in 3.0). The tests in test_csv are explicitly writing \r\n which seems to be a hangover from 2.x. We seem to have side-stepped the problem by passing newline='' at some places but the real fix may be changing \r\ns to \n now that the temp files are being opened in text mode. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1395 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1410] BaseHTTPServer cannot accept Unicode data
Christian Heimes added the comment: Due to its nature it is impossible to transmit unicode over the wire. Unicode must always be encoded to bytes before it can be stored on the hard disk or transmitted. Typically it's UTF-8 but in your case it depends on the client's browser and the Request header. The simple BaseHTTPServer isn't clever enough to encode your unicode data on the fly. You have to do it yourself. -- nosy: +tiran __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1410 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1409] new keyword-only function parameters interact badly with nested functions
Georg Brandl added the comment: Please discuss that in the meta tracker (see the report tracker problem link in the sidebar). __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1409 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1409] new keyword-only function parameters interact badly with nested functions
Christian Heimes added the comment: Please discuss that in the meta tracker (see the report tracker problem link in the sidebar). Done http://psf.upfronthosting.co.za/roundup/meta/issue167 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1409 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1414] Fix for refleak tests
Guido van Rossum added the comment: Hm, I was hoping more for patches to the C code that would make these initializations reentrant (e.g. by testing a flag in C that says I'm already initialized). __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1414 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1405] Garbage collection not working correctly in Python 2.3
Stefan Sonnenberg-Carstens added the comment: No, I can't. As many Front Arena Developers on the 1.6/2.0/2.1/2.2 can't. Python 2.4 will be in Front Arena 4.0. Lightyears away from here. Same behaviour seen under Solaris 10 / Python 2.5.1 -- versions: +Python 2.5 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1405 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1405] Garbage collection not working correctly in Python 2.3
Changes by Christian Heimes: -- resolution: out of date - status: closed - open __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1405 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1405] Garbage collection not working correctly in Python 2.3
Paul Pogonyshev added the comment: See if gc.set_threshold (0, 0, 0) helps. -- nosy: +_doublep __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1405 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1403] py_compile and compileall need unit tests
Guido van Rossum added the comment: Why is it still open? -- nosy: +gvanrossum __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1403 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1405] Garbage collection not working correctly in Python 2.3
Guido van Rossum added the comment: How do you know the memory isn't given back? It may be available for reallocation within Python, just not given back to the operating system. That's not necessarily a leak or a bug; that could just be heap fragmentation. There's nothing you can do about it. -- nosy: +gvanrossum __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1405 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1410] BaseHTTPServer cannot accept Unicode data
Changes by Guido van Rossum: -- resolution: - invalid status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1410 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1407] [performance] Too many closed() checkings
Guido van Rossum added the comment: To find out what really happens, use pdb to step through the example. This gives much better insight than adding a printf() call to PyObject_Call(). I've notice myself when stepping through I/O that there are a lot of checks for closed -- this may have to do with the stacking text - buffer - binary though. I've also noticed overridden isinstance checks in abc.py being called, which surprised me slightly. I haven't had time to look into this further though. -- nosy: +gvanrossum __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1407 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1414] Fix for refleak tests
Christian Heimes added the comment: Here is a version of test_freeze that doesn't depend on stdout output on load. Added file: http://bugs.python.org/file8721/py3k_reftestfix2.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1414 __Index: Python/frozen.c === --- Python/frozen.c (Revision 58923) +++ Python/frozen.c (Arbeitskopie) @@ -8,19 +8,18 @@ some famous words... */ /* To regenerate this data after the bytecode or marshal format has changed, - go to ../Tools/freeze/ and freeze the hello.py file; then copy and paste + go to ../Tools/freeze/ and freeze the flag.py file; then copy and paste the appropriate bytes from M___main__.c. */ static unsigned char M___hello__[] = { - 99,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0, - 0,64,0,0,0,115,14,0,0,0,101,0,0,100,0,0, - 131,1,0,1,100,1,0,83,40,2,0,0,0,117,14,0, - 0,0,72,101,108,108,111,32,119,111,114,108,100,46,46,46, - 78,40,1,0,0,0,117,5,0,0,0,112,114,105,110,116, - 40,0,0,0,0,40,0,0,0,0,40,0,0,0,0,117, - 8,0,0,0,104,101,108,108,111,46,112,121,117,8,0,0, - 0,60,109,111,100,117,108,101,62,1,0,0,0,115,0,0, - 0,0, + 99,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0, + 0,64,0,0,0,115,10,0,0,0,100,1,0,90,1,0, + 100,0,0,83,40,2,0,0,0,78,84,40,2,0,0,0, + 117,4,0,0,0,84,114,117,101,117,11,0,0,0,105,110, + 105,116,105,97,108,105,122,101,100,40,0,0,0,0,40,0, + 0,0,0,40,0,0,0,0,117,7,0,0,0,102,108,97, + 103,46,112,121,117,8,0,0,0,60,109,111,100,117,108,101, + 62,1,0,0,0,115,0,0,0,0, }; #define SIZE (int)sizeof(M___hello__) Index: Tools/freeze/flag.py === --- Tools/freeze/flag.py (Revision 0) +++ Tools/freeze/flag.py (Revision 0) @@ -0,0 +1,2 @@ +initialized = True + Eigenschaftsänderungen: Tools/freeze/flag.py ___ Name: svn:keywords + 'Id Revision' Name: svn:eol-style + native Index: Lib/test/test_frozen.py === --- Lib/test/test_frozen.py (Revision 58923) +++ Lib/test/test_frozen.py (Arbeitskopie) @@ -4,38 +4,42 @@ from test.test_support import captured_stdout, run_unittest import unittest import sys, os +import warnings class FrozenTests(unittest.TestCase): def test_frozen(self): +try: +import __hello__ +except ImportError as x: +self.fail(import __hello__ failed: + str(x)) +self.assertEqual(__hello__.initialized, True) +self.assertEqual(len(dir(__hello__)), 5) -with captured_stdout() as stdout: -try: -import __hello__ -except ImportError as x: -self.fail(import __hello__ failed: + str(x)) +try: +import __phello__ +except ImportError as x: +self.fail(import __phello__ failed: + str(x)) +self.assertEqual(__phello__.initialized, True) +if not __phello__.spam in sys.modules: +self.assertEqual(len(dir(__phello__)), 6, dir(__phello__)) +else: +self.assertEqual(len(dir(__phello__)), 7, dir(__phello__)) -try: -import __phello__ -except ImportError as x: -self.fail(import __phello__ failed: + str(x)) +try: +import __phello__.spam +except ImportError as x: +self.fail(import __phello__.spam failed: + str(x)) +self.assertEqual(__phello__.spam.initialized, True) +self.assertEqual(len(dir(__phello__.spam)), 5) +self.assertEqual(len(dir(__phello__)), 7) -try: -import __phello__.spam -except ImportError as x: -self.fail(import __phello__.spam failed: + str(x)) +try: +import __phello__.foo +except ImportError: +pass +else: +self.fail(import __phello__.foo should have failed) -if sys.platform != mac: # On the Mac this import does succeed. -try: -import __phello__.foo -except ImportError: -pass -else: -self.fail(import __phello__.foo should have failed) - -self.assertEquals(stdout.getvalue(), - 'Hello world...\nHello world...\nHello world...\n') - - def test_main(): run_unittest(FrozenTests) Index: Lib/test/test_pkg.py === --- Lib/test/test_pkg.py (Revision 58923) +++ Lib/test/test_pkg.py (Arbeitskopie) @@ -6,6 +6,7 @@ import textwrap import traceback import unittest +import warnings from test import test_support @@ -51,7 +52,8 @@ def tearDown(self): sys.path[:] = self.syspath -cleanout(self.root) +if self.root is not None: +
[issue1403] py_compile and compileall need unit tests
Christian Heimes added the comment: I've left this bug open because no unit tests verifies that compileall can compile all files under Lib/. It has caused a problem with the Windows installer in 3.0a1 for some people. I like to add a compileall followed by a cleanup to make testall. I hope that's called before a release gets out. Index: Makefile.pre.in === --- Makefile.pre.in (Revision 58923) +++ Makefile.pre.in (Arbeitskopie) @@ -610,7 +610,7 @@ TESTOPTS= -l $(EXTRATESTOPTS) TESTPROG= $(srcdir)/Lib/test/regrtest.py -TESTPYTHON=$(RUNSHARED) ./$(BUILDPYTHON) -E -tt +TESTPYTHON=$(RUNSHARED) ./$(BUILDPYTHON) -E -tt -bb test: all platform -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) @@ -618,6 +618,8 @@ testall: all platform -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f + $(TESTPYTHON) Lib/compileall.py + -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall Added file: http://bugs.python.org/file8722/makefile_compileall.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1403 __Index: Makefile.pre.in === --- Makefile.pre.in (Revision 58923) +++ Makefile.pre.in (Arbeitskopie) @@ -610,7 +610,7 @@ TESTOPTS= -l $(EXTRATESTOPTS) TESTPROG= $(srcdir)/Lib/test/regrtest.py -TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -E -tt +TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -E -tt -bb test: all platform -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) @@ -618,6 +618,8 @@ testall: all platform -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f + $(TESTPYTHON) Lib/compileall.py + -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1413] int literal methods inaccessible
Michal Božoň added the comment: I don't understand why 1.j is 1j .. because there's no int.j .. why then 1.L is not 1L ? __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1413 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1413] int literal methods inaccessible
Michal Božoň added the comment: .. however, fixing this is not necessary - because no one would probably use it, it's just a syntax inconsistency __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1413 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1413] int literal methods inaccessible
Michal Božoň added the comment: (finally now I get it.. I have forgotten that complex numbers can be float.. :) sorry ) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1413 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1413] int literal methods inaccessible
Christian Heimes added the comment: It's a tricky problem because it's ambiguous: 1.j What's going to happen here? Does it do getattr(1, 'j') or does it create the imaginary number 1j? -- nosy: +tiran __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1413 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1413] int literal methods inaccessible
Michal Božoň added the comment: .. I remember.. it came onto my mind when I tried also -1.__str__() and found out that the dot has higher priority than unary minus :) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1413 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1410] BaseHTTPServer cannot accept Unicode data
J. Peterson added the comment: As implemented it's not even possible to send UTF-8, because the data = str(data) line only accepts seven bit ASCII with the default encoding. Since there's no easy way to change the encoding str() uses, some other mechanism should be available to do the encoding (as implied by the XXX comment). __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1410 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1410] BaseHTTPServer cannot accept Unicode data
Christian Heimes added the comment: Yes, it's possible to send UTF-8 data: data = utestdata umlaut öäü.encode(utf-8) data 'testdata umlaut \xc3\xb6\xc3\xa4\xc3\xbc' type(data) type 'str' data == str(data) True data is str(data) True You have to encode your unicode string to a byte string. u''.encode(encoding) always returns a string. str() on a string doesn't alter a string. As you can clearly see it's a NOOP (no operation). __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1410 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1410] BaseHTTPServer cannot accept Unicode data
Christian Heimes added the comment: PS: http://www.joelonsoftware.com/articles/Unicode.html is a nice article about unicode and character sets. Joel is amazing when it comes to explaining complex problems in simple words. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1410 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1234] semaphore errors on AIX 5.2
Christian Heimes added the comment: I'm setting the priority to high because it sounds important for AIX users and the patch is *really* simple, just two additional lines for configure.in -- keywords: +patch nosy: +tiran priority: - high versions: +Python 2.5, Python 2.6, Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1234 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1413] int literal methods inaccessible
Michal Božoň added the comment: interesting. I'm not sure I've read anywhere that it is allowed to place a whitespace between object and attributes. Thanks __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1413 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1378] fromfd() and dup() for _socket on WIndows
Christian Heimes added the comment: I've created a clean patch and tested it. It works as promised, great work! Somebody with more Windows Fu than me should verify it before it's applied. -- nosy: +tiran Added file: http://bugs.python.org/file8723/trunk_socket_fromfd.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1378 __Index: Lib/test/test_socket.py === --- Lib/test/test_socket.py (Revision 58923) +++ Lib/test/test_socket.py (Arbeitskopie) @@ -558,7 +558,7 @@ def testFromFd(self): # Testing fromfd() if not hasattr(socket, fromfd): -return # On Windows, this doesn't exist +return # On BeOS, OS/2 and RiscOS this doesn't exist fd = self.cli_conn.fileno() sock = socket.fromfd(fd, socket.AF_INET, socket.SOCK_STREAM) msg = sock.recv(1024) @@ -567,6 +567,27 @@ def _testFromFd(self): self.serv_conn.send(MSG) +def testDup(self): +# Testing dup() +sock = self.cli_conn.dup() +msg = sock.recv(1024) +self.assertEqual(msg, MSG) + +def _testDup(self): +self.serv_conn.send(MSG) + +def testInnerDup(self): +# Testing dup() for the wrapped socket object +inner = self.cli_conn._sock +if not hasattr(inner, dup): +return # On BeOS, OS/2 and RiscOS this doesn't exist +sock = inner.dup() +msg = sock.recv(1024) +self.assertEqual(msg, MSG) + +def _testInnerDup(self): +self.serv_conn.send(MSG) + def testShutdown(self): # Testing shutdown() msg = self.cli_conn.recv(1024) Index: Modules/socketmodule.c === --- Modules/socketmodule.c (Revision 58923) +++ Modules/socketmodule.c (Arbeitskopie) @@ -336,11 +336,32 @@ #include getnameinfo.c #endif -#if defined(MS_WINDOWS) || defined(__BEOS__) +#ifdef MS_WINDOWS +/* On Windows a socket is really a handle not an fd */ +static SOCKET +duplicate_socket(SOCKET handle) +{ + HANDLE newhandle; + + if (!DuplicateHandle(GetCurrentProcess(), (HANDLE)handle, + GetCurrentProcess(), newhandle, + 0, FALSE, DUPLICATE_SAME_ACCESS)) + { + WSASetLastError(WSAEBADF); + return INVALID_SOCKET; + } + return (SOCKET)newhandle; +} +#define dup(fd) duplicate_socket(fd) +#define SOCKETCLOSE closesocket +#define NO_MAKEFILE /* socket handles can't be treated like file handles */ +#endif + +#ifdef __BEOS__ /* BeOS suffers from the same socket dichotomy as Win32... - [cjh] */ /* seem to be a few differences in the API */ #define SOCKETCLOSE closesocket -#define NO_DUP /* Actually it exists on NT 3.5, but what the heck... */ +#define NO_DUP #endif #ifdef MS_WIN32 @@ -357,6 +378,10 @@ #define SOCKETCLOSE close #endif +#ifdef NO_DUP +#define NO_MAKEFILE +#endif + #if defined(HAVE_BLUETOOTH_H) || defined(HAVE_BLUETOOTH_BLUETOOTH_H) #define USE_BLUETOOTH 1 #if defined(__FreeBSD__) @@ -2068,7 +2093,11 @@ PyObject *sock; newfd = dup(s-sock_fd); +#ifdef MS_WINDOWS + if (newfd == INVALID_SOCKET) +#else if (newfd 0) +#endif return s-errorhandler(); sock = (PyObject *) new_sockobject(newfd, s-sock_family, @@ -2176,7 +2205,7 @@ will allow before refusing new connections.); -#ifndef NO_DUP +#ifndef NO_MAKEFILE /* s.makefile(mode) method. Create a new open file object referring to a dupped version of the socket's file descriptor. (The dup() call is necessary so @@ -2237,7 +2266,7 @@ Return a regular file object corresponding to the socket.\n\ The mode and buffersize arguments are as for the built-in open() function.); -#endif /* NO_DUP */ +#endif /* NO_MAKEFILE */ /* * This is the guts of the recv() and recv_into() methods, which reads into a @@ -2791,7 +2820,7 @@ getsockopt_doc}, {listen, (PyCFunction)sock_listen, METH_O, listen_doc}, -#ifndef NO_DUP +#ifndef NO_MAKEFILE {makefile, (PyCFunction)sock_makefile, METH_VARARGS, makefile_doc}, #endif @@ -3481,7 +3510,11 @@ return NULL; /* Dup the fd so it and the socket can be closed independently */ fd = dup(fd); +#ifdef MS_WINDOWS + if (fd == INVALID_SOCKET) +#else if (fd 0) +#endif return set_error(); s = new_sockobject(fd, family, type, proto); return (PyObject *) s; ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue718532] inspect, class instances and __getattr__
Changes by Christian Heimes: -- versions: +Python 2.5, Python 2.6, Python 3.0 Tracker [EMAIL PROTECTED] http://bugs.python.org/issue718532 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1704621] interpreter crash when multiplying large lists
Christian Heimes added the comment: Python 2.5 still seg faults. Python 2.6 and 3.0 are raising a memory error. However I'm unsure if the memory error is also raised in a plain build. I've just Py_DEBUG builds of 2.6 and 3.0 around. -- nosy: +tiran versions: +Python 2.5, Python 2.6, Python 3.0 _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1704621 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue815646] thread unsafe file objects cause crash
Christian Heimes added the comment: I'm still able to reproduce the bug in Python 2.5 (svn) and 2.6 (trunk). import thread f=open(tmp1, w) def worker(): global f while 1: f.close() f=open(tmp1, w) f.seek(0,0) thread.start_new_thread(worker, ()) thread.start_new_thread(worker, ()) Unhandled exception in thread started by function worker at 0xb7d01aac Traceback (most recent call last): *** glibc detected *** ./python: malloc(): memory corruption: 0xb7efc008 *** === Backtrace: = /lib/tls/i686/cmov/libc.so.6[0xb7dbe636] /lib/tls/i686/cmov/libc.so.6(__libc_malloc+0x90)[0xb7dbffc0] /lib/tls/i686/cmov/libc.so.6[0xb7dad03f] /lib/tls/i686/cmov/libc.so.6(fopen64+0x2c)[0xb7daf61c] ./python(PyTraceBack_Print+0x1a4)[0x80ef0f4] ./python(PyErr_Display+0x76)[0x80e73a6] ./python[0x80ed80d] ./python(PyObject_Call+0x27)[0x805c927] ./python(PyEval_CallObjectWithKeywords+0x6c)[0x80c151c] ./python(PyErr_PrintEx+0xbe)[0x80e7e9e] ./python[0x80f37b1] /lib/tls/i686/cmov/libpthread.so.0[0xb7ed146b] /lib/tls/i686/cmov/libc.so.6(clone+0x5e)[0xb7e276de] === Memory map: 08048000-0813d000 r-xp fe:01 10586072 /home/heimes/dev/python/release25-maint/python 0813d000-08162000 rw-p 000f4000 fe:01 10586072 /home/heimes/dev/python/release25-maint/python 08162000-081fe000 rw-p 08162000 00:00 0 [heap] b6a0-b6a21000 rw-p b6a0 00:00 0 b6a21000-b6b0 ---p b6a21000 00:00 0 b6bc1000-b6bc2000 ---p b6bc1000 00:00 0 b6bc2000-b73c2000 rw-p b6bc2000 00:00 0 b73c2000-b73c3000 ---p b73c2000 00:00 0 b73c3000-b7bc3000 rw-p b73c3000 00:00 0 b7bc3000-b7bff000 r-xp 08:05 325941 /lib/libncurses.so.5.6 b7bff000-b7c07000 rw-p 0003b000 08:05 325941 /lib/libncurses.so.5.6 b7c07000-b7c4e000 r-xp 08:05 325837 /lib/libncursesw.so.5.6 b7c4e000-b7c56000 rw-p 00046000 08:05 325837 /lib/libncursesw.so.5.6 b7c56000-b7c82000 r-xp 08:05 325955 /lib/libreadline.so.5.2 b7c82000-b7c86000 rw-p 0002c000 08:05 325955 /lib/libreadline.so.5.2 b7c86000-b7c87000 rw-p b7c86000 00:00 0 b7c87000-b7c8a000 r-xp fe:01 10716611 /home/heimes/dev/python/release25-maint/build/lib.linux-i686-2.5/readline.so b7c8a000-b7c8b000 rw-p 3000 fe:01 10716611 /home/heimes/dev/python/release25-maint/build/lib.linux-i686-2.5/readline.so b7c8b000-b7c92000 r--s 08:05 557857 /usr/lib/gconv/gconv-modules.cache b7c92000-b7cd1000 r--p 08:05 570306 /usr/lib/locale/de_DE.utf8/LC_CTYPE b7cd1000-b7d54000 rw-p b7cd1000 00:00 0 b7d54000-b7e98000 r-xp 08:05 326311 /lib/tls/i686/cmov/libc-2.6.1.so b7e98000-b7e99000 r--p 00143000 08:05 326311 /lib/tls/i686/cmov/libc-2.6.1.so b7e99000-b7e9b000 rw-p 00144000 08:05 326311 /lib/tls/i686/cmov/libc-2.6.1.so b7e9b000-b7e9e000 rw-p b7e9b000 00:00 0 b7e9e000-b7ec1000 r-xp 08:05 326315 /lib/tls/i686/cmov/libm-2.6.1.so b7ec1000-b7ec3000 rw-p 00023000 08:05 326315 /lib/tls/i686/cmov/libm-2.6.1.so b7ec3000-b7ec5000 r-xp 08:05 326330 /lib/tls/i686/cmov/libutil-2.6.1.so b7ec5000-b7ec7000 rw-p 1000 08:05 326330 /lib/tls/i686/cmov/libutil-2.6.1.so b7ec7000-b7ec8000 rw-p b7ec7000 00:00 0 b7ec8000-b7eca000 r-xp 08:05 326314 /lib/tls/i686/cmov/libdl-2.6.1.so b7eca000-b7ecc000 rw-p 1000 08:05 326314 /lib/tls/i686/cmov/libdl-2.6.1.so b7ecc000-b7ee r-xp 08:05 326325 /lib/tls/i686/cmov/libpthread-2.6.1.so b7ee-b7ee2000 rw-p 00013000 08:05 326325 /lib/tls/i686/cmov/libpthread-2.6.1.so b7ee2000-b7ee4000 rw-p b7ee2000 00:00 0 b7ef1000-b7efb000 r-xp 08:05 325908 /lib/libgcc_s.so.1 b7efb000-b7efc000 rw-p a000 08:05 325908 /lib/libgcc_s.so.1 b7efc000-b7f01000 rw-p b7efc000 00:00 0 b7f01000-b7f1b000 r-xp 08:05 326530 /lib/ld-2.6.1.so b7f1b000-b7f1d000 rw-p 00019000 08:05 326530 /lib/ld-2.6.1.so bfcd2000-bfcee000 rw-p bfcd2000 00:00 0 [stack] e000-f000 r-xp 00:00 0 [vdso] However Python 3.0 doesn't crash: Unhandled exception in thread started by function worker at 0x840860c Traceback (most recent call last): File stdin, line 6, in worker File /home/heimes/dev/python/py3k/Lib/io.py, line 1234, in seek self.buffer.seek(pos) File /home/heimes/dev/python/py3k/Lib/io.py, line 877, in seek return self.raw.seek(pos, whence) IOError: [Errno 9] Bad file descriptor -- nosy: +tiran versions: +Python 2.5, Python 2.6 Tracker [EMAIL PROTECTED] http://bugs.python.org/issue815646 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1678380] 0.0 and -0.0 identified, with surprising results
Christian Heimes added the comment: It's fixed in 2.6 but still broken in 2.5. -- nosy: +tiran versions: +Python 2.5 _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1678380 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1413] int literal methods inaccessible
Martin v. Löwis added the comment: See http://www.python.org/doc/2.5/ref/whitespace.html which says that you can put spaces between arbitrary tokens, and http://www.python.org/doc/2.5/ref/attribute-references.html which says that all of primary, ., and identifier are separate tokens in an attributeref (not so in a literal, where the . is part of the floating point literal). __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1413 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1351] Add getsize() to io instances
Martin v. Löwis added the comment: Ok, I'm rejecting it now based on the YAGNI argument Guido brought up, and based on my own concerns. -- resolution: - rejected status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1351 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1415] py3k: pythonw.exe fails to run
New submission from Christian Heimes: pythonw.exe fails to run with a runtime error. python.exe works as expected. While the bug itself isn't serious it should either be fixed or pythonw.exe be omitted from the next alpha release. -- components: Windows keywords: py3k messages: 57342 nosy: tiran priority: high severity: major status: open title: py3k: pythonw.exe fails to run type: crash versions: Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1415 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1415] py3k: pythonw.exe fails to run
Christian Heimes added the comment: Update: pythonw fails because the standard streams can't be initialized. fileno(stdin), fileno(stdout) and fileno(stderr) are returning -2. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1415 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1416] @prop.setter decorators
New submission from Guido van Rossum: Here's an implementation of the idea I floated recently on python-dev (Subject: Declaring setters with getters). This implements the kind of syntax that I believe won over most folks in the end: @property def foo(self): ... @foo.setter def foo(self, value=None): ... There are also .getter and .deleter descriptors. This includes the hack that if you specify a setter but no deleter, the setter is called without a value argument when attempting to delete something. If the setter isn't ready for this, a TypeError will be raised, pretty much just as if no deleter was provided (just with a somewhat worse error message :-). I intend to check this into 2.6 and 3.0 unless there is a huge cry of dismay. Docs will be left to volunteers as always. -- assignee: gvanrossum files: propset.diff keywords: patch messages: 57345 nosy: gvanrossum priority: normal severity: normal status: open title: @prop.setter decorators versions: Python 2.6, Python 3.0 Added file: http://bugs.python.org/file8724/propset.diff __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1416 __Index: Objects/descrobject.c === --- Objects/descrobject.c (revision 58892) +++ Objects/descrobject.c (working copy) @@ -1099,7 +1099,66 @@ {0} }; +PyDoc_STRVAR(getter_doc, + Descriptor to change the setter on a property.); +PyObject * +property_getter(PyObject *self, PyObject *getter) +{ + Py_XDECREF(((propertyobject *)self)-prop_get); + if (getter == Py_None) + getter = NULL; + Py_XINCREF(getter); + ((propertyobject *)self)-prop_get = getter; + Py_INCREF(self); + return self; +} + +PyDoc_STRVAR(setter_doc, + Descriptor to change the setter on a property.\n + This also sets the deleter if it hasn't been set before.); + +PyObject * +property_setter(PyObject *self, PyObject *setter) +{ + Py_XDECREF(((propertyobject *)self)-prop_set); + if (setter == Py_None) + setter = NULL; + Py_XINCREF(setter); + ((propertyobject *)self)-prop_set = setter; + if (((propertyobject *)self)-prop_del == NULL setter != NULL) { + Py_INCREF(setter); + ((propertyobject *)self)-prop_del = setter; + } + Py_INCREF(self); + return self; +} + +PyDoc_STRVAR(deleter_doc, + Descriptor to change the deleter on a property.); + +PyObject * +property_deleter(PyObject *self, PyObject *deleter) +{ + Py_XDECREF(((propertyobject *)self)-prop_del); + if (deleter == Py_None) + deleter = NULL; + Py_XINCREF(deleter); + ((propertyobject *)self)-prop_del = deleter; + Py_INCREF(self); + return self; +} + + + +static PyMethodDef property_methods[] = { + {getter, property_getter, METH_O, getter_doc}, + {setter, property_setter, METH_O, setter_doc}, + {deleter, property_deleter, METH_O, deleter_doc}, + {0} +}; + + static void property_dealloc(PyObject *self) { @@ -1251,7 +1310,7 @@ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - 0, /* tp_methods */ + property_methods, /* tp_methods */ property_members, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ Index: Lib/test/test_descr.py === --- Lib/test/test_descr.py (revision 58892) +++ Lib/test/test_descr.py (working copy) @@ -1984,6 +1984,43 @@ p = property(_testcapi.test_with_docstring) +def properties_more(): +class C: +foo = property(doc=hello) + +@foo.getter +def foo(self): +return self._foo + +@foo.setter +def foo(self, value=None): +if value is None: +del self._foo +else: +self._foo = abs(value) + +c = C() +assert C.foo.__doc__ == hello +assert not hasattr(c, foo) +c.foo = -42 +assert c.foo == 42 +del c.foo +assert not hasattr(c, foo) + +class D(C): +@C.foo.deleter +def foo(self): +try: +del self._foo +except AttributeError: +pass + +d = D() +d.foo = 24 +del d.foo +del d.foo + + def supers(): if verbose: print(Testing super...) ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com