[ python-Bugs-1400227 ] 'is' does not work on methods
Bugs item #1400227, was opened at 2006-01-09 05:04 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1400227&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Interpreter Core Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Collin Winter (collinwinter) Assigned to: Nobody/Anonymous (nobody) Summary: 'is' does not work on methods Initial Comment: As of Python 2.4.2 (gcc 3.3.6, linux 2.6.13), the 'is' comparison operator does not work on instancemethods or classmethods (though it does work on staticmethods). For example: """ >>> class A(object): ... def foo(self): pass ... >>> id(A.foo) == id(A.foo) True >>> A.foo is A.foo False >>> >>> a = A() >>> id(a.foo) == id(a.foo) True >>> a.foo is a.foo False """ This example is applicable to old-style classes and new-style classes, though things get more complicated in the case of built-in types: """ >>> d = dict() >>> id(d.update) == id(d.update) True >>> d.update is d.update False >>> >>> id(dict.update) == id(dict.update) True >>> dict.update is dict.update True """ However, using the classmethod 'fromkeys': """ >>> d = dict() >>> id(d.fromkeys) == id(d.fromkeys) True >>> d.fromkeys is d.fromkeys False >>> >>> id(dict.fromkeys) == id(dict.fromkeys) True >>> dict.fromkeys is dict.fromkeys False """ -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1400227&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1400235 ] 'is' does not work for methods
Bugs item #1400235, was opened at 2006-01-09 05:08 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1400235&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Interpreter Core Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Collin Winter (collinwinter) Assigned to: Nobody/Anonymous (nobody) Summary: 'is' does not work for methods Initial Comment: As of Python 2.4.2 (gcc 3.3.6, linux 2.6.13), the 'is' comparison operator does not work for instancemethods or classmethods (though it does work for staticmethods). For example: """ >>> class A(object): ... def foo(self): pass ... >>> id(A.foo) == id(A.foo) True >>> A.foo is A.foo False >>> >>> a = A() >>> id(a.foo) == id(a.foo) True >>> a.foo is a.foo False """ This example is applicable to old-style classes and new-style classes, though things get more complicated in the case of built-in types: """ >>> d = dict() >>> id(d.update) == id(d.update) True >>> d.update is d.update False >>> >>> id(dict.update) == id(dict.update) True >>> dict.update is dict.update True """ However, using the classmethod 'fromkeys': """ >>> d = dict() >>> id(d.fromkeys) == id(d.fromkeys) True >>> d.fromkeys is d.fromkeys False >>> >>> id(dict.fromkeys) == id(dict.fromkeys) True >>> dict.fromkeys is dict.fromkeys False """ -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1400235&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1400235 ] 'is' does not work for methods
Bugs item #1400235, was opened at 2006-01-09 05:08 Message generated for change (Settings changed) made by collinwinter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1400235&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Interpreter Core Group: Python 2.4 >Status: Deleted >Resolution: Duplicate Priority: 5 Submitted By: Collin Winter (collinwinter) Assigned to: Nobody/Anonymous (nobody) Summary: 'is' does not work for methods Initial Comment: As of Python 2.4.2 (gcc 3.3.6, linux 2.6.13), the 'is' comparison operator does not work for instancemethods or classmethods (though it does work for staticmethods). For example: """ >>> class A(object): ... def foo(self): pass ... >>> id(A.foo) == id(A.foo) True >>> A.foo is A.foo False >>> >>> a = A() >>> id(a.foo) == id(a.foo) True >>> a.foo is a.foo False """ This example is applicable to old-style classes and new-style classes, though things get more complicated in the case of built-in types: """ >>> d = dict() >>> id(d.update) == id(d.update) True >>> d.update is d.update False >>> >>> id(dict.update) == id(dict.update) True >>> dict.update is dict.update True """ However, using the classmethod 'fromkeys': """ >>> d = dict() >>> id(d.fromkeys) == id(d.fromkeys) True >>> d.fromkeys is d.fromkeys False >>> >>> id(dict.fromkeys) == id(dict.fromkeys) True >>> dict.fromkeys is dict.fromkeys False """ -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1400235&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Feature Requests-1400252 ] invoking an external Java program from Python script
Feature Requests item #1400252, was opened at 2006-01-09 10:31 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1400252&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Laure (elsa_petit) Assigned to: Nobody/Anonymous (nobody) Summary: invoking an external Java program from Python script Initial Comment: I would like to invoke a .jar Java file from a Python script (python24). I am new to Java and don't want to use JPype or Jython. -What is the code I should use as command line? -Where should I place my .jar file, should it be placed in the Python directory? - I am in windows but would like to know what are the differences according to each OS used? -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1400252&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1400227 ] 'is' does not work on methods
Bugs item #1400227, was opened at 2006-01-09 10:04 Message generated for change (Comment added) made by mwh You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1400227&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Interpreter Core Group: Python 2.4 >Status: Closed >Resolution: Invalid Priority: 5 Submitted By: Collin Winter (collinwinter) >Assigned to: Michael Hudson (mwh) Summary: 'is' does not work on methods Initial Comment: As of Python 2.4.2 (gcc 3.3.6, linux 2.6.13), the 'is' comparison operator does not work on instancemethods or classmethods (though it does work on staticmethods). For example: """ >>> class A(object): ... def foo(self): pass ... >>> id(A.foo) == id(A.foo) True >>> A.foo is A.foo False >>> >>> a = A() >>> id(a.foo) == id(a.foo) True >>> a.foo is a.foo False """ This example is applicable to old-style classes and new-style classes, though things get more complicated in the case of built-in types: """ >>> d = dict() >>> id(d.update) == id(d.update) True >>> d.update is d.update False >>> >>> id(dict.update) == id(dict.update) True >>> dict.update is dict.update True """ However, using the classmethod 'fromkeys': """ >>> d = dict() >>> id(d.fromkeys) == id(d.fromkeys) True >>> d.fromkeys is d.fromkeys False >>> >>> id(dict.fromkeys) == id(dict.fromkeys) True >>> dict.fromkeys is dict.fromkeys False """ -- >Comment By: Michael Hudson (mwh) Date: 2006-01-09 11:39 Message: Logged In: YES user_id=6656 'is' is working just fine here. When you execute 'a.foo' a fresh bound method object is made, so two executions lead to two different objects. The thing that probably confused you was this: >>> id(a.foo) == id(a.foo) True What happens here is that you execute 'a.foo' which returns a bound method object, you call id() on it, the bound method gets deleted, you execute 'a.foo' again and call id() on the new bound method object -- which happens to be allocated at the same place in memory as the previous one, so the id()s are the same. Closing. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1400227&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1377858 ] segfaults when using __del__ and weakrefs
Bugs item #1377858, was opened at 2005-12-10 21:20 Message generated for change (Comment added) made by mwh You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1377858&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Interpreter Core Group: Python 2.4 Status: Open Resolution: None Priority: 7 Submitted By: Carl Friedrich Bolz (cfbolz) Assigned to: Nobody/Anonymous (nobody) Summary: segfaults when using __del__ and weakrefs Initial Comment: You can segfault Python by creating a weakref to an object in its __del__ method, storing it somewhere and then trying to dereference the weakref afterwards. the attached file shows the described behaviour. -- >Comment By: Michael Hudson (mwh) Date: 2006-01-09 11:54 Message: Logged In: YES user_id=6656 Hmm, I was kind of hoping this report would get more attention. The problem is obvious if you read typeobject.c around line 660: the weakref list is cleared before __del__ is called, so any weakrefs added during the execution of __del__ are never informed of the object's death. One fix for this would be to clear the weakref list _after_ calling __del__ but that led to other mayhem in ways I haven't boethered to understand (see SF bug #742911). I guess we could just clear out any weakrefs created in __del__ without calling their callbacks. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1377858&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1377858 ] segfaults when using __del__ and weakrefs
Bugs item #1377858, was opened at 2005-12-10 21:20 Message generated for change (Comment added) made by mwh You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1377858&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Interpreter Core Group: Python 2.4 Status: Open Resolution: None Priority: 7 Submitted By: Carl Friedrich Bolz (cfbolz) Assigned to: Nobody/Anonymous (nobody) Summary: segfaults when using __del__ and weakrefs Initial Comment: You can segfault Python by creating a weakref to an object in its __del__ method, storing it somewhere and then trying to dereference the weakref afterwards. the attached file shows the described behaviour. -- >Comment By: Michael Hudson (mwh) Date: 2006-01-09 11:58 Message: Logged In: YES user_id=6656 Hmm, maybe the referenced mayhem is more to do with clearing __dict__ than calling __del__. What breaks if we do things in this order: 1. call __del__ 2. clear weakrefs 3. clear __dict__ ? -- Comment By: Michael Hudson (mwh) Date: 2006-01-09 11:54 Message: Logged In: YES user_id=6656 Hmm, I was kind of hoping this report would get more attention. The problem is obvious if you read typeobject.c around line 660: the weakref list is cleared before __del__ is called, so any weakrefs added during the execution of __del__ are never informed of the object's death. One fix for this would be to clear the weakref list _after_ calling __del__ but that led to other mayhem in ways I haven't boethered to understand (see SF bug #742911). I guess we could just clear out any weakrefs created in __del__ without calling their callbacks. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1377858&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-874534 ] 2.[345]: --with-wctype-functions 4 test failures
Bugs item #874534, was opened at 2004-01-10 19:32 Message generated for change (Comment added) made by lemburg You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=874534&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: Python 2.5 Status: Open Resolution: None Priority: 5 Submitted By: Pierre (pierre42) Assigned to: Neal Norwitz (nnorwitz) Summary: 2.[345]: --with-wctype-functions 4 test failures Initial Comment: # gmake test case $MAKEFLAGS in \ *-s*) LD_LIBRARY_PATH=/tmp/Python-2.3.3:/usr/local/lib:/usr/local/qt/lib:/usr/local/kde/lib:/usr/local/pwlib/lib:/usr/local/openh323/lib CC='gcc' LDSHARED='gcc -shared' OPT='-DNDEBUG -g -O3 -Wall -Wstrict-prototypes' ./python -E ./setup.py -q build;; \ *) LD_LIBRARY_PATH=/tmp/Python-2.3.3:/usr/local/lib:/usr/local/qt/lib:/usr/local/kde/lib:/usr/local/pwlib/lib:/usr/local/openh323/lib CC='gcc' LDSHARED='gcc -shared' OPT='-DNDEBUG -g -O3 -Wall -Wstrict-prototypes' ./python -E ./setup.py build;; \ esac running build running build_ext building 'dbm' extension gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -fno-strict-aliasing -DHAVE_NDBM_H -I. -I/tmp/Python-2.3.3/./Include -I/usr/local/include -I/tmp/Python-2.3.3/Include -I/tmp/Python-2.3.3 -c /tmp/Python-2.3.3/Modules/dbmmodule.c -o build/temp.linux-i686-2.3/dbmmodule.o gcc -shared build/temp.linux-i686-2.3/dbmmodule.o -L/usr/local/lib -o build/lib.linux-i686-2.3/dbm.so *** WARNING: renaming "dbm" since importing it failed: build/lib.linux-i686-2.3/dbm.so: undefined symbol: dbm_firstkey running build_scripts find ./Lib -name '*.py[co]' -print | xargs rm -f LD_LIBRARY_PATH=/tmp/Python-2.3.3:/usr/local/lib:/usr/local/qt/lib:/usr/local/kde/lib:/usr/local/pwlib/lib:/usr/local/openh323/lib ./python -E -tt ./Lib/test/regrtest.py -l test_grammar [...] test_codecs test test_codecs failed -- Traceback (most recent call last): File "/tmp/Python-2.3.3/Lib/test/test_codecs.py", line 333, in test_nameprep raise test_support.TestFailed("Test 3.%d: %s" % (pos+1, str(e))) TestFailed: Test 3.5: u'\u0143 \u03b9' != u'\u0144 \u03b9' test_codeop [...] test_format /tmp/Python-2.3.3/Lib/test/test_format.py:19: FutureWarning: %u/%o/%x/%X of negative int will return a signed string in Python 2.4 and up result = formatstr % args test_fpformat [...] test_re test test_re produced unexpected output: ** *** lines 2-3 of actual output doesn't appear in expected output after line 1: + === Failed incorrectly ('(?u)\\b.\\b', u'\xc4', 0, 'found', u'\xc4') + === Failed incorrectly ('(?u)\\w', u'\xc4', 0, 'found', u'\xc4') ** test_regex [...] test_unicode test test_unicode failed -- errors occurred in test.test_unicode.UnicodeTest test_unicode_file test_unicode_file skipped -- No Unicode filesystem semantics on this platform. test_unicodedata test test_unicodedata failed -- Traceback (most recent call last): File "/tmp/Python-2.3.3/Lib/test/test_unicodedata.py", line 62, in test_method_checksum self.assertEqual(result, self.expectedchecksum) File "/tmp/Python-2.3.3/Lib/unittest.py", line 302, in failUnlessEqual raise self.failureException, \ AssertionError: 'c269de8355871e3210ae8710b45c2ddb0675b9d5' != 'a37276dc2c158bef6dfd908ad34525c97180fad9' test_univnewlines [...] test_zlib 222 tests OK. 4 tests failed: test_codecs test_re test_unicode test_unicodedata 29 tests skipped: test_aepack test_al test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_dbm test_email_codecs test_gl test_imgfile test_linuxaudiodev test_locale test_macfs test_macostools test_nis test_normalization test_ossaudiodev test_pep277 test_plistlib test_scriptpackages test_socket_ssl test_socketserver test_sunaudiodev test_timeout test_unicode_file test_urllibnet test_winreg test_winsound 2 skips unexpected on linux2: test_dbm test_locale gmake: *** [test] Error 1 -- >Comment By: M.-A. Lemburg (lemburg) Date: 2006-01-09 13:11 Message: Logged In: YES user_id=38388 This option should/will go away in Python 2.5, so I don't think there's a need to bother with trying to fix problems related to it. The reason for the removal is that the option causes semantical problems and makes Unicode work in non-standard ways on platforms that use locale-aware extensions to the wc-type functions. -- Comment By: Neal Norwitz (nnorwitz) Date: 2006-01-09 06:47 Message: Logged In: YES user_id=33168 Confirmed these are still a current problem in SVN. The problem is: --with-wctype-functions. With this option all 4 tests fail on amd64 gentoo linux.
[ python-Feature Requests-1353344 ] python.desktop
Feature Requests item #1353344, was opened at 2005-11-10 19:22 Message generated for change (Comment added) made by sonderblade You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1353344&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Installation Group: None Status: Open Resolution: None Priority: 5 Submitted By: Björn Lindqvist (sonderblade) Assigned to: Nobody/Anonymous (nobody) Summary: python.desktop Initial Comment: I would very much like a /usr/share/applications/python.desktop file so that Python can be started from the Program-menu in Linux, just like you can from the Start-menu in Windows. I think it would be very neat and good for beginners. -- >Comment By: Björn Lindqvist (sonderblade) Date: 2006-01-09 18:52 Message: Logged In: YES user_id=51702 In trunk there are PC/py.ico, PC/pyc.ico, PC/pycon.ico. I guess they would all work as icons, but I choose pycon.ico because that is the icon used on windows. I also wonder if the desktop file can be applied soon? It seems pretty trivial and uncontroversial to me. -- Comment By: Georg Brandl (birkenfeld) Date: 2005-11-17 14:43 Message: Logged In: YES user_id=1188172 I added German translation. Regarding the icon: I do not like that very much. Isn't there another Python icon available in the standard sizes? -- Comment By: Björn Lindqvist (sonderblade) Date: 2005-11-16 19:16 Message: Logged In: YES user_id=51702 I have attached a .desktop file and an icon. python.desktop goes into /usr/share/applications and pycon.png into /usr/share/pixmaps. It's only translated to Swedish because I don't know other languages to well. -- Comment By: Martin v. Löwis (loewis) Date: 2005-11-13 23:41 Message: Logged In: YES user_id=21627 Would you be willing to provide one? -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1353344&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Feature Requests-1400252 ] invoking an external Java program from Python script
Feature Requests item #1400252, was opened at 2006-01-09 11:31 Message generated for change (Comment added) made by birkenfeld You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1400252&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Invalid Priority: 5 Submitted By: Laure (elsa_petit) Assigned to: Nobody/Anonymous (nobody) Summary: invoking an external Java program from Python script Initial Comment: I would like to invoke a .jar Java file from a Python script (python24). I am new to Java and don't want to use JPype or Jython. -What is the code I should use as command line? -Where should I place my .jar file, should it be placed in the Python directory? - I am in windows but would like to know what are the differences according to each OS used? -- >Comment By: Georg Brandl (birkenfeld) Date: 2006-01-09 19:58 Message: Logged In: YES user_id=1188172 Please ask such questions in the comp.lang.python newsgroup. This tracker is for feature requests. What you're asking is already possible with today's Python. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1400252&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1281383 ] array.arrays are not unpickleable
Bugs item #1281383, was opened at 2005-09-03 13:16 Message generated for change (Comment added) made by mbrighton You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1281383&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Extension Modules Group: Python 2.4 Status: Closed Resolution: Invalid Priority: 6 Submitted By: Georg Brandl (birkenfeld) Assigned to: Nobody/Anonymous (nobody) Summary: array.arrays are not unpickleable Initial Comment: Credits to John Machin for discovering this. """ Googling for "pickle array" in comp.lang.python yields old messages that show a PickleError -- plus one message where Alex Martelli writes "I am but an egg" :O) Looks like arrays are NOW (2.4.1) pickleable but not unpickleable -- see below. I appreciate that arrays are inherently not pickleable because of the type code. However: (1) Anyone know why/when the world changed? (2) If we had alternative constructors like array.iarray(contents) in parallel to array.array('i', contents), those objects could be pickled/unpickled -- yes/no? Cheers, John Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import pickle, array >>> class Foo(object): ...pass ... >>> foo = Foo() >>> foo.ia = array.array('i', [3,2,1]) >>> foo.ia array('i', [3, 2, 1]) >>> s = pickle.dumps(foo, -1) >>> bar = pickle.loads(s) Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\lib\pickle.py", line 1394, in loads return Unpickler(file).load() File "C:\Python24\lib\pickle.py", line 872, in load dispatch[key](self) File "C:\Python24\lib\pickle.py", line 1097, in load_newobj obj = cls.__new__(cls, *args) TypeError: array() takes at least 1 argument (0 given) === """ -- Comment By: Mark C. Brighton (mbrighton) Date: 2006-01-09 15:07 Message: Logged In: YES user_id=1423362 >From the comments, it appears that the developers didn't notice that the example used protocol '-1' (highest protocol, which is 2 in Py2.4). Using protocol 0 (default) or 1 will give the TypeError (which is appropriate). Using protocol 2, pickle.dumps() will accept a pickle object without an exception, but it doesn't seem to pickle it properly (see log below). Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import array >>> import pickle >>> a=array.array('B') >>> s= pickle.dumps(a,2);s '\x80\x02carray\narray\nq\x00)\x81q\x01.' >>> pickle.load(s) Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\lib\pickle.py", line 1390, in load return Unpickler(file).load() File "C:\Python24\lib\pickle.py", line 855, in __init__ self.readline = file.readline AttributeError: 'str' object has no attribute 'readline' >>> >>> a=array.array('B', [1,2,3,4,5]) >>> a array('B', [1, 2, 3, 4, 5]) >>> s2=pickle.dumps(a,2);s2 '\x80\x02carray\narray\nq\x00)\x81q\x01.' -- Comment By: Terry J. Reedy (tjreedy) Date: 2005-09-08 12:39 Message: Logged In: YES user_id=593130 http://python.org/sf/1281556 appears to be a duplicate. You wish to close it too? (I won't, don't know enough here.) -- Comment By: Raymond Hettinger (rhettinger) Date: 2005-09-07 23:36 Message: Logged In: YES user_id=80475 I think you're misunderstanding. Direct pickling of arrays does raise a TypeError. It would be nice if it also did as an object attribute; however, I'm not bothered by it enough to spend development time tracing down the issue and then altering otherwise correct Py2.4 code just to generate a prettier message. It is enough for me that the docs do not promise pickling, that a message is generated by a direct attempt to pickle, that the OP's buggy code eventually errors out, and that everything works fine in Py2.5. I have no objections to someone finding a way to generate a better error message but think the time would better be spent elsewhere. >>> from array import array >>> from pickle import dumps, loads >>> ia = array('i', [3,2,1]) >>> ib = loads(dumps(ia)) Traceback (most recent call last): . . . TypeError: can't pickle array objects -- Comment By: Josiah Carlson (josiahcarlson) Date: 2005-09-07 23:04 Message: Logged In: YES user_id=341410 Raymond, they seem to be asking for Pickle and cPickle to raise an exception when someone attempts to pickle arrays in a future Python 2.4.2 release. I don't think that is a new feature.
[ python-Bugs-1400822 ] Extended version of _curses over{lay, write} does not work.
Bugs item #1400822, was opened at 2006-01-09 18:27 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1400822&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Extension Modules Group: Python 2.3 Status: Open Resolution: None Priority: 5 Submitted By: J. Sipprell (jsipprell) Assigned to: Nobody/Anonymous (nobody) Summary: Extended version of _curses over{lay,write} does not work. Initial Comment: 2.3/2.4 library docs indicate the following for the curses window object methods 'overlay' and 'overwrite': "To get fine-grained control over the copied region, the second form of overwrite() can be used. sminrow and smincol are the upper-left coordinates of the source window, the other variables mark a rectangle in the destination window." [syntax: overlay(destwin[, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol])] However, attempting to use the 7 arg form of either overlay or overwrite results in a TypeError being raised. Inspection of the PyCursesWindow_Overlay and PyCursesWindow_Overwrite functions from _cursesmodule.c reveals an incorrect format for the 7-arg specific call to PyArg_ParseTuple, such that a single argument tuple is expected which would contain the method arguments. Obviously, this is incompatible with the general argument length conditional used to decide which PyArg_ParseTuple will be used. The bug has only been verified on python 2.3.5, not 2.4, however a cursory examination of 2.4 code reveals no differences in these functions. The attached patch alters the PyArg_ParseTuple format string for both functions such that seven arguments are parsed as expected and the related copywin() code is thus executed. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1400822&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1281383 ] array.arrays are not unpickleable
Bugs item #1281383, was opened at 2005-09-03 13:16 Message generated for change (Comment added) made by josiahcarlson You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1281383&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Extension Modules Group: Python 2.4 Status: Closed Resolution: Invalid Priority: 6 Submitted By: Georg Brandl (birkenfeld) Assigned to: Nobody/Anonymous (nobody) Summary: array.arrays are not unpickleable Initial Comment: Credits to John Machin for discovering this. """ Googling for "pickle array" in comp.lang.python yields old messages that show a PickleError -- plus one message where Alex Martelli writes "I am but an egg" :O) Looks like arrays are NOW (2.4.1) pickleable but not unpickleable -- see below. I appreciate that arrays are inherently not pickleable because of the type code. However: (1) Anyone know why/when the world changed? (2) If we had alternative constructors like array.iarray(contents) in parallel to array.array('i', contents), those objects could be pickled/unpickled -- yes/no? Cheers, John Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import pickle, array >>> class Foo(object): ...pass ... >>> foo = Foo() >>> foo.ia = array.array('i', [3,2,1]) >>> foo.ia array('i', [3, 2, 1]) >>> s = pickle.dumps(foo, -1) >>> bar = pickle.loads(s) Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\lib\pickle.py", line 1394, in loads return Unpickler(file).load() File "C:\Python24\lib\pickle.py", line 872, in load dispatch[key](self) File "C:\Python24\lib\pickle.py", line 1097, in load_newobj obj = cls.__new__(cls, *args) TypeError: array() takes at least 1 argument (0 given) === """ -- Comment By: Josiah Carlson (josiahcarlson) Date: 2006-01-09 17:03 Message: Logged In: YES user_id=341410 mbrighton: You get a string from pickle.dumps(), and to load strings, you should use pickle.loads() . The AttributeError you are recieving is the result of using pickle.load() with a string, not a file object, as required, and as described by the documentation. -- Comment By: Mark C. Brighton (mbrighton) Date: 2006-01-09 15:07 Message: Logged In: YES user_id=1423362 >From the comments, it appears that the developers didn't notice that the example used protocol '-1' (highest protocol, which is 2 in Py2.4). Using protocol 0 (default) or 1 will give the TypeError (which is appropriate). Using protocol 2, pickle.dumps() will accept a pickle object without an exception, but it doesn't seem to pickle it properly (see log below). Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import array >>> import pickle >>> a=array.array('B') >>> s= pickle.dumps(a,2);s '\x80\x02carray\narray\nq\x00)\x81q\x01.' >>> pickle.load(s) Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\lib\pickle.py", line 1390, in load return Unpickler(file).load() File "C:\Python24\lib\pickle.py", line 855, in __init__ self.readline = file.readline AttributeError: 'str' object has no attribute 'readline' >>> >>> a=array.array('B', [1,2,3,4,5]) >>> a array('B', [1, 2, 3, 4, 5]) >>> s2=pickle.dumps(a,2);s2 '\x80\x02carray\narray\nq\x00)\x81q\x01.' -- Comment By: Terry J. Reedy (tjreedy) Date: 2005-09-08 12:39 Message: Logged In: YES user_id=593130 http://python.org/sf/1281556 appears to be a duplicate. You wish to close it too? (I won't, don't know enough here.) -- Comment By: Raymond Hettinger (rhettinger) Date: 2005-09-07 23:36 Message: Logged In: YES user_id=80475 I think you're misunderstanding. Direct pickling of arrays does raise a TypeError. It would be nice if it also did as an object attribute; however, I'm not bothered by it enough to spend development time tracing down the issue and then altering otherwise correct Py2.4 code just to generate a prettier message. It is enough for me that the docs do not promise pickling, that a message is generated by a direct attempt to pickle, that the OP's buggy code eventually errors out, and that everything works fine in Py2.5. I have no objections to someone finding a way to generate a better error message but think the time would better be spent elsewhere. >>> from array import array >>> from pickle import dumps, loads >>> ia = array('i', [3,2,1]) >>> ib = loads(dumps(ia)) T
[ python-Bugs-1281383 ] array.arrays are not unpickleable
Bugs item #1281383, was opened at 2005-09-03 13:16 Message generated for change (Comment added) made by mbrighton You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1281383&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Extension Modules Group: Python 2.4 Status: Closed Resolution: Invalid Priority: 6 Submitted By: Georg Brandl (birkenfeld) Assigned to: Nobody/Anonymous (nobody) Summary: array.arrays are not unpickleable Initial Comment: Credits to John Machin for discovering this. """ Googling for "pickle array" in comp.lang.python yields old messages that show a PickleError -- plus one message where Alex Martelli writes "I am but an egg" :O) Looks like arrays are NOW (2.4.1) pickleable but not unpickleable -- see below. I appreciate that arrays are inherently not pickleable because of the type code. However: (1) Anyone know why/when the world changed? (2) If we had alternative constructors like array.iarray(contents) in parallel to array.array('i', contents), those objects could be pickled/unpickled -- yes/no? Cheers, John Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import pickle, array >>> class Foo(object): ...pass ... >>> foo = Foo() >>> foo.ia = array.array('i', [3,2,1]) >>> foo.ia array('i', [3, 2, 1]) >>> s = pickle.dumps(foo, -1) >>> bar = pickle.loads(s) Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\lib\pickle.py", line 1394, in loads return Unpickler(file).load() File "C:\Python24\lib\pickle.py", line 872, in load dispatch[key](self) File "C:\Python24\lib\pickle.py", line 1097, in load_newobj obj = cls.__new__(cls, *args) TypeError: array() takes at least 1 argument (0 given) === """ -- Comment By: Mark C. Brighton (mbrighton) Date: 2006-01-09 17:11 Message: Logged In: YES user_id=1423362 Thatks for catching that. Unfortunatly, that's just a function of me editing the example. I ment to edit that out and instead took out the exception I was trying to show. Here's what I ment to demonstrate: >>> import array >>> import pickle >>> a=array.array('B') >>> s= pickle.dumps(a,2);s '\x80\x02carray\narray\nq\x00)\x81q\x01.' >>> pickle.loads(s) Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\lib\pickle.py", line 1394, in loads return Unpickler(file).load() File "C:\Python24\lib\pickle.py", line 872, in load dispatch[key](self) File "C:\Python24\lib\pickle.py", line 1097, in load_newobj obj = cls.__new__(cls, *args) TypeError: array() takes at least 1 argument (0 given) The part of the problem appears to be with dumps(), as the same string is returned independent of the array provided: >>> pickle.dumps(array.array('B'),2) '\x80\x02carray\narray\nq\x00)\x81q\x01.' >>> pickle.dumps(array.array('B', [1,2,3,4,5]),2) '\x80\x02carray\narray\nq\x00)\x81q\x01.' >>> pickle.dumps(array.array('B', [230,]*100),2) '\x80\x02carray\narray\nq\x00)\x81q\x01.' >>> pickle.dumps(array.array('H', [1,2,3,4,5]),2) '\x80\x02carray\narray\nq\x00)\x81q\x01.' -- Comment By: Josiah Carlson (josiahcarlson) Date: 2006-01-09 17:03 Message: Logged In: YES user_id=341410 mbrighton: You get a string from pickle.dumps(), and to load strings, you should use pickle.loads() . The AttributeError you are recieving is the result of using pickle.load() with a string, not a file object, as required, and as described by the documentation. -- Comment By: Mark C. Brighton (mbrighton) Date: 2006-01-09 15:07 Message: Logged In: YES user_id=1423362 >From the comments, it appears that the developers didn't notice that the example used protocol '-1' (highest protocol, which is 2 in Py2.4). Using protocol 0 (default) or 1 will give the TypeError (which is appropriate). Using protocol 2, pickle.dumps() will accept a pickle object without an exception, but it doesn't seem to pickle it properly (see log below). Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import array >>> import pickle >>> a=array.array('B') >>> s= pickle.dumps(a,2);s '\x80\x02carray\narray\nq\x00)\x81q\x01.' >>> pickle.load(s) Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\lib\pickle.py", line 1390, in load return Unpickler(file).load() File "C:\Python24\lib\pickle.py", line 855, in __init__ self.readline = file.readline AttributeError: 'str' object has no attribute 'readline' >>> >>>
[ python-Bugs-1400822 ] Extended version of _curses over{lay, write} does not work.
Bugs item #1400822, was opened at 2006-01-09 15:27 Message generated for change (Comment added) made by nnorwitz You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1400822&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Extension Modules Group: Python 2.3 >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: J. Sipprell (jsipprell) >Assigned to: Neal Norwitz (nnorwitz) Summary: Extended version of _curses over{lay,write} does not work. Initial Comment: 2.3/2.4 library docs indicate the following for the curses window object methods 'overlay' and 'overwrite': "To get fine-grained control over the copied region, the second form of overwrite() can be used. sminrow and smincol are the upper-left coordinates of the source window, the other variables mark a rectangle in the destination window." [syntax: overlay(destwin[, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol])] However, attempting to use the 7 arg form of either overlay or overwrite results in a TypeError being raised. Inspection of the PyCursesWindow_Overlay and PyCursesWindow_Overwrite functions from _cursesmodule.c reveals an incorrect format for the 7-arg specific call to PyArg_ParseTuple, such that a single argument tuple is expected which would contain the method arguments. Obviously, this is incompatible with the general argument length conditional used to decide which PyArg_ParseTuple will be used. The bug has only been verified on python 2.3.5, not 2.4, however a cursory examination of 2.4 code reveals no differences in these functions. The attached patch alters the PyArg_ParseTuple format string for both functions such that seven arguments are parsed as expected and the related copywin() code is thus executed. -- >Comment By: Neal Norwitz (nnorwitz) Date: 2006-01-09 23:08 Message: Logged In: YES user_id=33168 It was still a problem. Also UngetMouse(). All are fixed. Committed revision 41998. Committed revision 41999. (2.4) -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1400822&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1196154 ] Error: ... ossaudiodev.c, line 48: Missing type specifier
Bugs item #1196154, was opened at 2005-05-05 12:53 Message generated for change (Comment added) made by nnorwitz You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1196154&group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Build Group: Python 2.4 Status: Open Resolution: None >Priority: 5 Submitted By: Will L G (diskman) >Assigned to: Neal Norwitz (nnorwitz) Summary: Error: ... ossaudiodev.c, line 48: Missing type specifier Initial Comment: RedHat Linux 7.2 [alpha] Kernel 2.6.11.6 Compaq C 6.5.2 Binutils 2.15 Make 2.8 Was receiving the error below and then a few little changes to make the configure script think I was using gcc while still using ccc... [EMAIL PROTECTED] Python-2.4.1]# make case $MAKEFLAGS in \ *-s*) LD_LIBRARY_PATH=/usr2/www/linux- related/programming/python/Python- 2.4.1:/usr/X11R6/lib:/usr/lib:/usr/local/lib CC='ccache ccc - pthread' LDSHARED='ccache ccc -pthread -shared' OPT='- DNDEBUG -O' ./python -E ./setup.py -q build;; \ *) LD_LIBRARY_PATH=/usr2/www/linux- related/programming/python/Python- 2.4.1:/usr/X11R6/lib:/usr/lib:/usr/local/lib CC='ccache ccc - pthread' LDSHARED='ccache ccc -pthread -shared' OPT='- DNDEBUG -O' ./python -E ./setup.py build;; \ esac Could not find platform independent libraries Could not find platform dependent libraries Consider setting $PYTHONHOME to [:] 'import site' failed; use -v for traceback Traceback (most recent call last): File "./setup.py", line 6, in ? import sys, os, getopt, imp, re ImportError: No module named os make: *** [sharedmods] Error 1 [EMAIL PROTECTED] Python-2.4.1]# Here is a copy of the little script I used to set the env to use ccc while configuring python to compile using gcc and thus build the appropriate extensions: ./configure \ --prefix=/usr \ --sysconfdir=/etc \ --build=alphapca56-alpha-linux-gnu \ --without-gcc \ --enable-shared \ --with-dec-threads \ --with-cxx="ccache cxx" \ --with-cc="ccache ccc" \ --without-threads make CC="ccache ccc" CXX="ccache cxx" \ CFLAGS="-O5 -fast -mtune=ev56 -w -pipe - lpthread -threads" \ CXXFLAGS="-O5 -fast -mtune=ev56 -w -pipe - lpthread -threads" EVERYTHING compiled fine but for one little thing, two extensions didn't compile: building 'ossaudiodev' extension ccache ccc -DNDEBUG -O -fPIC -OPT:Olimit=0 -I. - I/usr2/www/pub/alpha-RH7/programming/python/Python- 2.4.1/./Include -I/usr/local/include -I/usr2/www/pub/alpha- RH7/programming/python/Python-2.4.1/Include - I/usr2/www/pub/alpha-RH7/programming/python/Python- 2.4.1 -c /usr2/www/pub/alpha- RH7/programming/python/Python- 2.4.1/Modules/ossaudiodev.c -o build/temp.linux-alpha- 2.4/ossaudiodev.o cc: Error: /usr2/www/pub/alpha- RH7/programming/python/Python- 2.4.1/Modules/ossaudiodev.c, line 48: Missing type specifier or type qualifier. (missingtype) PyObject_HEAD; -^ cc: Error: /usr2/www/pub/alpha- RH7/programming/python/Python- 2.4.1/Modules/ossaudiodev.c, line 57: Missing type specifier or type qualifier. (missingtype) PyObject_HEAD; -^ ccache ccc -DNDEBUG -O -fPIC -OPT:Olimit=0 -I. - I/usr2/www/pub/alpha-RH7/programming/python/Python- 2.4.1/./Include -I/usr/local/include -I/usr2/www/pub/alpha- RH7/programming/python/Python-2.4.1/Include - I/usr2/www/pub/alpha-RH7/programming/python/Python- 2.4.1 -c /usr2/www/pub/alpha- RH7/programming/python/Python- 2.4.1/Modules/ossaudiodev.c -o build/temp.linux-alpha- 2.4/ossaudiodev.o cc: Error: /usr2/www/pub/alpha- RH7/programming/python/Python- 2.4.1/Modules/ossaudiodev.c, line 48: Missing type specifier or type qualifier. (missingtype) PyObject_HEAD; -^ cc: Error: /usr2/www/pub/alpha- RH7/programming/python/Python- 2.4.1/Modules/ossaudiodev.c, line 57: Missing type specifier or type qualifier. (missingtype) PyObject_HEAD; -^ cc: Info: /usr2/www/pub/alpha- RH7/programming/python/Python- 2.4.1/./Include/objimpl.h, line 255: In this declaration, type long double has the same representation as type double on this platform. (longdoublenyi) long double dummy; /* force worst-case alignment */ -- >Comment By: Neal Norwitz (nnorwitz) Date: 2006-01-09 23:20 Message: Logged In: YES user_id=33168 The problem could be an extra ; on the PyObject_HEAD line. (There shouldn't be any.) The semi-colon has been removed in SVN. Can you verify that is the problem? The fix wasn't ported to 2.4, but that's easy enough if removing the semi-colon fixes the problem. If you want faster resolution, perhaps you can volunteer to help out. -- Comment By: Will L G (diskman) Date: 2005-08-04 09:13 Message: Logged In: YES user_