[issue1431] pth files not loaded at startup
Brett Cannon added the comment: While I am not sure how I feel about searching every entry on sys.path, I know I don't like the idea of recursing the directory tree. pth files are meant to only be at the top-level of a directory that packages and modules are checked for. -- nosy: +brett.cannon __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1431 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1431] pth files not loaded at startup
Giambattista Bloisi added the comment: What I meant for recursively was not to scan the full directory tree, but just to scan entries that have been added to the os.path. I think that this was the original intention as http://docs.python.org/inst/search-path.html states: Any directories added to the search path will be scanned in turn for .pth files. Also http://docs.python.org/lib/module-site.html states: For each of the distinct head-tail combinations, it sees if it refers to an existing directory, and if so, adds it to sys.path and also inspects the newly added path for configuration files. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1431 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1430] Installing on Vista asks to close Explorer (and Nokia PC Suite)
Changes by David Barlow: __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1430 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1265] pdb bug with with statement
Amaury Forgeot d'Arc added the comment: BTW**2: I've noticed that abc.py's __instancecheck__ gets called a lot at times when I don't expect it. Can you research this a bit? In classobject.c, method_call() calls PyObject_IsInstance() on the first arg when the method is unbound. This happens a lot in io.py, each time the code calls a base class method. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1265 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1433] marshal roundtripping for unicode
New submission from Carl Friedrich Bolz: Marshal does not round-trip unicode surrogate pairs for wide unicode-builds: marshal.loads(marshal.dumps(u\ud800\udc00)) == u'\U0001' This is very annoying, because the size of unicode constants differs between when you run a module for the first time and subsequent runs (because the later runs use the pyc file). -- components: Unicode messages: 57444 nosy: cfbolz severity: normal status: open title: marshal roundtripping for unicode versions: Python 2.5 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1433 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1434] SocketServer creates non-blocking files
New submission from Luke-Jr: SocketServer recently started giving my request handler rfiles that don't block: readfile() gives me a timeout exception. This used to work fine. I begin writing this server with 2.4.3, and it is currently running under 2.4.4, so my suspicious is somewhere in between it changed. -- components: Library (Lib) messages: 57445 nosy: luke-jr severity: normal status: open title: SocketServer creates non-blocking files versions: Python 2.4 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1434 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1435] Support for multiple handlers for the with statement
New submission from Stavros Korokithakis: Currently, the new with statement does not support multiple handlers. For example, to open two files for input/output you would have to do: with open(filein) as input: with open(fileout) as output: #Do stuff pass This adds unnecessary complexity, and would be unwieldy with multiple code blocks. Would something like the following be feasible? with open(filein) as input, open(fileout) as output: # Do stuff pass This syntax is fully backwards-compatible, so there shouldn't be any problem there. -- components: None messages: 57446 nosy: Stavros severity: minor status: open title: Support for multiple handlers for the with statement type: behavior versions: Python 2.5 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1435 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1435] Support for multiple handlers for the with statement
Stavros Korokithakis added the comment: What this syntax does is similar to the nested context manager in case 12 of PEP343, but with cleaner syntax. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1435 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1437] List member inside a class is shared by all instances of the class
New submission from glubglub: In the class below, 'arr' list should be unique for each instance of class Blah. In reality, 'arr' is shared by all instances of 'Blah' class Blah: arr = []# this member should not be # shared across all instances of blah s = '' def __init__(self, s): self.s = s def __str__( self): return '[%s, %s]' % (self.s, str(self.arr)) objs = [] objs.append(Blah('obj-a')) objs.append(Blah('obj-b')) objs.append(Blah('obj-c')) # add to first object's array objs[0].arr.append('abc') # bug: 'abc' got added to all arrays # print all arrays for obj in objs: print obj -- Actual Output: [obj-a, ['abc']] [obj-b, ['abc']] [obj-c, ['abc']] Expected Output: [obj-a, ['abc']] [obj-b, []] [obj-c, []] -- components: Interpreter Core messages: 57449 nosy: glubglub severity: normal status: open title: List member inside a class is shared by all instances of the class versions: Python 2.3, Python 2.4, Python 2.5 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1437 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1437] List member inside a class is shared by all instances of the class
Quentin Gallet-Gilles added the comment: That's the expected behavior, actually. The variables 'arr' and 's' are static variables in the class Blah. This is discussed in several places in the doc and the FAQ, e.g. http://www.python.org/doc/faq/programming/#how-do-i-create-static-class-data-and-static-class-methods What you're looking for is : class Blah: def __init__(self, s): self.arr= [] self.s = s ... -- nosy: +quentin.gallet-gilles __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1437 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1437] List member inside a class is shared by all instances of the class
Christian Heimes added the comment: It's a known feature - and a known gotcha for new Python developers. -- nosy: +tiran resolution: - invalid status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1437 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1436] logging.config.fileConfig, NameError: name 'RotatingFileHandler' is not defined
Christian Heimes added the comment: confirmed The problem is in logging.config._install_handlers(cp, formatters). The code is usin klass = eval(klass, vars(logging)) args = eval(args, vars(logging)) to get the logger class from the logging module. -- nosy: +tiran versions: +Python 2.6, Python 3.0 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1436 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1435] Support for multiple handlers for the with statement
Changes by Christian Heimes: -- components: +Interpreter Core -None priority: - low type: behavior - rfe versions: +Python 2.6 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1435 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1436] logging.config.fileConfig, NameError: name 'RotatingFileHandler' is not defined
Changes by Christian Heimes: -- assignee: - vsajip nosy: +vsajip priority: - normal __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1436 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1415] py3k: pythonw.exe fails because std streams a missing
Christian Heimes added the comment: I consider the bug fixed and closed. Objections? -- status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1415 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1415] py3k: pythonw.exe fails because std streams a missing
Amaury Forgeot d'Arc added the comment: (Sorry, I cannot test just now) What happens if pythonw.exe calls the print() function? Please tell me that it does not throw an exception. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1415 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1342] Crash on Windows if Python runs from a directory with umlauts
Christian Heimes added the comment: I like to move _PyExc_Init() before _PySys_Init() and set sys.prefix, exec_prefix and executable with PyUnicode_DecodeFSDefault(). Without the changes Python is seg faulting on Windows when the path contains non ASCII chars. With the patch it is failing with a fatal error which is a tiny bit nicer. Added file: http://bugs.python.org/file8741/py3k_win_nonascii.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1342 __Index: Python/pythonrun.c === --- Python/pythonrun.c (revision 58959) +++ Python/pythonrun.c (working copy) @@ -217,6 +217,9 @@ Py_FatalError(Py_Initialize: can't initialize builtins dict); Py_INCREF(interp-builtins); + /* initialize builtin exceptions */ + _PyExc_Init(); + sysmod = _PySys_Init(); if (sysmod == NULL) Py_FatalError(Py_Initialize: can't initialize sys); @@ -239,9 +242,6 @@ _PyImport_Init(); - /* initialize builtin exceptions */ - _PyExc_Init(); - /* phase 2 of builtins */ _PyImport_FixupExtension(__builtin__, __builtin__); Index: Python/sysmodule.c === --- Python/sysmodule.c (revision 58958) +++ Python/sysmodule.c (working copy) @@ -1072,11 +1072,12 @@ SET_SYS_FROM_STRING(platform, PyUnicode_FromString(Py_GetPlatform())); SET_SYS_FROM_STRING(executable, - PyUnicode_FromString(Py_GetProgramFullPath())); + PyUnicode_DecodeFSDefault( +Py_GetProgramFullPath())); SET_SYS_FROM_STRING(prefix, - PyUnicode_FromString(Py_GetPrefix())); + PyUnicode_DecodeFSDefault(Py_GetPrefix())); SET_SYS_FROM_STRING(exec_prefix, - PyUnicode_FromString(Py_GetExecPrefix())); + PyUnicode_DecodeFSDefault(Py_GetExecPrefix())); SET_SYS_FROM_STRING(maxint, PyInt_FromLong(PyInt_GetMax())); SET_SYS_FROM_STRING(maxsize, ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1415] py3k: pythonw.exe fails because std streams a missing
Amaury Forgeot d'Arc added the comment: Is it the only possibility? On Windows, it is quite common to print to stdout for debugging purposes, then deploy the application with pythonw.exe which suppresses the console. Without any change to the code. Most pygame programs I know work this way, and C programs have the same behaviour. Prints should work, even if they discard their output. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1415 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1415] py3k: pythonw.exe fails because std streams a missing
Christian Heimes added the comment: As far as I can see print() works if sys.stdout is either None (discard output ASAP) or a file like object. Even print(file=syst.stderr) works. sys.stdout.write() is going to fail when sys.stdout is None but that's not my concern. It's another well documented difference between Python 2.x and 3.x. If people still need a valid but no op stdout they can set up their own: class NullWriter: def write(self, data): pass if sys.stdout is None: sys.stdout = NullWriter() Done ;) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1415 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1415] py3k: pythonw.exe fails because std streams a missing
Amaury Forgeot d'Arc added the comment: As far as I can see print() works if sys.stdout is either None (discard output ASAP) or a file like object. Even print(file=syst.stderr) works. Ah, I prefer this. sys.stdout.write() is going to fail when sys.stdout is None but that's not my concern. It's not very important indeed. I'm happy with the current behaviour. Let's close this issue. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1415 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1438] Calling base class methods is slow due to __instancecheck__ override in abc.py
New submission from Guido van Rossum: [Guido] I've noticed that abc.py's __instancecheck__ gets called a lot at times when I don't expect it. Can you research this a bit? [Amaury] In classobject.c, method_call() calls PyObject_IsInstance() on the first arg when the method is unbound. This happens a lot in io.py, each time the code calls a base class method. [Guido] I wonder if we should get rid of this isinstance check. It is only used to be able to issue a pedantic error message. Perhaps we could even get rid of unbound methods, and just return the underlying function object instead of creating an unbound method object. This should make things a bit faster. -- messages: 57461 nosy: gvanrossum severity: normal status: open title: Calling base class methods is slow due to __instancecheck__ override in abc.py versions: Python 3.0 __ 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
[issue1438] Calling base class methods is slow due to __instancecheck__ override in abc.py
Changes by Guido van Rossum: -- assignee: - gvanrossum __ 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
[issue1433] marshal roundtripping for unicode
Guido van Rossum added the comment: I think this is unavoidable. Depending on whether you happen to be using a narrow or wide unicode build of Python, \U may be turned into a pair of surrogates anyway. It's not just marshal that's not roundtripping; the utf-8 codec has the same issue (and so does the utf-16 codec I presume). You will have to code around it. I think that the alternative would be more painful in other circumstances. -- nosy: +gvanrossum __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1433 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1434] SocketServer creates non-blocking files
Guido van Rossum added the comment: Please provide a self-contained example program that behaves correctly in 2.4.3 and fails in 2.4.4 if you want us to investigate this further. How does it behave with 2.5.1? -- nosy: +gvanrossum __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1434 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1435] Support for multiple handlers for the with statement
Guido van Rossum added the comment: I don't think the added syntactic complexity is worth the relatively rare use case, especially since there's already an implementation of nested() in the contextlib library. -- nosy: +gvanrossum resolution: - wont fix status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1435 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1436] logging.config.fileConfig, NameError: name 'RotatingFileHandler' is not defined
Guido van Rossum added the comment: Somebody please propose a patch! -- nosy: +gvanrossum __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1436 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1342] Crash on Windows if Python runs from a directory with umlauts
Guido van Rossum added the comment: If this doesn't cause any problems on other platforms, go for it. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1342 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1436] logging.config.fileConfig, NameError: name 'RotatingFileHandler' is not defined
Vinay Sajip added the comment: This is not a bug: I think you are missing something. In the first example (interactive usage), the lines import logging and import logging.handlers do not magically introduce RotatingFileHandler into your interactive session's globals. To do this, you would have to say from logging.handlers import RotatingFileHandler. An analogous example unrelated to logging: ActivePython 2.4.3 Build 12 (ActiveState Software Inc.) based on Python 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import httplib HTTP Traceback (most recent call last): File stdin, line 1, in ? NameError: name 'HTTP' is not defined httplib.HTTP class httplib.HTTP at 0x00A759F0 In the second example (using fileConfig), the documentation in http://docs.python.org/lib/logging-config-fileformat.html clearly states that the class and arguments are evaluated using the logging package's namespace. This means that for a handler defined in the logging package itself (such as StreamHandler) no qualification is required, but for a handler defined in the handlers subpackage, you should specify handlers.RotatingFileHandler in the configuration file rather than RotatingFileHandler or logging.handlers.RotatingFileHandler. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1436 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1436] logging.config.fileConfig, NameError: name 'RotatingFileHandler' is not defined
Changes by Vinay Sajip: -- resolution: - invalid status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1436 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1431] pth files not loaded at startup
Brett Cannon added the comment: For what you meant by recursion, that makes more sense. But as for whether this is correct or not, read the next paragraph in the site docs (http://docs.python.org/dev/library/site.html#module-site). It says A path configuration file is a file whose name has the form package.pth and exists in one of the four directories mentioned above. So the newly added path is the four paths mentioned in that paragraph (e.g., the ones that involve sys.prefix and sys.exec_prefix. So the docs do not suggest that any recursive check is done, nor does it need to worry about pre-existing directories. It just needs to check site-packages locations and site-python. If site.py is not checking those directories, it is a bug, otherwise I think the current behaviour matches the documentation. -- assignee: - brett.cannon __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1431 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1433] marshal roundtripping for unicode
Martin v. Löwis added the comment: As Guido says: this is by design. The Unicode type doesn't really support storage of surrogates; so don't use it for that. -- nosy: +loewis resolution: - wont fix status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1433 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1439] proposed 3000 patch for socket.py - socket GC worries
New submission from Bill Janssen: This patch essentially makes GC of sockets work again. See http://mail.python.org/pipermail/python-3000/2007-October/ 011058.html and all the threads in http://mail.python.org/pipermail/ python-3000/2007-October/thread.html with subject line socket GC worries for a full discussion. -- assignee: gvanrossum components: Library (Lib) files: b keywords: patch, py3k messages: 57470 nosy: gvanrossum, janssen severity: normal status: open title: proposed 3000 patch for socket.py - socket GC worries versions: Python 3.0 Added file: http://bugs.python.org/file8742/b __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1439 __ b Description: Binary data ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1429] FD leak in SocketServer
Raghuram Devarakonda added the comment: Please provide a small test code that manifests the problem. It is always the best way to get quick response. -- nosy: +draghuram __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1429 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1431] pth files not loaded at startup
Giambattista Bloisi added the comment: This make sense. I hope I'm not annoying you. But what I did was to read (http://docs.python.org/inst/search-path.html) before reading (http://docs.python.org/dev/library/site.html#module-site) as the latter is referenced by the first via a html link. The part of my interest of the first document says: The expected convention for locally installed packages is to put them in the .../site-packages/ directory, but you may want to install Python modules into some arbitrary directory. For example, your site may have a convention of keeping all software related to the web server under /www. Add-on Python modules might then belong in /www/python, and in order to import them, this directory must be added to sys.path. There are several different ways to add the directory. The most convenient way is to add a path configuration file to a directory that's already on Python's path, usually to the .../site-packages/ directory. Path configuration files have an extension of .pth, and each line must contain a single path that will be appended to sys.path. (Because the new paths are appended to sys.path, modules in the added directories will not override standard modules. This means you can't use this mechanism for installing fixed versions of standard modules.) So the gobolinux maintainer did: it added a file into this dir and it is actually parsed and some dirs are appended to sys.path. And after that the document says what already quoted: Paths can be absolute or relative, in which case they're relative to the directory containing the .pth file. Any directories added to the search path will be scanned in turn for .pth files. See site module documentation for more information. So why repeat here that some other directories will be scanned for pth files, while you describe the accepted format for paths in .pth files? If the only scanned directories are the ones already cited (a directory that's already on Python's path), IMO there is no need to specify further, unless you mean that the single path appended to sys.path that you are describing will be scanned *in turn* for .pth file. On the other hand the second document doesn't say explicitly that the *only* scanned directories are the ones derived from sys.prefix and sys.exec_prefix. Indeed on darwin (Mac Os X) additional directories are actually parsed. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1431 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1431] pth files not loaded at startup
Brett Cannon added the comment: I have made this a documentation bug as obviously there is some needed clarification in how .pth files are handled. If you have any suggested wording, Giambattista, then please feel free to submit patches against the 2.6 docs (easier to work with since they are in reStructuredText format). Otherwise I will try to get to this when I can (which might be a while =). -- components: +Documentation -Library (Lib) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1431 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1342] Crash on Windows if Python runs from a directory with umlauts
Christian Heimes added the comment: I'm setting the priority to normal. The issue isn't resolved but it's not critical for the next alpha release. By the way what's your ETA for the next alpha, Guido? -- priority: high - normal __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1342 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1134] Parsing a simple script eats all of your memory
Christian Heimes added the comment: The issue isn't fixed yet. The script is still eating precious memory. -- nosy: +gvanrossum, tiran priority: high - urgent __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1134 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1440] Checks for PySys_GetObject(std???) == Py_None
New submission from Christian Heimes: Can you please review the patch. It's not urgent. It adds additional tests for std??? == Py_None to some functions to speed up things or raise more meaningful exceptions when sys.std??? is None. -- assignee: gvanrossum components: Interpreter Core files: py3k_std_none_check.patch keywords: patch, py3k messages: 57476 nosy: gvanrossum, tiran priority: low severity: normal status: open title: Checks for PySys_GetObject(std???) == Py_None versions: Python 3.0 Added file: http://bugs.python.org/file8743/py3k_std_none_check.patch __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1440 __Index: Python/errors.c === --- Python/errors.c (Revision 58966) +++ Python/errors.c (Arbeitskopie) @@ -626,7 +626,7 @@ PyObject *f, *t, *v, *tb; PyErr_Fetch(t, v, tb); f = PySys_GetObject(stderr); - if (f != NULL) { + if (f != NULL f != Py_None) { PyFile_WriteString(Exception , f); if (t) { PyObject* moduleName; Index: Python/pythonrun.c === --- Python/pythonrun.c (Revision 58966) +++ Python/pythonrun.c (Arbeitskopie) @@ -335,7 +335,7 @@ PyObject *ferr = PySys_GetObject(stderr); PyObject *tmp; - if (fout != NULL) { + if (fout != NULL fout != Py_None) { tmp = PyObject_CallMethod(fout, flush, ); if (tmp == NULL) PyErr_Clear(); @@ -343,7 +343,7 @@ Py_DECREF(tmp); } - if (ferr != NULL) { + if (ferr != NULL || ferr != Py_None) { tmp = PyObject_CallMethod(ferr, flush, ); if (tmp == NULL) PyErr_Clear(); @@ -693,6 +693,8 @@ m = PyImport_ImportModule(site); if (m == NULL) { f = PySys_GetObject(stderr); + if (f == NULL || f == Py_None) + return; if (Py_VerboseFlag) { PyFile_WriteString( 'import site' failed; traceback:\n, f); @@ -900,7 +902,7 @@ if (fp == stdin) { /* Fetch encoding from sys.stdin */ v = PySys_GetObject(stdin); - if (!v) + if (v == NULL || v == Py_None) return -1; oenc = PyObject_GetAttrString(v, encoding); if (!oenc) @@ -1293,7 +1295,10 @@ int err = 0; PyObject *f = PySys_GetObject(stderr); Py_INCREF(value); - if (f == NULL) { + if (f == Py_None) { + /* pass */ + } + else if (f == NULL) { _PyObject_Dump(value); fprintf(stderr, lost sys.stderr\n); } Index: Python/bltinmodule.c === --- Python/bltinmodule.c (Revision 58966) +++ Python/bltinmodule.c (Arbeitskopie) @@ -1265,17 +1265,17 @@ return NULL; /* Check that stdin/out/err are intact */ - if (fin == NULL) { + if (fin == NULL || fin == Py_None) { PyErr_SetString(PyExc_RuntimeError, input(): lost sys.stdin); return NULL; } - if (fout == NULL) { + if (fout == NULL || fout == Py_None) { PyErr_SetString(PyExc_RuntimeError, input(): lost sys.stdout); return NULL; } - if (ferr == NULL) { + if (ferr == NULL || ferr == Py_None) { PyErr_SetString(PyExc_RuntimeError, input(): lost sys.stderr); return NULL; Index: Python/sysmodule.c === --- Python/sysmodule.c (Revision 58966) +++ Python/sysmodule.c (Arbeitskopie) @@ -89,7 +89,7 @@ if (PyObject_SetAttrString(builtins, _, Py_None) != 0) return NULL; outf = PySys_GetObject(stdout); - if (outf == NULL) { + if (outf == NULL || outf == Py_None) { PyErr_SetString(PyExc_RuntimeError, lost sys.stdout); return NULL; } Index: Modules/_ctypes/callbacks.c === --- Modules/_ctypes/callbacks.c (Revision 58966) +++ Modules/_ctypes/callbacks.c (Arbeitskopie) @@ -17,7 +17,7 @@ va_start(marker, msg); vsnprintf(buf, sizeof(buf), msg, marker); va_end(marker); - if (f) + if (f != NULL f != Py_None) PyFile_WriteString(buf, f); PyErr_Print(); } Index: Modules/threadmodule.c === --- Modules/threadmodule.c (Revision 58966) +++ Modules/threadmodule.c (Arbeitskopie) @@ -429,7 +429,7 @@ PySys_WriteStderr( Unhandled exception in thread started by ); file = PySys_GetObject(stderr); - if (file) + if (file != NULL file != Py_None) PyFile_WriteObject(boot-func, file, 0); else PyObject_Print(boot-func, stderr, 0); Index: Modules/_cursesmodule.c === --- Modules/_cursesmodule.c (Revision 58966) +++ Modules/_cursesmodule.c (Arbeitskopie) @@ -2010,7 +2010,7 @@ sys_stdout = PySys_GetObject(stdout); - if (sys_stdout == NULL) { + if (sys_stdout == NULL || sys_stdout == Py_None) { PyErr_SetString( PyCursesError, lost sys.stdout); ___ Python-bugs-list mailing list Unsubscribe:
[issue1134] Parsing a simple script eats all of your memory
Guido van Rossum added the comment: Amaury, can you have a look at this? I think it's a bug in tok_nextc() in tokenizer.c. -- assignee: nnorwitz - amaury.forgeotdarc nosy: +amaury.forgeotdarc __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1134 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1134] Parsing a simple script eats all of your memory
Viktor Ferenczi added the comment: This bug prevents me and many others to do preliminary testing on Py3k, which slows down it's development. This bug is _really_ hurts. I've a completely developed new module for Py3k that cannot be released due to this bug, since it's unit tests are affected by this bug and would crash the user's machine. Sadly I've not enough free time and readily available in-depth knowledge to fix this, especially after the first attempt was not perfect, which shows that it may be a bug that cannot be fixed by correcting a typo somewhere... :-) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1134 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1417] Weakref not working properly
Gabriel Genellina added the comment: I think this methodref function is simpler and much less intrusive -- nosy: +gagenellina Added file: http://bugs.python.org/file8744/methodref.py __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1417 __import weakref import new class methodref(weakref.ref): def __new__(cls, method, callback=None): if not isinstance(method, new.instancemethod): raise TypeError, 'instancemethod expected; got %s instead' % type(method) wr = super(methodref, cls).__new__(cls, method.im_self, callback) wr.im_func = method.im_func wr.im_class = method.im_class return wr def __call__(self): im_self = super(methodref, self).__call__() if im_self is not None: return new.instancemethod(self.im_func, im_self, self.im_class) class cls1: def giveTo(self, to): to.take(self.bla) def bla(self, arg): print self, says, arg class cls2: def take(self, what): self.ref = methodref(what) c1 = cls1() c2 = cls2() print weakref.getweakrefs(c1) c1.giveTo(c2) print weakref.getweakrefs(c1) print c1.bla print c2.ref c1.bla(hi) c2.ref()(hello) ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1442] pythonstartup addition of minor error checking
New submission from Joseph Armbruster: Trunk revision: 58963 Description: No warning or error is reported it a file pointed to by PYTHONSTARTUP is not readable. Request: To display a warning so that the user may be notified. Note: Errors that may occur in PyRun_SimpleFileExFlags are being cast away, may be worthwhile to report an error for those as well (unless this was avoided for good reason :-) Suggestion: static void RunStartupFile(PyCompilerFlags *cf) { char *startup = Py_GETENV(PYTHONSTARTUP); if (startup != NULL startup[0] != '\0') { FILE *fp = fopen(startup, r); if (fp != NULL) { (void) PyRun_SimpleFileExFlags(fp, startup, 0, cf); PyErr_Clear(); fclose(fp); } else { fprintf(stderr,Warning: Could not read startup file %s\n,startup); } } } -- components: Interpreter Core messages: 57482 nosy: JosephArmbruster severity: minor status: open title: pythonstartup addition of minor error checking type: behavior versions: Python 2.6 __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1442 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1134] Parsing a simple script eats all of your memory
Guido van Rossum added the comment: Is this also broken in the 3.0a1 release? If not, it might be useful to try to find the most recent rev where it's not broken. __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1134 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1431] pth files not loaded at startup
Changes by Gabriel Genellina: -- nosy: +gagenellina __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1431 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com