[issue10756] Error in atexit._run_exitfuncs [...] Exception expected for value, str found

2011-05-15 Thread kai zhu
kai zhu kai...@ugcs.caltech.edu added the comment: should this bug b closed? it seems fixed in python3.2 for me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10756

[issue12075] python3.2 memory leak when setting integer key in dictionary

2011-05-15 Thread kai zhu
kai zhu kai...@ugcs.caltech.edu added the comment: explicit gc.collect() doesn't seem to fix the leak in my application. my current fix is to not re-instantiate the class attribute (which cost ~7mb) during reload instead reference one created earlier. i haven't pinpointed y, but i suspect its

[issue12075] python3.2 memory leak when setting integer key in dictionary

2011-05-14 Thread kai zhu
New submission from kai zhu kai...@ugcs.caltech.edu: i'm using the latest debian unstable python3.2 build on colinux (2011, may, 14) ## leak.py ## import imp, leak; imp.reload(leak) ## will leak ~2.5mb per reload ## on i386 debian unstable machine (according to top). ## in my real world app

[issue11095] subprocess popen broken for bytes and backslash

2011-02-01 Thread kai zhu
New submission from kai zhu kai...@ugcs.caltech.edu: noticed when trying to call grep w/ backslashes in regexp, in shell mode. same behavior on python2.5 python3.2 in shell mode: 1. bytes is broken 2. 1st character after backslash is always silently truncated (with exception

[issue11095] subprocess popen broken for bytes and backslash

2011-02-01 Thread kai zhu
Changes by kai zhu kai...@ugcs.caltech.edu: -- components: +IO, Library (Lib) ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11095 ___ ___ Python

[issue10953] safely eval serialized dict/list data from arbitrary string over web with no side effects

2011-01-19 Thread kai zhu
New submission from kai zhu kai...@ugcs.caltech.edu: rather than serialize python dicts list to json / xml / protocol buffer for web use, its more efficient to just serialize w/ repr() then use eval(), if only there was a way to guarantee arbitrary code can't b executed. this is a very

[issue10802] python3.2 AFTER b2 release has subprocess.Popen broken under colinux/windows

2011-01-02 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: tested w/ following debug code. looks like greg is correct - HAVE_PIPE2 should NOT b defined under colinux. diff -r 6fa1e3b94d8f Modules/_posixsubprocess.c --- a/Modules/_posixsubprocess.cSat Jan 01 22:18:46 2011 +0100 +++ b/Modules

[issue10802] python3.2 AFTER b2 release has subprocess.Popen broken under colinux/windows

2011-01-02 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: i used the same almost vanilla configure for both: $ ./configure --prefix=$USERPATH; make -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10802

[issue10802] python3.2 AFTER b2 release has subprocess.Popen broken under colinux/windows

2011-01-02 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: the culprit was my colinux kernel (2.6.26.8-co-0.7.7.1) did not have pipe2 support (which libc erronenously assumed). updating the kernel fixed the problem. the libc issue is partially discussed @ http://www.0x61.com/forum/linux-kernel-f109

[issue10802] python3.2 AFTER b2 release has subprocess.Popen broken under colinux/windows

2011-01-02 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: hi martin, did an strace the 'not implemented' system call was pipe2() pipe2 exists in libc (checked w/ ctypes), but is broken for old linux kernels as mentioned previously. -- Added file: http://bugs.python.org/file20221/trace2.txt

[issue10802] python3.2 AFTER b2 release has subprocess.Popen broken under colinux/windows

2011-01-02 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: re-tested under old 2.6.26 kernel using previous foo.py example: 1. unpatched python3.2 broken as expected 2. patched python3.2 now works :) strace confirms ENOSYS being raised from pipe2() in both cases

[issue10802] python3.2 AFTER b2 release has subprocess.Popen broken under colinux/windows

2011-01-01 Thread kai zhu
New submission from kai zhu kaizhu...@gmail.com: i have 2 debian i386 unstable distros. 1) python3.2 (latest hg) running under vps @ linode.com seems ok 2) python3.2 (latest hg) running under colinux (in windows xp) breaks *NOTE 3) python3.2 (release b2) works fine under colinux pub...@colinux

[issue10756] Error in atexit._run_exitfuncs [...] Exception expected for value, str found

2010-12-21 Thread kai zhu
New submission from kai zhu kaizhu...@gmail.com: pub...@colinux 3 ~: python3.2 Python 3.2b2 (py3k, Dec 22 2010, 02:38:55) [GCC 4.4.5] on linux2 Type help, copyright, credits or license for more information. import atexit; atexit.register(lambda:1/0) function lambda at 0xb7c7e12c exit() Error

[issue10041] socket.makefile(mode = 'r').readline() silently removes carriage return

2010-10-12 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: done ;p added separate unicode read, write, and readwrite test cases (which all pass) keep in mind my issue is specific to truncation of carriage return (imo a priority for py3k migration). i think this can b resolved by python 3.2 more general

[issue10041] socket.makefile(mode = 'r').readline() silently removes carriage return

2010-10-11 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: np antoine :) this 2 line patch will match socket.makefile() signature with open(). any chance it can b committed b4 python3.2 beta? i rely on this patch in order to forward-port redis to python3 -- Added file: http://bugs.python.org

[issue10041] socket.makefile(mode = 'r').readline() silently removes carriage return

2010-10-11 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: added unittest to patch tested test.test_socket on debian colinux running under winxp i get 2 unrelated errors (in both patched and unpatched version) from testRDM and testStream about socket.AF_TIPC being unsupported: pub...@colinux 3

[issue10041] socket.makefile(mode = 'r').readline() silently removes carriage return

2010-10-11 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: updated unittest patch -- Added file: http://bugs.python.org/file19195/socket.makefile.with.unittest.v2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10041

[issue10041] socket.makefile(mode = 'r').readline() silently removes carriage return

2010-10-07 Thread kai zhu
New submission from kai zhu kaizhu...@gmail.com: i'm working on an independent py2to3 utility which directly imports py2x modules, by reverse compiling ast trees (code.google.com/p/asciiporn/source/browse/stable.py) while forward porting the python2x redis client, this issue came up. i kno

[issue10041] socket.makefile(mode = 'r').readline() silently removes carriage return

2010-10-07 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: my bad for not rtfm, but it seems the newline argument has no effect in socket.makefile. the TextIOWrapper signatures don't seem to match. a hack to put newline parameter in 4th position or making it a keyword arg doesn't work either (scratch

[issue10041] socket.makefile(mode = 'r').readline() silently removes carriage return

2010-10-07 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: my bad again, hacking newline parameter to the correct argument position works (its in the position where error should b). a one line patch would be: socket.py line 163 -text = io.TextIOWrapper(buffer, encoding, newline) +text

[issue10041] socket.makefile(mode = 'r').readline() silently removes carriage return

2010-10-07 Thread kai zhu
Changes by kai zhu kaizhu...@gmail.com: -- keywords: +patch Added file: http://bugs.python.org/file19156/socket.makefile.newline.kwarg.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10041

[issue9291] mimetypes initialization fails on Windows because of non-Latin characters in registry

2010-08-12 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: python 3.1.2 mimetypes initialization also fails in redhat linux: import http.server Traceback (most recent call last): File /home/public/i386-redhat-linux-gnu/python/lib/python3.1/http/server.py, line 588, in module class

[issue7775] str.rpartition(sep) - (tail, sep, head)

2010-01-25 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: documentation bug should be changed to: S.rpartition(sep) - (head, sep, tail) help(str.rpartition) Help on method_descriptor: rpartition(...) S.rpartition(sep) - (tail, sep, head) Search for the separator sep in S, starting at the end

[issue7775] str.rpartition(sep) - (tail, sep, head)

2010-01-24 Thread kai zhu
Changes by kai zhu kaizhu...@gmail.com: -- assignee: georg.brandl components: Documentation nosy: georg.brandl, kaizhu severity: normal status: open title: str.rpartition(sep) - (tail, sep, head) versions: Python 3.1 ___ Python tracker rep

[issue7338] recursive __attribute__ - Fatal Python error: Cannot recover from stack overflow.

2009-11-17 Thread kai zhu
New submission from kai zhu kaizhu...@gmail.com: Python 3.1.1 (r311:74480, Sep 13 2009, 17:17:12) [GCC 4.3.2] on linux2 Type help, copyright, credits or license for more information. class Foo(object): ... def __getattribute__(self, attr): ... try: return object.__getattribute__(attr

[issue3555] Regression: nested exceptions crash (Cannot recover from stack overflow)

2009-11-17 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: just submitted a nearly identical bug (#7338) b4 checking for this one. so u think it works correctly up to the 2nd N+50 check. can someone give a reason y we should crash after that instead of throwing a fallback RuntimeError? -- nosy

[issue6950] online documentation error: PyObject* PyByteArray_Resize(PyObject *bytearray, Py_ssize_t len)

2009-09-19 Thread kai zhu
New submission from kai zhu kaizhu...@gmail.com: according to bytearrayobject.c, PyByteArray_Resize should return int (not PyObject *) error found @ http://docs.python.org/dev/py3k/c-api/bytearray.html http://docs.python.org/c-api/bytearray.html -- assignee: georg.brandl components

[issue6861] bytearray.__new__ doesn't subclass

2009-09-07 Thread kai zhu
New submission from kai zhu kaizhu...@gmail.com: # a00.py parent = bytearray # fails # parent = bytes # works # parent = str # works class Foo(parent): def __new__(klass, x): return parent.__new__(klass, x) Foo(x = None) $ python3.1 -c import a00 Traceback (most recent call last

[issue6239] c_char_p return value returns string, not bytes

2009-08-22 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: wrote an extension application which relies on the patch (works after applying patch to python 3.1.1). it converts png images to colorized ascii-art on ansi-compatible terminal. requires the patch b/c a ctype function returns a c-string w/ ansi

[issue6239] c_char_p return value returns string, not bytes

2009-08-22 Thread kai zhu
Changes by kai zhu kaizhu...@gmail.com: Added file: http://bugs.python.org/file14769/_asciiporn.h ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6239

[issue6239] c_char_p return value returns string, not bytes

2009-08-21 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: i just found this bug independently, but yes its a bug, which i hope gets fixed for sake of extension community: // test.c beg char s[4] = ab\xff; char *foo() { return s; } // test.c end $ gcc -fPIC -g -c -Wall test.c $ gcc -shared test.o -o

[issue6504] infinite recursion from calling builtins.open()

2009-07-18 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: current hack-around, then is to pre-import locale, which is verified to work: # beg test.py class importer(object): def find_module(self, mname, path = None): open(foo.txt) import sys, locale; sys.meta_path.append(importer) import collections

[issue6502] documentation error: missing comma between kwonlyargcount nlocals

2009-07-17 Thread kai zhu
New submission from kai zhu kaizhu...@gmail.com: missing comma between kwonlyargcount nlocals class code(object) | code(argcount, kwonlyargcount nlocals, stacksize, flags, codestring, |constants, names, varnames, filename, name, firstlineno, |lnotab[, freevars[, cellvars

[issue6504] infinite recursion from calling builtins.open()

2009-07-17 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: recursion also goes away if we open as raw bytes: open(foo.txt, rb). modes r+ w also give infinite recursion, while rb+ wb do not. note found another bug: instance method find_module should raise exception anyway, since its class

[issue6509] re.py - compiled byte-object regular expr encounter unexpected str-object

2009-07-17 Thread kai zhu
New submission from kai zhu kaizhu...@gmail.com: import re compiled = re.compile(ba(\w)) s = baa s = compiled.sub(ba\\1, s) Traceback (most recent call last): File stdin, line 1, in module File .../lib/python3.1/re.py, line 303, in filter return sre_parse.expand_template(template

[issue6509] re.py - compiled byte-object regular expr encounter unexpected str-object

2009-07-17 Thread kai zhu
Changes by kai zhu kaizhu...@gmail.com: -- components: +Regular Expressions ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6509 ___ ___ Python-bugs

[issue6509] re.py - compiled byte-object regular expr encounter unexpected str-object

2009-07-17 Thread kai zhu
kai zhu kaizhu...@gmail.com added the comment: traced culprit to sre_parse.py line 711 (where literal is always str): ... def parse_template(source, pattern): # parse 're' replacement string into list of literals and # group references s = Tokenizer(source) sget = s.get p

[issue4360] SystemError when method has both super() closure

2008-11-20 Thread kai zhu
New submission from kai zhu [EMAIL PROTECTED]: # super_closure.py class A(object): def foo(self): return super() # remove the closure below # SystemError goes away ??? lambda: self A().foo() when run on 3.0rc1

[issue4360] SystemError when method has both super() closure

2008-11-20 Thread kai zhu
kai zhu [EMAIL PROTECTED] added the comment: here's a printout of bytecode from script s = open(super_closure.py).read() c = compile(s, super_closure.py, exec) t = py3to2.codetree(c) print( t ) codetree( co_argcount = 0, co_cellvars = (), co_code = b'Gd\x00\x00\x84\x00\x00d

[issue4360] SystemError when method has both super() closure

2008-11-20 Thread kai zhu
kai zhu [EMAIL PROTECTED] added the comment: same thing, except w/ closure commented out ( everything is happy) # super_ok.py class A(object): def foo(self): return super() # comment the closure below # SystemError goes away # lambda: self

[issue4360] SystemError when method has both super() closure

2008-11-20 Thread kai zhu
kai zhu [EMAIL PROTECTED] added the comment: oops, sorry reprinted the same code ^^;;; ignore previous post, use this: (sorry again for mucking up this page) # super_ok.py class A(object): def foo(self): return super() # comment the closure below

[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-10-24 Thread kai zhu
kai zhu [EMAIL PROTECTED] added the comment: post fyi: here's moderately complex python-3.0 script (plus curry extension) i wrote using numpy, PIL, scipy.weave 2.6 extensions. it takes a jpeg, gif... image file outputs it in colorized ascii art. the actual purpose is for colorized 3-d

[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-10-24 Thread kai zhu
Changes by kai zhu [EMAIL PROTECTED]: Added file: http://bugs.python.org/file11873/img2txt 3dplot screenshot.gif ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3238

[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-10-24 Thread kai zhu
Changes by kai zhu [EMAIL PROTECTED]: Added file: http://bugs.python.org/file11874/img2txt.py ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3238 ___ ___ Python

[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-10-24 Thread kai zhu
Changes by kai zhu [EMAIL PROTECTED]: Added file: http://bugs.python.org/file11875/mario.jpg ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3238 ___ ___ Python

[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-10-21 Thread kai zhu
Changes by kai zhu [EMAIL PROTECTED]: Added file: http://bugs.python.org/file11844/py3to2.py ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3238 ___ ___ Python

[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-10-21 Thread kai zhu
kai zhu [EMAIL PROTECTED] added the comment: hi, i'm happy i got a response on this :) anyway, can u elaborate on the reason y something like this was never done? yes, i kno the patch is rough right now ( will never get accepted in its current state), but its now proven to work, gives

[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-10-21 Thread kai zhu
kai zhu [EMAIL PROTECTED] added the comment: k ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3238 ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-10-20 Thread kai zhu
kai zhu [EMAIL PROTECTED] added the comment: ported to python-2.6 is a bit more stable (written a few py3k programs w/ it). the patches have been simplified consolidated to a single file: ceval.c u can also test out scripts generated by 2to3 by adding to them the magic line: from __future__

[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-10-20 Thread kai zhu
Changes by kai zhu [EMAIL PROTECTED]: -- keywords: +patch Added file: http://bugs.python.org/file11843/ceval.20081020.diff ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3238

[issue3692] improper scope in list comprehension, when used in class declaration

2008-08-26 Thread kai zhu
New submission from kai zhu [EMAIL PROTECTED]: in 3rd line, list comprehension tries to access class_attribute1 as a global variable (code is valid in python 2.5) class Foo(object): ... class_attribute1 = 1 ... class_attribute2 = [class_attribute1 for x in range(8)] ... Traceback (most

[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-07-13 Thread kai zhu
kai zhu [EMAIL PROTECTED] added the comment: import/reload now works. accomplished by adding 5 lines in parse_source_module (import.c) to 1st check for the hook __builtins__.parse_source_module_py3k. the hook will automatically compile in py3k format if it finds the magic comment: # import

[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-07-13 Thread kai zhu
kai zhu [EMAIL PROTECTED] added the comment: why not? it allows developers to migrate 2.x scripts one-by-one to working 3.0 conformant ones while maintaining backwards-compatibility w/ existing 2.x scripts extension modules (eg. numpy, PIL, zope, ...) py3to2 can transparently import mix

[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-07-13 Thread kai zhu
kai zhu [EMAIL PROTECTED] added the comment: then the 2 can complement each other well ;) i don't c any competition between them as they have completely different objectives 2to3 - convert 2x scripts to 3k py3to2 - use the newly created 3k scripts in existing 2x environ u have to admit

[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-07-09 Thread kai zhu
kai zhu [EMAIL PROTECTED] added the comment: update: these 3k language features have been tested to work in python 2.5.2 w/ the backported opcodes pep3104 Access to Names in Outer Scopes pep3105 Make print a function pep3111 Simple input built-in in Python 3000 pep3113 Removal

[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-06-30 Thread kai zhu
kai zhu [EMAIL PROTECTED] added the comment: ideally that may be true. but its quite frustrating testing/developing new py3k software when many modules/extensions we take for granted in 2.x isn't available. in the meantime, this patch serves as a very convenient stopgap for developers (even w

[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-06-29 Thread kai zhu
New submission from kai zhu [EMAIL PROTECTED]: this patch touches only Python/ceval.c. 1. the only existing thing it modifies is PyEval_EvalFrameEx (adds 7 extra cases for the new 3.0 opcodes, doesn't mess w/ any of the existing ones, or anything else as a matter of fact) 2. that, plus

[issue3238] backport python 3.0 language functionality to python 2.6 by adding 7 opcodes to ceval.c

2008-06-29 Thread kai zhu
kai zhu [EMAIL PROTECTED] added the comment: ok ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3238 ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue3225] backport python 3.0 language functionality to python 2.5 by adding 8 opcodes to ceval.c

2008-06-28 Thread kai zhu
New submission from kai zhu [EMAIL PROTECTED]: this patch touches only Python/ceval.c. 1. the only existing thing it modifies is PyEval_EvalFrameEx (adds 8 extra cases for the new 3.0 opcodes, doesn't mess w/ any of the existing ones, or anything else as a matter of fact) 2. that, plus

[issue3225] backport python 3.0 language functionality to python 2.5 by adding 8 opcodes to ceval.c

2008-06-28 Thread kai zhu
Changes by kai zhu [EMAIL PROTECTED]: ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue3225 ___ ___ Python-bugs-list mailing list Unsubscribe: http