[issue1306] Embedded python reinitialization
Christian Heimes added the comment: The patch solves one issue. It resets the Py_DefaultFileSystemEncoding to NULL when no default value was given. However the finalization fails after the 3rd round at if (op == refchain || op-_ob_prev-_ob_next != op || op-_ob_next-_ob_prev != op) Py_FatalError(UNREF invalid object); $ gdb ./reinit_test GNU gdb 6.6-debian Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type show copying to see the conditions. There is absolutely no warranty for GDB. Type show warranty for details. This GDB was configured as i486-linux-gnu... Using host libthread_db library /lib/tls/i686/cmov/libthread_db.so.1. (gdb) run Starting program: /home/heimes/dev/python/py3k/reinit_test [Thread debugging using libthread_db enabled] [New Thread -1210464064 (LWP 8060)] round 1 [23832 refs] round 2 [24558 refs] round 3 Fatal Python error: UNREF invalid object Program received signal SIGABRT, Aborted. [Switching to Thread -1210464064 (LWP 8060)] 0xe410 in __kernel_vsyscall () (gdb) bt #0 0xe410 in __kernel_vsyscall () #1 0xb7dc7875 in raise () from /lib/tls/i686/cmov/libc.so.6 #2 0xb7dc9201 in abort () from /lib/tls/i686/cmov/libc.so.6 #3 0x0805d62d in Py_FatalError (msg=0x81790d8 UNREF invalid object) at Python/pythonrun.c:1761 #4 0x080aac57 in _Py_ForgetReference (op=0x821d728) at Objects/object.c:1536 #5 0x080aaca6 in _Py_Dealloc (op=0x821d728) at Objects/object.c:1555 #6 0x080c0f52 in tupledealloc (op=0x82ebc3c) at Objects/tupleobject.c:169 #7 0x080aacb1 in _Py_Dealloc (op=0x82ebc3c) at Objects/object.c:1556 #8 0x080c0f52 in tupledealloc (op=0x83f9154) at Objects/tupleobject.c:169 #9 0x080aacb1 in _Py_Dealloc (op=0x83f9154) at Objects/object.c:1556 #10 0x08083605 in code_dealloc (co=0x83b1bc8) at Objects/codeobject.c:276 #11 0x080aacb1 in _Py_Dealloc (op=0x83b1bc8) at Objects/object.c:1556 #12 0x081691bf in func_dealloc (op=0x83f7924) at Objects/funcobject.c:555 #13 0x080aacb1 in _Py_Dealloc (op=0x83f7924) at Objects/object.c:1556 #14 0x080a272e in PyDict_Clear (op=0x83f6df4) at Objects/dictobject.c:798 #15 0x080a524f in dict_tp_clear (op=0x83f6df4) at Objects/dictobject.c:1793 #16 0x08068c13 in delete_garbage (collectable=0xbf9fa024, old=0x81978e8) at Modules/gcmodule.c:688 #17 0x0806909f in collect (generation=2) at Modules/gcmodule.c:824 #18 0x080699ea in PyGC_Collect () at Modules/gcmodule.c:1238 #19 0x0805a022 in Py_Finalize () at Python/pythonrun.c:416 #20 0x08059791 in main () at reinit_test.c:9 (gdb) -- assignee: - gvanrossum nosy: +gvanrossum Added file: http://bugs.python.org/file8790/py3k_reinit.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1306 __Index: Python/pythonrun.c === --- Python/pythonrun.c (Revision 59091) +++ Python/pythonrun.c (Arbeitskopie) @@ -502,6 +502,12 @@ /* Cleanup Unicode implementation */ _PyUnicode_Fini(); + /* reset file system default encoding */ + if (!Py_HasFileSystemDefaultEncoding) { + free(Py_FileSystemDefaultEncoding); + Py_FileSystemDefaultEncoding = NULL; + } + /* XXX Still allocated: - various static ad-hoc pointers to interned strings - int and float free list blocks Index: Python/bltinmodule.c === --- Python/bltinmodule.c (Revision 59091) +++ Python/bltinmodule.c (Arbeitskopie) @@ -16,10 +16,13 @@ */ #if defined(MS_WINDOWS) defined(HAVE_USABLE_WCHAR_T) const char *Py_FileSystemDefaultEncoding = mbcs; +const int Py_HasFileSystemDefaultEncoding = 1; #elif defined(__APPLE__) const char *Py_FileSystemDefaultEncoding = utf-8; +const int Py_HasFileSystemDefaultEncoding = 1; #else const char *Py_FileSystemDefaultEncoding = NULL; /* use default */ +const int Py_HasFileSystemDefaultEncoding = 0; #endif static PyObject * Index: Include/fileobject.h === --- Include/fileobject.h (Revision 59091) +++ Include/fileobject.h (Arbeitskopie) @@ -20,6 +20,7 @@ If non-NULL, this is different than the default encoding for strings */ PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding; +PyAPI_DATA(const int) Py_HasFileSystemDefaultEncoding; /* Internal API ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1480] sqlite module is leaking lots of references
New submission from Christian Heimes: test_sqlite leaked [325, 325, 325, 325] references, sum=1300 -- components: Extension Modules keywords: py3k messages: 57729 nosy: tiran priority: high severity: normal status: open title: sqlite module is leaking lots of references versions: Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1480 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1469] SSL tests leak memory
Christian Heimes added the comment: I don't see leaks when I run the tests with $ ./python Lib/test/regrtest.py -R:: test_ssl.py test_ssl beginning 9 repetitions 123456789 . 1 test OK. [80034 refs] -- nosy: +tiran priority: - normal __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1469 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1475] test_popen fails when the directory contains a space
Christian Heimes added the comment: In Python 3.x os.popen is implemented based on subprocess. I believe it's still a problem with subprocess. Python 3.x also drops support for Windows 95 to ME. Would the additional quoting be ok when the code checks for COMPSPEC == cmd.exe first? # Supply os.popen() def popen(cmd, mode=r, buffering=None): if not isinstance(cmd, str): raise TypeError(invalid cmd type (%s, expected string) % type(cmd)) if mode not in (r, w): raise ValueError(invalid mode %r % mode) import subprocess, io if mode == r: proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, bufsize=buffering) return _wrap_close(io.TextIOWrapper(proc.stdout), proc) else: proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, bufsize=buffering) return _wrap_close(io.TextIOWrapper(proc.stdin), proc) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1475 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1481] test_uuid is warning about unreliable functions
New submission from Christian Heimes: I'm putting the report into the tracker as a reminder. WARNING: uuid.getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._ifconfig_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. WARNING: uuid._unixdll_getnode is unreliable on many platforms. It is disabled until the code and/or test can be fixed properly. -- components: Library (Lib), Tests keywords: py3k messages: 57733 nosy: tiran priority: normal severity: normal status: open title: test_uuid is warning about unreliable functions type: behavior versions: Python 2.6, Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1481 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1306] Embedded python reinitialization
Christian Heimes added the comment: I've added some debugging code to _Py_ForgetReference and now I'm getting this: $ ./reinit_test round 1 [23832 refs] round 2 [24558 refs] round 3 * ob object : refcnt 0 at 0x821d728 type: str refcount: 0 address : 0x821d728 * op-_ob_prev-_ob_next object : refcnt 0 at 0x821d728 type: str refcount: 0 address : 0x821d728 * op-_ob_next-_ob_prev object : buffer(b'') type: buffer refcount: 1 address : 0x826c8c8 * refchain object : refcnt 0 at 0x81a1500 type: NULL refcount: 0 address : 0x81a1500 Fatal Python error: UNREF invalid object Aborted Added file: http://bugs.python.org/file8791/py3k_reinit2.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1306 __Index: Python/pythonrun.c === --- Python/pythonrun.c (Revision 59091) +++ Python/pythonrun.c (Arbeitskopie) @@ -502,6 +502,12 @@ /* Cleanup Unicode implementation */ _PyUnicode_Fini(); + /* reset file system default encoding */ + if (!Py_HasFileSystemDefaultEncoding) { + free(Py_FileSystemDefaultEncoding); + Py_FileSystemDefaultEncoding = NULL; + } + /* XXX Still allocated: - various static ad-hoc pointers to interned strings - int and float free list blocks Index: Python/bltinmodule.c === --- Python/bltinmodule.c (Revision 59091) +++ Python/bltinmodule.c (Arbeitskopie) @@ -16,10 +16,13 @@ */ #if defined(MS_WINDOWS) defined(HAVE_USABLE_WCHAR_T) const char *Py_FileSystemDefaultEncoding = mbcs; +const int Py_HasFileSystemDefaultEncoding = 1; #elif defined(__APPLE__) const char *Py_FileSystemDefaultEncoding = utf-8; +const int Py_HasFileSystemDefaultEncoding = 1; #else const char *Py_FileSystemDefaultEncoding = NULL; /* use default */ +const int Py_HasFileSystemDefaultEncoding = 0; #endif static PyObject * Index: Include/fileobject.h === --- Include/fileobject.h (Revision 59091) +++ Include/fileobject.h (Arbeitskopie) @@ -20,6 +20,7 @@ If non-NULL, this is different than the default encoding for strings */ PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding; +PyAPI_DATA(const int) Py_HasFileSystemDefaultEncoding; /* Internal API Index: Objects/object.c === --- Objects/object.c (Revision 59091) +++ Objects/object.c (Arbeitskopie) @@ -1532,8 +1532,15 @@ if (op-ob_refcnt 0) Py_FatalError(UNREF negative refcnt); if (op == refchain || - op-_ob_prev-_ob_next != op || op-_ob_next-_ob_prev != op) + op-_ob_prev-_ob_next != op || op-_ob_next-_ob_prev != op) { + fprintf(stderr, * ob\n); + _PyObject_Dump(op); + fprintf(stderr, * op-_ob_prev-_ob_next\n); + _PyObject_Dump(op-_ob_prev-_ob_next); + fprintf(stderr, * op-_ob_next-_ob_prev\n); + _PyObject_Dump(op-_ob_next-_ob_prev); Py_FatalError(UNREF invalid object); + } #ifdef SLOW_UNREF_CHECK for (p = refchain._ob_next; p != refchain; p = p-_ob_next) { if (p == op) ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1482] IMAP4 SSL isn't working
New submission from Christian Heimes: The SSL version of the imap4 client isnt' working under 3.0. After I applied the patch from http://bugs.python.org/issue1210 I tried to connect to an IMAP server over SSL. The connection hangs. import imaplib conn = imaplib.IMAP4_SSL(mailbox.rwth-aachen.de, 993) After a while I stopped the attempt with CTRL+C Traceback (most recent call last): File stdin, line 1, in module File /home/heimes/dev/python/py3k/Lib/imaplib.py, line 1137, in __init__ IMAP4.__init__(self, host, port) File /home/heimes/dev/python/py3k/Lib/imaplib.py, line 184, in __init__ self.welcome = self._get_response() File /home/heimes/dev/python/py3k/Lib/imaplib.py, line 907, in _get_response resp = self._get_line() File /home/heimes/dev/python/py3k/Lib/imaplib.py, line 1000, in _get_line line = self.readline() File /home/heimes/dev/python/py3k/Lib/imaplib.py, line 1170, in readline char = self.sslobj.read(1) File /home/heimes/dev/python/py3k/Lib/ssl.py, line 160, in read return self._sslobj.read(len) KeyboardInterrupt -- assignee: janssen components: Library (Lib) keywords: py3k messages: 57735 nosy: janssen, tiran priority: normal severity: normal status: open title: IMAP4 SSL isn't working versions: Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1482 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1083] Confusing error message when dividing timedelta using /
Changes by Christian Heimes: -- keywords: +patch Added file: http://bugs.python.org/file8792/py3k_datetime_1083.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1083 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1469] SSL tests leak memory
Christian Heimes added the comment: Ubuntu Linux x86 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1469 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1488] PCBuild9 _ssl.vcproj improperly launches build
Christian Heimes added the comment: Thanks, I'll check it later. -- assignee: - tiran keywords: +patch, py3k priority: - normal versions: +Python 2.6 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1488 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1138] Fixer needed for __future__ imports
Changes by Christian Heimes: -- keywords: +py3k versions: +Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1138 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1034] [patch] Add 2to3 support for displaying warnings as Python comments
Changes by Christian Heimes: -- keywords: +py3k versions: +Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1034 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1755179] Deadlocks with fork() and multithreading
Christian Heimes added the comment: It sounds like the importer dead lock problem. These problems are almost impossible to unit test because they are usually race conditions. I don't see a problem in moving the import to the module name space. errno is a built-in module and the import isn't costly. -- nosy: +tiran _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1755179 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1746656] IPv6 Interface naming/indexing functions
Christian Heimes added the comment: How do you know that the patch is working when you don't know how to test it? Nobody is going to apply new features without unit tests. -- nosy: +tiran _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1746656 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue765228] Subclassing from Modules
Christian Heimes added the comment: I agree. Python can't stop the developer from doing stupid things. We could remove Py_TPFLAGS_BASETYPE from the module type but that could cause incompatibilities with existing code. I'm assigning the bug to our beloved dictator to ask for his opinion. -- assignee: - gvanrossum nosy: +gvanrossum, tiran resolution: - wont fix status: open - pending Tracker [EMAIL PROTECTED] http://bugs.python.org/issue765228 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1767787] MSVC++8 x86 tkinter build patch for trunk
Christian Heimes added the comment: I've fixed the builds a while ago. -- nosy: +tiran resolution: - fixed status: open - closed _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1767787 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1189216] zipfile module and 2G boundary
Changes by Christian Heimes: -- components: +Library (Lib) -None versions: +Python 2.6, Python 3.0 _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1189216 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1731068] Importing a submodule fails after unloading its parent
Christian Heimes added the comment: Yes, it's fixed in Python 2.5 and newer. -- nosy: +tiran resolution: - out of date status: open - closed _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1731068 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1620174] Improve platform.py usability on Windows
Changes by Christian Heimes: -- components: +Library (Lib) -None versions: +Python 2.6 _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1620174 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1735632] Add O_NOATIME to os module
Changes by Christian Heimes: -- versions: +Python 2.6, Python 3.0 _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1735632 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1230540] sys.excepthook doesn't work in threads
Changes by Christian Heimes: -- versions: +Python 2.5, Python 2.6 -Python 2.4 _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1230540 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1488] PCBuild9 _ssl.vcproj improperly launches build
Christian Heimes added the comment: I've fixed (1) and (2) in r59130. I don't understand what you mean with (3). -- resolution: - fixed status: open - pending __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1488 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1675455] Use getaddrinfo() in urllib2.py for IPv6 support
Changes by Christian Heimes: -- versions: +Python 2.6, Python 3.0 _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1675455 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1474] PCbuild9 patch for trunk
Changes by Christian Heimes: -- resolution: - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1474 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1488] PCBuild9 _ssl.vcproj improperly launches build
Changes by Christian Heimes: -- status: pending - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1488 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1754273] Deprecation warning for (NOTEQUAL)
Christian Heimes added the comment: Applied in r59132 Thanks! -- nosy: +tiran resolution: - fixed status: open - closed _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1754273 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1754271] Deprecation warning for `backticks`
Christian Heimes added the comment: Applied in r59132 Thanks! -- nosy: +tiran resolution: - fixed status: open - closed _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1754271 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1493] Patch to remove unbound methods
New submission from Christian Heimes: Here is a first patch to remove unbound method objects. 6 tests failed: test_descr test_inspect test_pyclbr test_typechecks test_unittest test_weakref -- assignee: gvanrossum components: Interpreter Core files: py3k_remove_unbound.patch keywords: patch, py3k messages: 57798 nosy: gvanrossum, tiran priority: high severity: normal status: open title: Patch to remove unbound methods type: rfe versions: Python 3.0 Added file: http://bugs.python.org/file8799/py3k_remove_unbound.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1493 __Index: Objects/funcobject.c === --- Objects/funcobject.c (Revision 59163) +++ Objects/funcobject.c (Arbeitskopie) @@ -643,8 +643,10 @@ static PyObject * func_descr_get(PyObject *func, PyObject *obj, PyObject *type) { - if (obj == Py_None) - obj = NULL; + if (obj == Py_None || obj == NULL) { + Py_INCREF(func); + return func; + } return PyMethod_New(func, obj, type); } Index: Lib/DocXMLRPCServer.py === --- Lib/DocXMLRPCServer.py (Revision 59163) +++ Lib/DocXMLRPCServer.py (Arbeitskopie) @@ -74,7 +74,7 @@ title = 'a name=%sstrong%s/strong/a' % (anchor, name) if inspect.ismethod(object): -args, varargs, varkw, defaults = inspect.getargspec(object.im_func) +args, varargs, varkw, defaults = inspect.getargspec(object) # exclude the argument bound to the instance, it will be # confusing to the non-Python user argspec = inspect.formatargspec ( Index: Lib/test/test_extcall.py === --- Lib/test/test_extcall.py (Revision 59163) +++ Lib/test/test_extcall.py (Arbeitskopie) @@ -231,18 +231,8 @@ x = Foo() print(Foo.method(*(x, 1, 2))) print(Foo.method(x, *(1, 2))) -try: -print(Foo.method(*(1, 2, 3))) -except TypeError as err: -pass -else: -print('expected a TypeError for unbound method call') -try: -print(Foo.method(1, *(2, 3))) -except TypeError as err: -pass -else: -print('expected a TypeError for unbound method call') +print(Foo.method(*(1, 2, 3))) +print(Foo.method(1, *(2, 3))) # A PyCFunction that takes only positional parameters should allow an # empty keyword dictionary to pass without a complaint, but raise a Index: Lib/test/test_repr.py === --- Lib/test/test_repr.py (Revision 59163) +++ Lib/test/test_repr.py (Arbeitskopie) @@ -280,8 +280,8 @@ ''') from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import qux # Unbound methods first -eq(repr(qux..amethod), -'unbound method .amethod') +self.failUnless(repr(qux..amethod).startswith( +'function amethod')) # Bound method next iqux = qux.() self.failUnless(repr(iqux.amethod).startswith( Index: Lib/test/test_descrtut.py === --- Lib/test/test_descrtut.py (Revision 59163) +++ Lib/test/test_descrtut.py (Arbeitskopie) @@ -444,9 +444,7 @@ ... B.foo(self) C().foo() -Traceback (most recent call last): - ... -TypeError: unbound method foo() must be called with B instance as first argument (got C instance instead) +called A.foo() class C(A): ... def foo(self): Index: Lib/test/test_descr.py === --- Lib/test/test_descr.py (Revision 59163) +++ Lib/test/test_descr.py (Arbeitskopie) @@ -280,12 +280,12 @@ c = C() vereq(interesting(dir(c)), cstuff) -verify('im_self' in dir(C.Cmethod)) +#verify('im_self' in dir(C.Cmethod)) c.cdata = 2 c.cmethod = lambda self: 0 vereq(interesting(dir(c)), cstuff + ['cdata', 'cmethod']) -verify('im_self' in dir(c.Cmethod)) +#verify('im_self' in dir(c.Cmethod)) class A(C): Adata = 1 @@ -293,13
[issue1493] Patch to remove unbound methods
Christian Heimes added the comment: Do you still believe in the tooth fairy, too? :p __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1493 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1497] Patch to remove API to create new unbound methods
Changes by Christian Heimes: -- components: Interpreter Core files: py3k_remove_newunbound.patch keywords: patch, py3k nosy: georg.brandl, tiran priority: high severity: normal status: open title: Patch to remove API to create new unbound methods versions: Python 3.0 Added file: http://bugs.python.org/file8805/py3k_remove_newunbound.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1497 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1412] test_subprocess fails on SuSE 10
Christian Heimes added the comment: I've fixed a bug in py3k and 2.6 where a test in test_shutil has removed an empty TMP directory. I regard the issue as a minor inconvenience. We can't work around every edge case. -- resolution: - works for me status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1412 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1497] Patch to remove API to create new unbound methods
Christian Heimes added the comment: The new patch adds new.boundcfunction as a replacement for new.instancemethod(id, None, cls). I'm going to add docs if you like the approach. Added file: http://bugs.python.org/file8810/py3k_remove_newunbound2.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1497 __Index: Objects/classobject.c === --- Objects/classobject.c (Revision 59184) +++ Objects/classobject.c (Arbeitskopie) @@ -37,10 +37,9 @@ } -/* Method objects are used for two purposes: +/* Method objects are used for one purposes: (a) as bound instance methods (returned by instancename.methodname) - (b) as unbound methods (returned by ClassName.methodname) - In case (b), im_self is NULL + ClassName.methodname returns an ordinary function. */ static PyMethodObject *free_list; @@ -53,6 +52,10 @@ PyErr_BadInternalCall(); return NULL; } + if (self == NULL) { + PyErr_BadInternalCall(); + return NULL; + } im = free_list; if (im != NULL) { free_list = (PyMethodObject *)(im-im_self); @@ -86,7 +89,7 @@ {im_func, T_OBJECT, OFF(im_func), READONLY|RESTRICTED, the function (or other callable) implementing a method}, {im_self, T_OBJECT, OFF(im_self), READONLY|RESTRICTED, - the instance to which a method is bound; None for unbound methods}, + the instance to which a method is bound}, {NULL} /* Sentinel */ }; @@ -162,11 +165,9 @@ first argument must be callable); return NULL; } - if (self == Py_None) - self = NULL; - if (self == NULL classObj == NULL) { + if (self == NULL || self == Py_None) { PyErr_SetString(PyExc_TypeError, - unbound methods must have non-NULL im_class); + unbound methods are not supported); return NULL; } @@ -253,10 +254,10 @@ klassname = NULL; } } - if (self == NULL) - result = PyUnicode_FromFormat(unbound method %V.%V, - klassname, defname, - funcname, defname); + if (self == NULL) { + PyErr_BadInternalCall(); + return NULL; + } else { /* XXX Shouldn't use repr()/%R here! */ result = PyUnicode_FromFormat(bound method %V.%V of %R, @@ -296,88 +297,16 @@ return 0; } -static void -getclassname(PyObject *klass, char *buf, int bufsize) -{ - PyObject *name; - - assert(bufsize 1); - strcpy(buf, ?); /* Default outcome */ - if (klass == NULL) - return; - name = PyObject_GetAttrString(klass, __name__); - if (name == NULL) { - /* This function cannot return an exception */ - PyErr_Clear(); - return; - } - if (PyUnicode_Check(name)) { - strncpy(buf, PyUnicode_AsString(name), bufsize); - buf[bufsize-1] = '\0'; - } - Py_DECREF(name); -} - -static void -getinstclassname(PyObject *inst, char *buf, int bufsize) -{ - PyObject *klass; - - if (inst == NULL) { - assert(bufsize 0 (size_t)bufsize strlen(nothing)); - strcpy(buf, nothing); - return; - } - - klass = PyObject_GetAttrString(inst, __class__); - if (klass == NULL) { - /* This function cannot return an exception */ - PyErr_Clear(); - klass = (PyObject *)(inst-ob_type); - Py_INCREF(klass); - } - getclassname(klass, buf, bufsize); - Py_XDECREF(klass); -} - static PyObject * method_call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *self = PyMethod_GET_SELF(func); - PyObject *klass = PyMethod_GET_CLASS(func); PyObject *result; func = PyMethod_GET_FUNCTION(func); if (self == NULL) { - /* Unbound methods must be called with an instance of - the class (or a derived class) as first argument */ - int ok; - if (PyTuple_Size(arg) = 1) - self = PyTuple_GET_ITEM(arg, 0); - if (self == NULL) - ok = 0; - else { - ok = PyObject_IsInstance(self, klass); - if (ok 0) -return NULL; - } - if (!ok) { - char clsbuf[256]; - char instbuf[256]; - getclassname(klass, clsbuf, sizeof(clsbuf)); - getinstclassname(self, instbuf, sizeof(instbuf)); - PyErr_Format(PyExc_TypeError, - unbound method %s%s must be called with - %s instance as first argument - (got %s%s instead), - PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func), - clsbuf, - instbuf, - self == NULL ? : instance); - return NULL; - } - Py_INCREF(arg); + PyErr_BadInternalCall(); + return NULL; } else { Py_ssize_t argcount = PyTuple_Size(arg); @@ -412,14 +341,8 @@ } /* No, it is an unbound method */ if (PyMethod_GET_CLASS(meth) != NULL cls != NULL) { - /* Do subclass test. If it fails, return meth unchanged. */ - int ok = PyObject_IsSubclass(cls, PyMethod_GET_CLASS(meth)); - if (ok 0) - return NULL; - if (!ok) { - Py_INCREF(meth); - return meth; - } + PyErr_BadInternalCall(); + return NULL; } /* Bind it to obj */ return PyMethod_New(PyMethod_GET_FUNCTION(meth), obj, cls); Index: Lib/new.py
[issue1498] Rename __builtins__ to __root_namespace__?
Changes by Christian Heimes: -- keywords: +py3k nosy: +tiran __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1498 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1498] Rename __builtins__ to __root_namespace__?
Christian Heimes added the comment: A simple replace with sed -i works just fine. Afterwards the code needs only minor adjustments and cleanups. find -name \*.py -or -name \*.c -or -name \*.h | xargs sed -i 's/__builtins__/__root__/g' __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1498 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1498] Rename __builtins__ to __root_namespace__?
Christian Heimes added the comment: __origin__ __footing__ __radix__ __namespace__ __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1498 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1497] Patch to remove API to create new unbound methods
Christian Heimes added the comment: Guido van Rossum wrote: - Please clean up the comment in classobject.c starting with Method objects are used for one purposes: -- to begin with, one purposes is ungrammatical. Best to remove the (a) bullet and rephrase the whole thing more like Method objects are used for bound instance methods (...) Done - The error unbound methods are not supported sounds a bit strange; better rephrase more positive as self must not be None Done. Didn't I say that I'm not good with short, precise error messages? :) - There is still a comment left No, it is an unbound method. Is this code still reachable? I though all ways to set im_self to NULL/None are blocked? It's not longer reachable but I left it there to catch problems. It's gone now. - Is bug 1202533 still worth testing for in test_descr.py? I don't know that using a lambda reproduces the error condition that once existed. Removed - Do we really need im_class for anything any more? ISTM that the one place where it is still used (in method_repr), we could as well use the class of im_self. (And before you think of super() as a counter-argument: super() passes the object's class in rather than the class where the method is found (though this may be considered a bug). You are right. im_class can be substituted with __self__.__class__. I've also removed the class argument from PyMethod_New(). It's not required anymore. - I think that, like func_code - __code__, the im_xxx attributes should be renamed __xxx__. Done im_func - __func__ im_self - __self__ im_class - removed I've left the names in the struct untouched. The 'new' module claims to exist solely for backwards compatibility. If that's true, why are we adding to it? In any case, the _BoundCFunction() class is redundant -- you can just use the method type, which is easily accessed as any bound method's __class__ attribute. And is there a use case for an *unbound* C function? If not, you could replace boundcfunction() with just a call to the method type. How could a bind a builtin method to a class so that instance().builtin() gets self as first argument? In one unit test the builtin function id() is bound to a class: class Example: id = somemagic(id) Example().id() results in id(Example()) I can't get the same effect with MethodType because it binds only to instances, not to classes. Christian __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1497 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1497] Patch to remove API to create new unbound methods
Christian Heimes added the comment: I've committed the changes in r59189. The documentation still needs updates. I had only time to fix some of the docs. -- resolution: - fixed status: open - pending __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1497 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1504] Add 2to3 fixer for (un)bound methods
New submission from Christian Heimes: Todo: im_self - __self__ im_func - __func__ im_class - __self__.__class__ instancemethod(func, self, cls) - instancemethod(func, self) -- assignee: collinwinter components: 2to3 (2.x to 3.0 conversion tool) keywords: py3k messages: 57870 nosy: collinwinter, tiran severity: normal status: open title: Add 2to3 fixer for (un)bound methods versions: Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1504 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1505] Changes to PyMethod_New breaks ctypes on Windows
New submission from Christian Heimes: The problem is in _ctypes.c:create_comerror() around line 4620. -- assignee: theller components: Extension Modules, Windows keywords: py3k messages: 57871 nosy: theller, tiran priority: high severity: normal status: open title: Changes to PyMethod_New breaks ctypes on Windows versions: Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1505 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1455] VS2008, quick hack for distutils.msvccompiler
Christian Heimes added the comment: I've created another patch to add VS 2008 support to distutils. The new patch requires you to copy the msvccompiler.py first: $ cd Lib/distutils $ svn copy msvccompiler.py msvc9compiler.py $ cd ../.. $ patch -p0 py3k_vs2008_4.patch Martin, if you are going to build Python 3.0a2 with VS 2008 then this patch should be applied. I've tested it with VS 2008 and it *may* be compatible with VS 2005, too. -- priority: normal - high Added file: http://bugs.python.org/file8813/py3k_vs2008_4.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1455 __Index: Lib/distutils/command/build_ext.py === --- Lib/distutils/command/build_ext.py (revision 59193) +++ Lib/distutils/command/build_ext.py (working copy) @@ -14,6 +14,10 @@ from distutils.extension import Extension from distutils import log +if os.name == 'nt': +from distutils.msvccompiler import get_build_version +MSVC_VERSION = int(get_build_version()) + # An extension name is just a dot-separated list of Python NAMEs (ie. # the same as a fully-qualified module name). extension_name_re = re.compile \ @@ -172,7 +176,12 @@ # Append the source distribution include and library directories, # this allows distutils on windows to work in the source tree self.include_dirs.append(os.path.join(sys.exec_prefix, 'PC')) -self.library_dirs.append(os.path.join(sys.exec_prefix, 'PCBuild')) +if MSVC_VERSION == 9: +self.library_dirs.append(os.path.join(sys.exec_prefix, 'PCBuild9')) +elif MSVC_VERSION == 8: +self.library_dirs.append(os.path.join(sys.exec_prefix, 'PCBuild8')) +else: +self.library_dirs.append(os.path.join(sys.exec_prefix, 'PCBuild')) # OS/2 (EMX) doesn't support Debug vs Release builds, but has the # import libraries in its Config subdirectory Index: Lib/distutils/msvc9compiler.py === --- Lib/distutils/msvc9compiler.py (revision 59193) +++ Lib/distutils/msvc9compiler.py (working copy) @@ -1,145 +1,154 @@ -distutils.msvccompiler +distutils.msvc9compiler Contains MSVCCompiler, an implementation of the abstract CCompiler class -for the Microsoft Visual Studio. +for the Microsoft Visual Studio 2008. + +The module is compatible with VS 2008. The module may also be compatible +with VS 2005 but it is untested yet. You can find legacy support for older +versions of VS in distutils.msvccompiler. # Written by Perry Stoll # hacked by Robin Becker and Thomas Heller to do a better job of # finding DevStudio (through the registry) +# ported to VS 2008 by Christian Heimes __revision__ = $Id$ -import sys, os -from distutils.errors import \ - DistutilsExecError, DistutilsPlatformError, \ - CompileError, LibError, LinkError -from distutils.ccompiler import \ - CCompiler, gen_preprocess_options, gen_lib_options +import os +import subprocess +import sys +from distutils.errors import (DistutilsExecError, DistutilsPlatformError, +CompileError, LibError, LinkError) +from distutils.ccompiler import (CCompiler, gen_preprocess_options, +gen_lib_options) from distutils import log -_can_read_reg = False -try: -import _winreg +import _winreg -_can_read_reg = True -hkey_mod = _winreg +RegOpenKeyEx = _winreg.OpenKeyEx +RegEnumKey = _winreg.EnumKey +RegEnumValue = _winreg.EnumValue +RegError = _winreg.error -RegOpenKeyEx = _winreg.OpenKeyEx -RegEnumKey = _winreg.EnumKey -RegEnumValue = _winreg.EnumValue -RegError = _winreg.error +HKEYS = (_winreg.HKEY_USERS, + _winreg.HKEY_CURRENT_USER, + _winreg.HKEY_LOCAL_MACHINE, + _winreg.HKEY_CLASSES_ROOT) -except ImportError: -try: -import win32api -import win32con -_can_read_reg = True -hkey_mod = win32con +VS_BASE = rSoftware\Microsoft\VisualStudio\%0.1f +WINSDK_BASE = rSoftware\Microsoft\Microsoft SDKs\Windows +NET_BASE = rSoftware\Microsoft\.NETFramework +ARCHS = {'DEFAULT' : 'x86', +'intel' : 'x86', 'x86' : 'x86', +'amd64' : 'x64', 'x64' : 'x64', +'itanium' : 'ia64', 'ia64' : 'ia64', +} -RegOpenKeyEx = win32api.RegOpenKeyEx -RegEnumKey = win32api.RegEnumKey -RegEnumValue = win32api.RegEnumValue -RegError = win32api.error -except ImportError: -log.info(Warning: Can't read registry to find the - necessary compiler setting\n - Make sure that Python modules _winreg, - win32api or win32con are installed.) -pass +# The globals VERSION, ARCH, MACROS and VC_ENV are defined later -if _can_read_reg: -HKEYS = (hkey_mod.HKEY_USERS, - hkey_mod.HKEY_CURRENT_USER
[issue1504] Add 2to3 fixer for (un)bound methods
Christian Heimes added the comment: Added fix_methodattrs with an unit test in r59196. Can you check it please. By the way how do you know my IRC nick? Are you lurking in #python? :) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1504 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1504] Add 2to3 fixer for (un)bound methods
Christian Heimes added the comment: You are too fast. I haven't written a fixer for new.instancemethod yet. Do we need one? -- status: closed - open __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1504 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1504] Add 2to3 fixer for (un)bound methods
Christian Heimes added the comment: How should I issue a warning in the new module? Should and can I check for the -3 warning option or should I warn w/o checks for the -3 option? from warnings import warn as _warn _warn(The 'new' module is not supported in 3.x, DeprecationWarning, 2) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1504 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1504] Add 2to3 fixer for (un)bound methods
Christian Heimes added the comment: Guido van Rossum wrote: Guido van Rossum added the comment: There's C code like this: if (Py_Py3kWarningFlag PyErr_Warn(PyExc_DeprecationWarning, apply() not supported in 3.x) 0) return NULL; I don't know how to check for that flag in Python though -- we should really export all flags via the sys module... I've exposed the flag in r59204 as sys.py3kwarning. I've also added a method warnings.warnpy3k(). Christian __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1504 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1510] help for file/open should state which is prefered.
Christian Heimes added the comment: I agree! Can you provide a patch please? -- assignee: - tiran nosy: +tiran priority: - normal __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1510 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1509] Documentation lacking for the sqlite3 module.
Christian Heimes added the comment: Are you able to provide a patch? Please use a snapshot or svn checkout of 2.5 for the patch. We have a new documentation system. -- nosy: +tiran __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1509 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1508] Removal of stale code in _csv.c / pyexpat.c
Christian Heimes added the comment: Fixed in r59214 Thanks Joseph! Can you find more? -- keywords: +py3k nosy: +tiran resolution: - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1508 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1505] Changes to PyMethod_New breaks ctypes on Windows
Christian Heimes added the comment: The removal of unbound methods made it hard to bind CFunctions. I rewrote the code in r59215. -- resolution: - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1505 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1512] Removal of stale code in pyconfig.h
Changes by Christian Heimes: -- assignee: - loewis nosy: +loewis priority: - low __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1512 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1513] object.c do_compare comparison ordering error
Christian Heimes added the comment: Guido, do we want cmp(None, None) to return a value or is the exception expected? -- assignee: - gvanrossum nosy: +gvanrossum __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1513 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1517] lookdict should INCREF/DECREF startkey around PyObject_RichCompareBool
Christian Heimes added the comment: Two questions: * Which versions of Python are vulnerable to the problem? You forgot to fill in the version list. * How do we fix the problem? Is it enough to incref the key or must startkey be protected, too? -- nosy: +tiran __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1517 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1518] Fast globals/builtins access (patch)
Christian Heimes added the comment: When I run the code of test_gc.py test_function() in a shell I'm getting the expected result of 2 collected items: gc: collectable dict 0xb78aa13c gc: collectable function 0xb78a9374 However the same code embedded in the test suite collects two additional objects: gc: collectable dict 0x830061c gc: collectable function 0x82a3d54 gc: collectable fastglobals 0x82a4244 gc: collectable tuple 0x82a168c I've used gc.set_debug(gc.DEBUG_LEAK) to get the information -- nosy: +tiran __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1518 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1522] pyvm module patch
New submission from Christian Heimes: I've created a pyvm module for Python 3.0. So far it just contains a bunch of internal types. What methods do you like to add to pyvm? Somebody suggested internal functions from sys like the check internal. -- components: Extension Modules, Interpreter Core files: py3k_pyvm.patch keywords: patch, py3k messages: 57937 nosy: gvanrossum, tiran priority: normal severity: normal status: open title: pyvm module patch versions: Python 3.0 Added file: http://bugs.python.org/file8824/py3k_pyvm.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1522 __Index: Include/descrobject.h === --- Include/descrobject.h (Revision 59215) +++ Include/descrobject.h (Arbeitskopie) @@ -67,6 +67,10 @@ void *d_wrapped; /* This can be any function pointer */ } PyWrapperDescrObject; +PyAPI_DATA(PyTypeObject) PyClassMethodDescr_Type; +PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type; +PyAPI_DATA(PyTypeObject) PyMemberDescr_Type; +PyAPI_DATA(PyTypeObject) PyMethodDescr_Type; PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type; PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *); Index: Objects/descrobject.c === --- Objects/descrobject.c (Revision 59216) +++ Objects/descrobject.c (Arbeitskopie) @@ -383,7 +383,7 @@ return 0; } -static PyTypeObject PyMethodDescr_Type = { +PyTypeObject PyMethodDescr_Type = { PyVarObject_HEAD_INIT(PyType_Type, 0) method_descriptor, sizeof(PyMethodDescrObject), @@ -421,7 +421,7 @@ }; /* This is for METH_CLASS in C, not for f = classmethod(f) in Python! */ -static PyTypeObject PyClassMethodDescr_Type = { +PyTypeObject PyClassMethodDescr_Type = { PyVarObject_HEAD_INIT(PyType_Type, 0) classmethod_descriptor, sizeof(PyMethodDescrObject), @@ -458,7 +458,7 @@ 0, /* tp_descr_set */ }; -static PyTypeObject PyMemberDescr_Type = { +PyTypeObject PyMemberDescr_Type = { PyVarObject_HEAD_INIT(PyType_Type, 0) member_descriptor, sizeof(PyMemberDescrObject), @@ -495,7 +495,7 @@ (descrsetfunc)member_set, /* tp_descr_set */ }; -static PyTypeObject PyGetSetDescr_Type = { +PyTypeObject PyGetSetDescr_Type = { PyVarObject_HEAD_INIT(PyType_Type, 0) getset_descriptor, sizeof(PyGetSetDescrObject), Index: Makefile.pre.in === --- Makefile.pre.in (Revision 59215) +++ Makefile.pre.in (Arbeitskopie) @@ -328,6 +328,7 @@ LIBRARY_OBJS= \ Modules/_typesmodule.o \ Modules/getbuildinfo.o \ + Modules/pyvm.o \ $(PARSER_OBJS) \ $(OBJECT_OBJS) \ $(PYTHON_OBJS) \ @@ -365,6 +366,7 @@ -rm -f $@ $(AR) cr $@ Modules/getbuildinfo.o $(AR) cr $@ Modules/_typesmodule.o + $(AR) cr $@ Modules/pyvm.o $(AR) cr $@ $(PARSER_OBJS) $(AR) cr $@ $(OBJECT_OBJS) $(AR) cr $@ $(PYTHON_OBJS) Index: Modules/pyvm.c === --- Modules/pyvm.c (Revision 0) +++ Modules/pyvm.c (Revision 0) @@ -0,0 +1,69 @@ + + + +/* pyvm module + Low level interface to Python's virtual machine and internal types. + + Copyright (c) 2007 by Christian Heimes [EMAIL PROTECTED] + Licensed to PSF under a Contributor Agreement. + All rights reserved. +*/ + +#include Python.h +#include frameobject.h + +typedef struct _typeinfo { + PyTypeObject *type; + char *name; +} typeinfo; + +PyDoc_STRVAR(pyvm_doc, +Python Virtual Machine module\n); + +static PyMethodDef pyvm_methods[] = { + {NULL, NULL} /* sentinel */ +}; + +PyMODINIT_FUNC +initpyvm(void) +{ + char *name; + PyObject *mod; + typeinfo *ti; + typeinfo types[] = { + /* descriptor types */ + {PyClassMethodDescr_Type, NULL}, + {PyGetSetDescr_Type, NULL}, + {PyMemberDescr_Type, NULL}, + {PyMethodDescr_Type, NULL}, + {PyWrapperDescr_Type, NULL}, + /* functions */ + {PyCFunction_Type, builtin_method}, + {PyCFunction_Type, builtin_function}, /* alias */ + {PyFunction_Type, NULL}, + {PyMethod_Type, instance_method}, + /* other */ + {PyCode_Type, NULL}, + {PyFrame_Type, NULL}, + {PyGen_Type, NULL}, + {PyModule_Type, NULL}, + {PyTraceBack_Type, NULL}, + {PyCallIter_Type, callable_iterator}, + {NULL, NULL} /* sentinel */ + }; + + mod = Py_InitModule3(pyvm, pyvm_methods, pyvm_doc); + if (mod == NULL) + return; + + ti = types; + while(ti-type != NULL) { + name = ti-name; + if (name == NULL) + name = (char*)ti-type-tp_name; + assert(name); + Py_INCREF(ti-type); + PyModule_AddObject(mod, name, (PyObject *)ti-type); + ti++; + } +} Eigenschaftsänderungen: Modules/pyvm.c ___ Name: svn:keywords + Id ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1517] lookdict should INCREF/DECREF startkey around PyObject_RichCompareBool
Christian Heimes added the comment: Guido van Rossum wrote: The key that needs to be INCREF'ed is actually startkey. Patch attached. What about the second PyObject_RichCompareBool(startkey, key, Py_EQ) a few lines below inside the for loop? Christian __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1517 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1522] pyvm module patch
Christian Heimes added the comment: I don't see it as an option. I'd rather keep the types in the 'types' module than to add them to the sys module. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1522 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1522] pyvm module patch
Christian Heimes added the comment: Why such a strong opinion? 'sys' is pretty close to the VM too... sys is a very important and often used module, too. I don't like the idea to remove one module (types) and clutter an important module with its content. The list of types has grown pretty long and most of the types can't be instantiated in Python. I fear that the types are going to confuse too many people. However the types are useful for type checking and ABCs. ['PyCObject', '__doc__', '__name__', 'builtin_function', 'builtin_method', 'bytearray_iterator', 'bytes_iterator', 'callable_iterator', 'cell', 'classmethod_descriptor', 'cmpwrapper', 'code', 'dict_itemiterator', 'dict_items', 'dict_keyiterator', 'dict_keys', 'dict_valueiterator', 'dict_values', 'dictproxy', 'enumerate', 'frame', 'function', 'generator', 'getset_descriptor', 'instance_method', 'iterator', 'list_iterator', 'list_reverseiterator', 'longrange_iterator', 'member_descriptor', 'method_descriptor', 'module', 'range_iterator', 'reversed', 'set_iterator', 'sortwrapper', 'str_iterator', 'traceback', 'tuple_iterator', 'wrapper_descriptor'] Added file: http://bugs.python.org/file8829/py3k_pyvm2.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1522 __Index: Include/iterobject.h === --- Include/iterobject.h (Revision 59215) +++ Include/iterobject.h (Arbeitskopie) @@ -6,12 +6,14 @@ #endif PyAPI_DATA(PyTypeObject) PySeqIter_Type; +PyAPI_DATA(PyTypeObject) PyCallIter_Type; +PyAPI_DATA(PyTypeObject) PyZipIter_Type; +PyAPI_DATA(PyTypeObject) PyCmpWrapper_Type; #define PySeqIter_Check(op) (Py_Type(op) == PySeqIter_Type) PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *); -PyAPI_DATA(PyTypeObject) PyCallIter_Type; #define PyCallIter_Check(op) (Py_Type(op) == PyCallIter_Type) Index: Include/stringobject.h === --- Include/stringobject.h (Revision 59215) +++ Include/stringobject.h (Arbeitskopie) @@ -40,6 +40,7 @@ } PyStringObject; PyAPI_DATA(PyTypeObject) PyString_Type; +PyAPI_DATA(PyTypeObject) PyStringIter_Type; #define PyString_Check(op) \ PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_STRING_SUBCLASS) Index: Include/dictobject.h === --- Include/dictobject.h (Revision 59215) +++ Include/dictobject.h (Arbeitskopie) @@ -89,11 +89,24 @@ }; PyAPI_DATA(PyTypeObject) PyDict_Type; +PyAPI_DATA(PyTypeObject) PyDictIterKey_Type; +PyAPI_DATA(PyTypeObject) PyDictIterValue_Type; +PyAPI_DATA(PyTypeObject) PyDictIterItem_Type; +PyAPI_DATA(PyTypeObject) PyDictKeys_Type; +PyAPI_DATA(PyTypeObject) PyDictItems_Type; +PyAPI_DATA(PyTypeObject) PyDictValues_Type; #define PyDict_Check(op) \ PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_DICT_SUBCLASS) #define PyDict_CheckExact(op) (Py_Type(op) == PyDict_Type) +#define PyDictKeys_Check(op) (Py_Type(op) == PyDictKeys_Type) +#define PyDictItems_Check(op) (Py_Type(op) == PyDictItems_Type) +#define PyDictValues_Check(op) (Py_Type(op) == PyDictValues_Type) +/* This excludes Values, since they are not sets. */ +# define PyDictViewSet_Check(op) \ + (PyDictKeys_Check(op) || PyDictItems_Check(op)) + PyAPI_FUNC(PyObject *) PyDict_New(void); PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key); PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item); Index: Include/unicodeobject.h === --- Include/unicodeobject.h (Revision 59215) +++ Include/unicodeobject.h (Arbeitskopie) @@ -417,6 +417,7 @@ } PyUnicodeObject; PyAPI_DATA(PyTypeObject) PyUnicode_Type; +PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type; #define SSTATE_NOT_INTERNED 0 #define SSTATE_INTERNED_MORTAL 1 Index: Include/rangeobject.h === --- Include/rangeobject.h (Revision 59215) +++ Include/rangeobject.h (Arbeitskopie) @@ -16,6 +16,8 @@ */ PyAPI_DATA(PyTypeObject) PyRange_Type; +PyAPI_DATA(PyTypeObject) PyRangeIter_Type; +PyAPI_DATA(PyTypeObject) PyLongRangeIter_Type; #define PyRange_Check(op) (Py_Type(op) == PyRange_Type) Index: Include/listobject.h === --- Include/listobject.h (Revision 59215) +++ Include/listobject.h (Arbeitskopie) @@ -39,6 +39,9 @@ } PyListObject; PyAPI_DATA(PyTypeObject) PyList_Type; +PyAPI_DATA(PyTypeObject) PyListIter_Type; +PyAPI_DATA(PyTypeObject) PyListRevIter_Type; +PyAPI_DATA(PyTypeObject) PySortWrapper_Type; #define PyList_Check(op) \ PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_LIST_SUBCLASS) Index: Include/tupleobject.h === --- Include/tupleobject.h (Revision 59215) +++ Include/tupleobject.h (Arbeitskopie
[issue1522] pyvm module patch
Christian Heimes added the comment: Guido van Rossum wrote: Stuff in sys that people don't use doesn't really confuse anyone IMO. I really don't think that this warrants a new module. Many of the datatype-related types (e.g. dict_keys) should not go there but in _collections anyway. I really think we should postpone the decision until after the next alpha. For now I like to commit the part of the patch that adds all types to the appropriate header files. A lot of internal types aren't available from other C files. Christian __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1522 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1522] pyvm module patch
Christian Heimes added the comment: I've split the patch into two tasks. The first patch adds all types in Objects/ to the appropriate header files. I've renamed some types, too. The second patch contains the new pyvm.c module plus a modification to Modules/Setup.dist. Added file: http://bugs.python.org/file8830/py3k_add_types_to_h.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1522 __Index: Include/iterobject.h === --- Include/iterobject.h (Revision 59215) +++ Include/iterobject.h (Arbeitskopie) @@ -6,12 +6,14 @@ #endif PyAPI_DATA(PyTypeObject) PySeqIter_Type; +PyAPI_DATA(PyTypeObject) PyCallIter_Type; +PyAPI_DATA(PyTypeObject) PyZipIter_Type; +PyAPI_DATA(PyTypeObject) PyCmpWrapper_Type; #define PySeqIter_Check(op) (Py_Type(op) == PySeqIter_Type) PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *); -PyAPI_DATA(PyTypeObject) PyCallIter_Type; #define PyCallIter_Check(op) (Py_Type(op) == PyCallIter_Type) Index: Include/stringobject.h === --- Include/stringobject.h (Revision 59215) +++ Include/stringobject.h (Arbeitskopie) @@ -40,6 +40,7 @@ } PyStringObject; PyAPI_DATA(PyTypeObject) PyString_Type; +PyAPI_DATA(PyTypeObject) PyStringIter_Type; #define PyString_Check(op) \ PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_STRING_SUBCLASS) Index: Include/dictobject.h === --- Include/dictobject.h (Revision 59215) +++ Include/dictobject.h (Arbeitskopie) @@ -89,11 +89,24 @@ }; PyAPI_DATA(PyTypeObject) PyDict_Type; +PyAPI_DATA(PyTypeObject) PyDictIterKey_Type; +PyAPI_DATA(PyTypeObject) PyDictIterValue_Type; +PyAPI_DATA(PyTypeObject) PyDictIterItem_Type; +PyAPI_DATA(PyTypeObject) PyDictKeys_Type; +PyAPI_DATA(PyTypeObject) PyDictItems_Type; +PyAPI_DATA(PyTypeObject) PyDictValues_Type; #define PyDict_Check(op) \ PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_DICT_SUBCLASS) #define PyDict_CheckExact(op) (Py_Type(op) == PyDict_Type) +#define PyDictKeys_Check(op) (Py_Type(op) == PyDictKeys_Type) +#define PyDictItems_Check(op) (Py_Type(op) == PyDictItems_Type) +#define PyDictValues_Check(op) (Py_Type(op) == PyDictValues_Type) +/* This excludes Values, since they are not sets. */ +# define PyDictViewSet_Check(op) \ + (PyDictKeys_Check(op) || PyDictItems_Check(op)) + PyAPI_FUNC(PyObject *) PyDict_New(void); PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key); PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item); Index: Include/unicodeobject.h === --- Include/unicodeobject.h (Revision 59215) +++ Include/unicodeobject.h (Arbeitskopie) @@ -417,6 +417,7 @@ } PyUnicodeObject; PyAPI_DATA(PyTypeObject) PyUnicode_Type; +PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type; #define SSTATE_NOT_INTERNED 0 #define SSTATE_INTERNED_MORTAL 1 Index: Include/rangeobject.h === --- Include/rangeobject.h (Revision 59215) +++ Include/rangeobject.h (Arbeitskopie) @@ -16,6 +16,8 @@ */ PyAPI_DATA(PyTypeObject) PyRange_Type; +PyAPI_DATA(PyTypeObject) PyRangeIter_Type; +PyAPI_DATA(PyTypeObject) PyLongRangeIter_Type; #define PyRange_Check(op) (Py_Type(op) == PyRange_Type) Index: Include/listobject.h === --- Include/listobject.h (Revision 59215) +++ Include/listobject.h (Arbeitskopie) @@ -39,6 +39,9 @@ } PyListObject; PyAPI_DATA(PyTypeObject) PyList_Type; +PyAPI_DATA(PyTypeObject) PyListIter_Type; +PyAPI_DATA(PyTypeObject) PyListRevIter_Type; +PyAPI_DATA(PyTypeObject) PySortWrapper_Type; #define PyList_Check(op) \ PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_LIST_SUBCLASS) Index: Include/tupleobject.h === --- Include/tupleobject.h (Revision 59215) +++ Include/tupleobject.h (Arbeitskopie) @@ -32,6 +32,7 @@ } PyTupleObject; PyAPI_DATA(PyTypeObject) PyTuple_Type; +PyAPI_DATA(PyTypeObject) PyTupleIter_Type; #define PyTuple_Check(op) \ PyType_FastSubclass(Py_Type(op), Py_TPFLAGS_TUPLE_SUBCLASS) Index: Include/descrobject.h === --- Include/descrobject.h (Revision 59215) +++ Include/descrobject.h (Arbeitskopie) @@ -67,7 +67,12 @@ void *d_wrapped; /* This can be any function pointer */ } PyWrapperDescrObject; +PyAPI_DATA(PyTypeObject) PyClassMethodDescr_Type; +PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type; +PyAPI_DATA(PyTypeObject) PyMemberDescr_Type; +PyAPI_DATA(PyTypeObject) PyMethodDescr_Type; PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type; +PyAPI_DATA(PyTypeObject) PyDictProxy_Type; PyAPI_FUNC(PyObject *) PyDescr_NewMethod
[issue1522] pyvm module patch
Christian Heimes added the comment: I like to apply the py3k_add_types_to_h.patch before the next alpha and discuss the fate of pyvm after the alpha. Added file: http://bugs.python.org/file8831/py3k_pyvm3.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1522 __Index: Modules/pyvm.c === --- Modules/pyvm.c (Revision 0) +++ Modules/pyvm.c (Revision 0) @@ -0,0 +1,92 @@ +/* pyvm module + Low level interface to Python's virtual machine and internal types. + + Copyright (c) 2007 by Christian Heimes [EMAIL PROTECTED] + Licensed to PSF under a Contributor Agreement. + All rights reserved. +*/ + +#include Python.h +#include frameobject.h + +typedef struct _typeinfo { + PyTypeObject *type; + char *name; +} typeinfo; + +PyDoc_STRVAR(pyvm_doc, +Python Virtual Machine module\n); + +static PyMethodDef pyvm_methods[] = { + {NULL, NULL} /* sentinel */ +}; + +PyMODINIT_FUNC +initpyvm(void) +{ + char *name; + PyObject *mod; + typeinfo *ti; + typeinfo types[] = { + /* descriptors */ + {PyClassMethodDescr_Type, NULL}, + {PyGetSetDescr_Type, NULL}, + {PyMemberDescr_Type, NULL}, + {PyMethodDescr_Type, NULL}, + {PyWrapperDescr_Type, NULL}, + /* functions */ + {PyCFunction_Type, builtin_method}, + {PyCFunction_Type, builtin_function}, /* alias */ + {PyFunction_Type, NULL}, + {PyMethod_Type, instance_method}, + /* dict */ + {PyDictIterKey_Type, NULL}, + {PyDictIterValue_Type, NULL}, + {PyDictIterItem_Type, NULL}, + {PyDictKeys_Type, NULL}, + {PyDictItems_Type, NULL}, + {PyDictValues_Type, NULL}, + {PyDictProxy_Type, NULL}, + /* iter */ + {PyBytesIter_Type, NULL}, + {PyCallIter_Type, callable_iterator}, + {PyLongRangeIter_Type, NULL}, + {PyListIter_Type, NULL}, + {PyListRevIter_Type, NULL}, + {PyRangeIter_Type, NULL}, + {PySeqIter_Type, NULL}, + {PySetIter_Type, NULL}, + {PyStringIter_Type, NULL}, + {PyTupleIter_Type, NULL}, + {PyUnicodeIter_Type, NULL}, + /* other */ + {PyCObject_Type, NULL}, + {PyCode_Type, NULL}, + {PyFrame_Type, NULL}, + {PyGen_Type, NULL}, + {PyModule_Type, NULL}, + {PyTraceBack_Type, NULL}, + {PyCell_Type, NULL}, + {PyEnum_Type, NULL}, + {PyReversed_Type, NULL}, + {PySortWrapper_Type, NULL}, + {PyCmpWrapper_Type, NULL}, + /* sentinel */ + {NULL, NULL} + }; + + mod = Py_InitModule3(pyvm, pyvm_methods, pyvm_doc); + if (mod == NULL) + return; + + ti = types; + while(ti-type != NULL) { + name = ti-name; + if (name == NULL) + name = (char*)ti-type-tp_name; + assert(name); + Py_INCREF(ti-type); + PyModule_AddObject(mod, name, (PyObject *)ti-type); + ti++; + } +} Eigenschaftsänderungen: Modules/pyvm.c ___ Name: svn:keywords + Id Index: Modules/Setup.dist === --- Modules/Setup.dist (Revision 59215) +++ Modules/Setup.dist (Arbeitskopie) @@ -113,6 +113,7 @@ errno errnomodule.c # posix (UNIX) errno values pwd pwdmodule.c # this is needed to find out the user's home dir # if $HOME is not set +pyvm pyvm.c # Python VM low level interface _sre _sre.c # Fredrik Lundh's new regular expressions _codecs _codecsmodule.c # access to the builtin codecs and codec registry _fileio _fileio.c # Standard I/O baseline ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1522] pyvm module patch
Changes by Christian Heimes: Removed file: http://bugs.python.org/file8824/py3k_pyvm.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1522 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1522] pyvm module patch
Changes by Christian Heimes: Removed file: http://bugs.python.org/file8829/py3k_pyvm2.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1522 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1524] os.system() fails for commands with multiple quoted file names
Christian Heimes added the comment: I don't think that we can do anything about your problem. The user of os.system() is responsible to do the quoting himself. os.system() is just a tiny wrapper around the low level C function. We don't plan to chance the fact that os.system() doesn't handling quoting. However the subprocess module is clever enough to do the quoting for you. -- nosy: +tiran __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1524 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1522] pyvm module patch
Christian Heimes added the comment: Guido van Rossum wrote: Sure, go ahead and submit the uncontroversial part. Applied py3k_add_types_to_h.patch in r59229 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1522 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1528] Add os.fchmod
Christian Heimes added the comment: I've applied the combined patch in r59242. I've tested Georg's fchmod/fchown on my Linux system. They functions are working as expected. However lchmod is not available on my system although it is in the header files. It should be available on Mac and some other flavors of Unix. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1528 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1514] missing constants in socket module
Christian Heimes added the comment: Marc-Andre Lemburg wrote: Marc-Andre Lemburg added the comment: Interesting. It appears as if r57142 caused this change. Good work, Marc-Andre! I've restored the old semantic in r57142. Christian __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1514 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1534] sys.maxfloat patch
New submission from Christian Heimes: Currently Python has no information about the maximum and minimum value of a float. The patch adds a dict with all important information to sys: pprint.pprint(sys.maxfloat) {'dig': 15, 'epsilon': 2.2204460492503131e-16, 'mant_dig': 53, 'max': 1.7976931348623157e+308, 'max_10_exp': 308, 'max_exp': 1024, 'min': 2.2250738585072014e-308, 'min_10_exp': -307, 'min_exp': -1021, 'radix': 2, 'rounds': 1} The patch compiles on Linux and Windows. -- components: Interpreter Core files: trunk_maxfloat.patch keywords: patch, py3k messages: 58037 nosy: tiran priority: normal severity: normal status: open title: sys.maxfloat patch versions: Python 2.6, Python 3.0 Added file: http://bugs.python.org/file8840/trunk_maxfloat.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1534 __Index: Python/sysmodule.c === --- Python/sysmodule.c (Revision 59248) +++ Python/sysmodule.c (Arbeitskopie) @@ -18,6 +18,7 @@ #include code.h #include frameobject.h #include eval.h +#include float.h #include osdefs.h @@ -1045,7 +1046,37 @@ return shortbranch; } +#define SET_FLOAT_CONST(d, key, const) \ + tmp = PyFloat_FromDouble(const); \ + if (tmp == NULL) return NULL; \ + if (PyDict_SetItemString(d, key, tmp)) return NULL; \ + Py_DECREF(tmp) +#define SET_INT_CONST(d, key, const) \ + tmp = PyInt_FromLong(const); \ + if (tmp == NULL) return NULL; \ + if (PyDict_SetItemString(d, key, tmp)) return NULL; \ + Py_DECREF(tmp) + PyObject * +maxfloat(void) +{ + PyObject *d, *tmp; + d = PyDict_New(); + SET_FLOAT_CONST(d, max, DBL_MAX); + SET_INT_CONST(d, max_exp, DBL_MAX_EXP); + SET_INT_CONST(d, max_10_exp, DBL_MAX_10_EXP); + SET_FLOAT_CONST(d, min, DBL_MIN); + SET_INT_CONST(d, min_exp, DBL_MIN_EXP); + SET_INT_CONST(d, min_10_exp, DBL_MIN_10_EXP); + SET_INT_CONST(d, dig, DBL_DIG); + SET_INT_CONST(d, mant_dig, DBL_MANT_DIG); + SET_FLOAT_CONST(d, epsilon, DBL_EPSILON); + SET_INT_CONST(d, radix, FLT_RADIX); + SET_INT_CONST(d, rounds, FLT_ROUNDS); + return d; +} + +PyObject * _PySys_Init(void) { PyObject *m, *v, *sysdict; @@ -1169,6 +1200,8 @@ PyInt_FromLong(PyInt_GetMax())); SET_SYS_FROM_STRING(py3kwarning, PyBool_FromLong(Py_Py3kWarningFlag)); + SET_SYS_FROM_STRING(maxfloat, + maxfloat()); #ifdef Py_USING_UNICODE SET_SYS_FROM_STRING(maxunicode, PyInt_FromLong(PyUnicode_GetMax())); ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1514] missing constants in socket module
Christian Heimes added the comment: On my system (Ubuntu 7.10, i386, Kernel 2.6.20) the _socket modules of Python 2.5 and trunk have the TCP_ constants. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1514 __ ___ 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: I don't know how to fix the problem. You have to assign the bug to somebody who has experience with Tcl/Tk. __ 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
[issue1528] Add os.fchmod
Changes by Christian Heimes: -- resolution: - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1528 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1528] Add os.fchmod
Christian Heimes added the comment: I'm adding lchmod, too. -- nosy: +tiran __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1528 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1527] Problem with static libs on Windows
New submission from Christian Heimes: patrickkidd (IRC nick) has reported a problem with creating a static libraries on Windows. He suggested the appended patch. -- assignee: loewis components: Windows files: trunk_staticlib.patch keywords: patch, py3k messages: 57991 nosy: loewis, tiran severity: normal status: open title: Problem with static libs on Windows versions: Python 2.6, Python 3.0 Added file: http://bugs.python.org/file8835/trunk_staticlib.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1527 __Index: PC/dl_nt.c === --- PC/dl_nt.c (Revision 59200) +++ PC/dl_nt.c (Arbeitskopie) @@ -13,6 +13,8 @@ char dllVersionBuffer[16] = ; // a private buffer +#ifdef Py_ENABLE_SHARED + // Python Globals HMODULE PyWin_DLLhModule = NULL; const char *PyWin_DLLVersionString = dllVersionBuffer; @@ -35,3 +37,6 @@ } return TRUE; } + +#endif /* Py_ENABLE_SHARED */ + ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1504] Add 2to3 fixer for (un)bound methods
Christian Heimes added the comment: The deprecation warning in 'new' is a -3 warning. I've added a new method warning.warnpy3k for the job. You are right about the rest. Can you start a discussion on the list? The last time I tried to kick off a poll it ended up a lots of bad jokes. :( __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1504 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1504] Add 2to3 fixer for (un)bound methods
Christian Heimes added the comment: Whatever you say. But shouldn't we make people to use types.MethodType() or whatever we use as the new module for PyMethod_Type()? People are going to use types.MethodType() when they see the deprecation warning. By the way I've updated the docs in r59248. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1504 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1138] Fixer needed for __future__ imports
Christian Heimes added the comment: Fixed in r59235 It was easier to add a new fixer for the problem. -- nosy: +tiran resolution: - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1138 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1514] missing constants in socket module
Christian Heimes added the comment: I've added Lemburg, Löwis and Skip to the nosy list. svn ann shows their names frequently. -- nosy: +loewis, skip.montanaro __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1514 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1514] missing constants in socket module
Christian Heimes added the comment: On my Linux box (Ubuntu 7.10, i386, 2.6.22) the TCP_* constants are also missing. This patch solves the bug. Index: Modules/socketmodule.h === --- Modules/socketmodule.h (revision 59228) +++ Modules/socketmodule.h (working copy) @@ -8,9 +8,7 @@ # include sys/socket.h # endif # include netinet/in.h -# if defined(__CYGWIN__) || (defined(PYOS_OS2) defined(PYCC_VACPP)) -# include netinet/tcp.h -# endif +# include netinet/tcp.h #else /* MS_WINDOWS */ #if _MSC_VER = 1300 -- assignee: - lemburg components: +Extension Modules -Library (Lib), Macintosh keywords: +patch, py3k nosy: +lemburg, tiran priority: - normal __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1514 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1532] Refleak run of test_tcl fails
New submission from Christian Heimes: $ ./python Lib/test/regrtest.py -R:: test_tcl test_tcl beginning 9 repetitions 123456789 test test_tcl failed -- Traceback (most recent call last): File Lib/test/test_tcl.py, line 125, in testLoadTk tcl.loadtk() File Lib/lib-tk/Tkinter.py, line 1641, in loadtk self.tk.loadtk() _tkinter.TclError: Calling Tk_Init again after a previous call failed might deadlock 1 test failed: test_tcl -- components: Tests keywords: py3k messages: 58028 nosy: gvanrossum, tiran priority: low severity: normal status: open title: Refleak run of test_tcl fails type: crash versions: Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1532 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1109] Warning required when calling register() on an ABCMeta subclass
Christian Heimes added the comment: Fixed in r59233. Please adjust the error message if you don't like it. TypeError: register() cannot be called on an ABCMeta subclass, use class Example(metaclass=abc.ABCMeta) instead. -- resolution: - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1109 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1109] Warning required when calling register() on an ABCMeta subclass
Christian Heimes added the comment: I've reverted the changes. -- status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1109 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1504] Add 2to3 fixer for (un)bound methods
Christian Heimes added the comment: Some cases aren't covered by the fixer. I'm not sure if we need fixers for two cases: Python 2.x: Cls.method = types.MethodType(function, None, Cls) Python 3.0: Cls.method = function Python 2.x: instance.method = types.MethodType(function, instance, instance.__class__) Python 3.0: instance.method = types.MethodType(function, instance) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1504 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1534] sys.maxfloat patch
Christian Heimes added the comment: Applied in r59254. I've moved the code to floatobject.c/h and added PyFloat_GetMax() and PyFloat_GetMin(), too. The intobject.c file has a similar function. -- resolution: - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1534 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1438] Calling base class methods is slow due to __instancecheck__ override in abc.py
Christian Heimes added the comment: Unbound methods are gone and so is the isinstance check in method_call(). -- resolution: - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1438 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1535] Rename __builtin__ to builtins
Christian Heimes added the comment: Here is a fixer for the new name. Added file: http://bugs.python.org/file8843/2to3_builtins.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1535 __Index: tests/test_fixers.py === --- tests/test_fixers.py (Revision 59235) +++ tests/test_fixers.py (Arbeitskopie) @@ -1270,7 +1270,10 @@ fixer = imports modules = {StringIO: (io, [StringIO]), - cStringIO: (io, [StringIO])} + cStringIO: (io, [StringIO]), + __builtin__ : (builtins, [open, Exception, + __debug__, str]), + } def test_import_module(self): for old, (new, members) in self.modules.items(): @@ -1285,11 +1288,11 @@ def test_import_from(self): for old, (new, members) in self.modules.items(): for member in members: -b = from %s import %s % (old, , .join(members)) -a = from %s import %s % (new, , .join(members)) +b = from %s import %s % (old, member) +a = from %s import %s % (new, member) self.check(b, a) -s = from foo import %s % , .join(members) +s = from foo import %s % member self.unchanged(s) def test_import_module_as(self): @@ -1305,8 +1308,8 @@ def test_import_from_as(self): for old, (new, members) in self.modules.items(): for member in members: -b = from %s import %s as foo_bar % (old, , .join(members)) -a = from %s import %s as foo_bar % (new, , .join(members)) +b = from %s import %s as foo_bar % (old, member) +a = from %s import %s as foo_bar % (new, member) self.check(b, a) def test_star(self): Index: fixes/fix_imports.py === --- fixes/fix_imports.py (Revision 59168) +++ fixes/fix_imports.py (Arbeitskopie) @@ -10,9 +10,14 @@ # Local imports from fixes import basefix from fixes.util import Name, attr_chain, any, set +import __builtin__ +builtin_names = [name for name in dir(__builtin__) + if name not in (__name__, __doc__)] MAPPING = {StringIO: (io, [StringIO]), - cStringIO: (io, [StringIO])} + cStringIO: (io, [StringIO]), + __builtin__ : (builtins, builtin_names), + } def alternates(members): ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1535] Rename __builtin__ to builtins
Christian Heimes added the comment: I had to copy the __builtin__.rst prior to patch. svn cp Doc/library/__builtin__.rst Doc/library/builtins.rst svn patch -p0 builtins.diff svn del --force Doc/library/__builtin__.rst -- keywords: +patch, py3k nosy: +tiran priority: - high __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1535 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1534] sys.maxfloat patch
Christian Heimes added the comment: I've checked all major platforms before committing the patch. They all have a float.h with the information available. Do you know of a platform where this information isn't available? I could add a lot of #ifdef but I don't feel like bloating the code unless it is necessary. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1534 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1534] sys.maxfloat patch
Christian Heimes added the comment: Thanks for checking it out for me! Do you have a reliable online source for the ANSI C89 standard? I'm usually using the GNU C Library docs but the site doesn't list what's available in C89. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1534 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1469] SSL tests leak memory
Christian Heimes added the comment: Are you sure that the SSL tests are still leaking memory? The tests aren't leaking references on Windows nor on Linux. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1469 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1537] Change GeneratorExit's base class from Exception to BaseException
Christian Heimes added the comment: Can you also add a comment to ./Doc/reference/expressions.rst and update Misc/NEWS please? The rest of the patch is looking good. -- assignee: - tiran keywords: +patch nosy: +tiran priority: - normal __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1537 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1537] Change GeneratorExit's base class from Exception to BaseException
Christian Heimes added the comment: You make a good point. Can you take it to the mailing list, please? __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1537 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1539] test_collections: failing refleak test
New submission from Christian Heimes: The refleak tests of test_collections are broken. I fear that my changes to regrtest.py have cause the problem but I don't understand why it's broken. Can you have a look please? -- assignee: gvanrossum components: Tests keywords: py3k messages: 58088 nosy: gvanrossum, tiran priority: normal severity: normal status: open title: test_collections: failing refleak test versions: Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1539 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1540] Refleak tests: test_doctest and test_gc are failing
New submission from Christian Heimes: I've seen the problem on Windows only. test_doctest fails and the problem also causes test_gc to fail when it is run after test_doctest. W/o a prior run of test_doctest test_gc doesn't fail. File c:\dev\python\py3k\lib\test\test_doctest.py, line 1570, in test.test_doct est.test_debug Failed example: try: doctest.debug_src(s) finally: sys.stdin = real_stdin Expected: string(1)module() (Pdb) next 12 --Return-- string(1)module()-None (Pdb) print(x) 12 (Pdb) continue Got: c:\dev\python\py3k\lib\io.py(281)__del__() - try: (Pdb) next c:\dev\python\py3k\lib\io.py(282)__del__() - self.close() (Pdb) print(x) *** NameError: NameError(name 'x' is not defined,) (Pdb) continue 12 ** 1 items had failures: 1 of 4 in test.test_doctest.test_debug ***Test Failed*** 1 failures. test test_doctest failed -- 1 of 418 doctests failed test_gc test test_gc failed -- Traceback (most recent call last): File c:\dev\python\py3k\lib\test\test_gc.py, line 193, in test_saveall self.assertEqual(gc.garbage, []) AssertionError: [io.BytesIO object at 0x01237968] != [] 2 tests failed: test_doctest test_gc -- components: Tests, Windows keywords: py3k messages: 58089 nosy: tiran priority: normal severity: normal status: open title: Refleak tests: test_doctest and test_gc are failing versions: Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1540 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1542] Ship 32 and 64bit libs with MSI installer
New submission from Christian Heimes: Hello Martin! How do you like the idea to ship the 32bit and 64bit libs with the MSI installer? The 64bit libs could be stored in libs64 while the 32bit libs stay in libs. I'm working on a task for the GHOP to add cross compiling support to msvc9compiler. The extra libs are needed to compile 64bit libs on Win32 or the other way around. Christian -- assignee: loewis components: Installation, Windows messages: 58094 nosy: loewis, tiran priority: low severity: normal status: open title: Ship 32 and 64bit libs with MSI installer versions: Python 2.6, Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1542 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1546] Win32 Platform SDK conflict
Christian Heimes added the comment: Thanks for the report. I prefer several false alarms over one bug slipping throught! :) You are right with your concern. The two values *are* different. I've changed the name to PY_WRITE_RESTRICTED. The other names should also be prefixed with PY_ to avoid future name clashes. By the way you might be interested in the head. I've created a new PCbuild9 for VS 2008 Express to Professional Edition with support for AMD x64 and PGO. -- nosy: +tiran resolution: - out of date status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1546 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1545] shutil fails when copying to NTFS in Linux
Christian Heimes added the comment: Better patch: import errno try: copystat(src, dst) except OSError, err: # can't change stats on NTFS partition even if # OS supports it if err.errno != errno.EPERM: raise -- keywords: +patch nosy: +tiran priority: - normal versions: +Python 2.6, Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1545 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1547] Minor typos in whatsnew26
Changes by Christian Heimes: -- assignee: - georg.brandl keywords: +patch nosy: +georg.brandl priority: - low __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1547 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1548] Tiny typo in doc\using\cmdline.rst
Changes by Christian Heimes: -- assignee: - georg.brandl keywords: +patch nosy: +georg.brandl priority: - low __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1548 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1455] VS2008, quick hack for distutils.msvccompiler
Christian Heimes added the comment: I've applied the patch to the trunk in r59290 together with a fix for the cygwin compiler. distutils now support VS 2005 and VS 2008 (both tested) and cygwin (only tested for msvcr80). -- resolution: accepted - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1455 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1549] Regression with __hash__ definition and rich comparison operators
Changes by Christian Heimes: -- assignee: - gvanrossum nosy: +gvanrossum priority: - high __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1549 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1537] Change GeneratorExit's base class from Exception to BaseException
Christian Heimes added the comment: Applied in r59300 to the trunk. (This time for real. At first I committed it together with some junk to py3k branch. :/) -- resolution: accepted - fixed status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1537 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1551] Port Python/import.c to py3k branch
New submission from Christian Heimes: Dear Nick! I wasn't able to get your modification to Python/import.c from r59288 to run. Can you please port the files to py3k yourself? Thanks! Christian -- assignee: ncoghlan components: Interpreter Core keywords: py3k messages: 58155 nosy: ncoghlan, tiran priority: high severity: normal status: open title: Port Python/import.c to py3k branch versions: Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1551 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com