[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-08 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Sat, May 8, 2010 at 11:02 AM, Martin v. Löwis wrote: > Did you mean to include the hunk from msg105295 as part of the patch? > If so, wouldn't that defeat the whole point of the patch? My intention is to offer two compilation modes to extens

[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-08 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Sat, May 8, 2010 at 11:20 AM, Martin v. Löwis wrote: > I'd rather modify PyModuleDef_Base, to include a flags field, and > perhaps put the api version into it, as well. That's an ABI change, > unfortunately, but such a flags field

[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-08 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Sat, May 8, 2010 at 11:35 AM, Marc-Andre Lemburg wrote: > One of the more important cases you are missing is the > argument parser in Python: Thanks. I've had my head buried in c-api/unicode.html and unicodeobject.h. > Py_UNICODE *x;

[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-08 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: In Unicode-agnostic mode, instead of leaving Py_UNICODE, PyUnicodeObject, and many functions undefined, I wonder if it would be sufficient to declare Py_UNICODE like this: struct PY_UNICODE_TYPE; typedef struct PY_UNICODE_TYPE Py_UNICODE; That would allow

[issue8670] c_types.c_wchar should not assume that sizeof(wchar_t) == sizeof(Py_UNICODE)

2010-05-08 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : Using a UCS2 Python on a platform with a 32-bit wchar_t, the following code throws an exception (but should not): >>> ctypes.c_wchar('\u1') Traceback (most recent call last): File "", line 1, in TypeError: one character

[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-09 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Sat, May 8, 2010 at 8:07 AM, Martin v. Löwis wrote: > 1. add a flag to PyModuleDef, indicating whether the module was built in > UCS-2 or UCS-4 mode. Then let the interpreter refuse the load the module, > instead of having the dynamic linker

[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-09 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Sun, May 9, 2010 at 10:12 AM, Marc-Andre Lemburg wrote: > I'm just not sure how you could check for optimization > compiler bugs/features using the buildbots. > Once I have a patch that I'm modestly confident in, I'll write autom

[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-09 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : Removed file: http://bugs.python.org/file17273/unnamed ___ Python tracker <http://bugs.python.org/issue8654> ___ ___ Python-bugs-list mailin

[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-09 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : Removed file: http://bugs.python.org/file17274/unnamed ___ Python tracker <http://bugs.python.org/issue8654> ___ ___ Python-bugs-list mailin

[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-09 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : Removed file: http://bugs.python.org/file17248/unicode.patch ___ Python tracker <http://bugs.python.org/issue8654> ___ ___ Python-bugs-list m

[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-09 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Here is a new patch. Usage, short version: By default, modules compile in Unicode-agnostic mode, where Py_UNICODE is an incomplete type. Unicode-agnostic modules will load in both UCS2 and UCS4 interpreters. If a module defines PY_REAL_PY_UNICODE

[issue1641] asyncore delayed calls feature

2010-05-11 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Tue, May 11, 2010 at 11:55 AM, Giampaolo Rodola' wrote: > Moreover, reset() and delay() methods are not implemented in sched. > > Other problems which comes to mind are: you can't easily know whether a call > has already bee

[issue8692] Use divide-and-conquer for faster factorials

2010-05-11 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : (Making an educated guess about who to add to the Nosy list) Attached is a patch to improve math.factorial by using a divide-and-conquer algorithm. The old algorithm performs n-1 multiplications, mostly on numbers with a very large number of digits

[issue8692] Use divide-and-conquer for faster factorials

2010-05-11 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Tue, May 11, 2010 at 4:18 PM, Alexander Belopolsky wrote: > While the error message is wrong in both cases, I think OverflowError is a > better exception in this case and there should not be a difference between > math.factorial(2.

[issue8692] Use divide-and-conquer for faster factorials

2010-05-11 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Tue, May 11, 2010 at 5:33 PM, Alexander Belopolsky wrote: > It seems to me that the value of n for which number of digits will exceed > sys.maxsize can be estimated fairly accurately using Stirling formula.  Only > two values are relevant in

[issue8692] Use divide-and-conquer for faster factorials

2010-05-11 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Tue, May 11, 2010 at 7:15 PM, Alexander Belopolsky wrote: > The main value in setting a theoretically justified limit is that > overflow exception can carry a meaningful message, e.g. "factorial > result would have too many digits&qu

[issue8692] Use divide-and-conquer for faster factorials

2010-05-11 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Tue, May 11, 2010 at 7:38 PM, Alexander Belopolsky wrote: > Speaking of micro-optimizations, did you consider a better than naive > algorithm for "Count the number of set bits in n" in your patch? > HAKMEM 169 comes to mind and being a

[issue8692] Use divide-and-conquer for faster factorials

2010-05-12 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Thank you both for the valuable feedback. I'm working on a revised patch that incorporates your many suggestions. I decided to use an iterative version for two reasons: - the reference has a note at the bottom in a tiny font suggesting it - I fou

[issue8692] Use divide-and-conquer for faster factorials

2010-05-12 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Wed, May 12, 2010 at 10:31 AM, Alexander Belopolsky wrote: > if ((k & 1) != 1) >          k = k - 1; > > looks odd to me. Maybe k += (k & 1) - 1? If we change the logic slightly to put the odd entry on the right instead of the left, w

[issue8692] Use divide-and-conquer for faster factorials

2010-05-12 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Wed, May 12, 2010 at 12:59 PM, Mark Dickinson wrote: > (4) And please do restore the PyLong_FromDouble line in the main routine, > rather than using a C double-to-long cast.  The direct conversion again leads > to undefined behaviour for larg

[issue8692] Use divide-and-conquer for faster factorials

2010-05-12 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Wed, May 12, 2010 at 3:34 PM, Alexander Belopolsky wrote: > I wonder if one could write an elegant recursive version that would > multiply first by last in partial_product. That could be done with a three-parameter partial_product, where the

[issue8704] cgitb sends a bogus HTTP header if the app crashes before finishing headers

2010-05-13 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : If the CGI script crashes before finishing the headers, cgitb will emit invalid HTTP headers before showing the error message. Below are HTTP headers I received, captured with a packet sniffer. Note the "<--: spam". HTTP/1.1 200 OK Date

[issue8704] cgitb sends a bogus HTTP header if the app crashes before finishing headers

2010-05-13 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : -- keywords: +easy ___ Python tracker <http://bugs.python.org/issue8704> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue8692] Use divide-and-conquer for faster factorials

2010-05-13 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: After experimenting with changing the order of the multiplications and not having much luck, I went back and looked for other differences in Alexander's Python functions that might cause the speed difference. I believe partial_product2 is fast becau

[issue8692] Use divide-and-conquer for faster factorials

2010-05-13 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Isn't it amazing how fast one can make incorrect code? ;-) Here is a fixed version of my partial_product3, but now it is no faster than partial_product. def partial_product3(j, i): a = [l << 1 | 1 for l in range(j, i + 1)] n = len(a)

[issue8692] Use divide-and-conquer for faster factorials

2010-05-13 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Speaking of getting side-tracked, I didn't see an answer to a question I asked earlier. I'd like to get some feedback before I proceed with revising the patch. For the find-last-set-bit (to replace log2) and count-set-bits operations, w

[issue8692] Use divide-and-conquer for faster factorials

2010-05-13 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: That's a clever idea. Do you have a Python script that generates the precomputed values? -- ___ Python tracker <http://bugs.python.org/i

[issue8692] Use divide-and-conquer for faster factorials

2010-05-13 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: It's a little too clever though. It gives the wrong answer for 29!. I'll have a revised version of my patch done sometime tomorrow. -- ___ Python tracker <http://bugs.python.

[issue8692] Use divide-and-conquer for faster factorials

2010-05-13 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Attached is a patch to improve the unit tests for the factorial function. To compute the check value, it keeps a running total instead of recomputing the factorial from scratch inside the loop. It checks up to range(999) and is quite fast. The previous

[issue8692] Use divide-and-conquer for faster factorials

2010-05-13 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Attached is a simple bash script to run math.factorial(n) through timeit for several values of n. It makes comparing the speed of different builds MUCH easier. -- Added file: http://bugs.python.org/file17329/factorial-speed.sh

[issue8704] cgitb sends a bogus HTTP header if the app crashes before finishing headers

2010-05-14 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: It displays correctly in some browsers, yes, but not everything that speaks HTTP is a browser. For example, the invalid header makes C#'s WebRequest throw an exception. I hadn't noticed the 'Content-Type' on the next line of the str

[issue8692] Use divide-and-conquer for faster factorials

2010-05-14 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : Removed file: http://bugs.python.org/file17300/factorial.patch ___ Python tracker <http://bugs.python.org/issue8692> ___ ___ Python-bug

[issue1110705] list comprehension scope

2008-02-21 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: The resolution on this bug reads, "In future versions of Python, Guido would like to change the design to hide the induction variable. So, someday, you'll get your wish." Can this bug be re-opened and the wart removed in 3.0? -- n

[issue1110705] list comprehension scope

2008-02-21 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Wonderful! _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1110705> _ ___ Python-bugs-list mailing list Unsubs

[issue2810] _winreg.EnumValue fails when the registry data includes multibyte unicode characters

2008-05-10 Thread Daniel Stutzbach
New submission from Daniel Stutzbach <[EMAIL PROTECTED]>: _winreg.EnumValue raises a WindowsError ("More data is available") if the registry data includes multibyte unicode characters. Inspecting PyEnumValue in _winreg.c, I believe I see the problem. The function uses Re

[issue2810] _winreg.EnumValue fails when the registry data includes multibyte unicode characters

2008-05-10 Thread Daniel Stutzbach
Daniel Stutzbach <[EMAIL PROTECTED]> added the comment: The bug is in both. On Sat, May 10, 2008 at 12:52 PM, Martin v. Löwis <[EMAIL PROTECTED]> wrote: > > Martin v. Löwis <[EMAIL PROTECTED]> added the comment: > > Is that for Python 2.5 or 3.0?

[issue2810] _winreg.EnumValue fails when the registry data includes multibyte unicode characters

2008-05-11 Thread Daniel Stutzbach
Daniel Stutzbach <[EMAIL PROTECTED]> added the comment: After several failed attempts at making a test case, and stepping through C code with a debugger, I see that my initial diagnose is quite wrong. RegQueryInfoKey *does* return the sizes in units of bytes (even though the Mic

[issue4688] GC optimization: don't track simple tuples and dicts

2008-12-17 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I've looked very quickly over your patches to try to figure what rule qualifies a tuple or dict as simple enough to be untracked, out of curiosity. For tuples, I think the rule is: If an object is immutable, and it points only to untracked objects

[issue4688] GC optimization: don't track simple tuples and dicts

2008-12-17 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Unfortunately, the check is O(n), so it can get a little expensive. I suppose that's no worse than traversing the tuple to look for a cycle, though. Perhaps it could be done at the same time? Can _PyObject_GC_UNTRACK() be safely called from tp_tra

[issue1303434] Please include pdb with windows distribution

2009-01-07 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : -- nosy: +stutzbach ___ Python tracker <http://bugs.python.org/issue1303434> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue4934] tp_del and tp_version_tag undocumented

2009-01-13 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : The PyTypeObject field "tp_version_tag" (new in 2.6) isn't documented. "tp_del" isn't documented either. I'm not sure when it was added. -- assignee: georg.brandl components: Documentation messages: 79755 nos

[issue5229] Documentation for super() neglects to say what super() actually does

2009-02-12 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : The documentation for super() describes the arguments that can be passed to super(), use cases for super(), an example, and caveats about what cannot be done with the returned object. However, the documentation neglects to mention what super() actually

[issue5229] Documentation for super() neglects to say what super() actually does

2009-02-12 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Yes, by citing that article I don't mean to endorse its opinions. Regrettably, it's the best documentation on super() I could find (in an admittedly quick search). Any improvements efforts you make to improve the existing super() documentation

[issue13804] Python library structure creates hard to read code when using higher order functions

2012-01-17 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: If I'm understanding Martin Häcker's code correctly, the list comprehension equivalent is: self.questions = [topic.questions for topic in self.topics] The reduce() variants are not only much harder to read, but they will take O(n**2) operatio

[issue13804] Python library structure creates hard to read code when using higher order functions

2012-01-18 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Ah - in your first example (the one with 3 lines) did you mean to use .extend instead of .append? -- ___ Python tracker <http://bugs.python.org/issue13

[issue9141] Allow objects to decide if they can be collected by GC

2012-04-06 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Fri, Apr 6, 2012 at 12:51 PM, Jim Jewett wrote: > __del__ methods do run, even if an object was collected by the cycle > detector. And they can't do any harm that couldn't also be done by a C > finalizer. > No, if an object wi

[issue9141] Allow objects to decide if they can be collected by GC

2012-04-06 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Are __del__ and tp_del getting conflated in this conversation? I don't see a __del__ method on generator objects: filfre:$ python3.1 Python 3.1.2 (r312:79147, Dec 9 2011, 20:47:34) [GCC 4.4.3] on linux2 >>> (i for i in range(5)).__del__ T

[issue14534] Add method to mark unittest.TestCases as "do not run".

2012-04-09 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Wouldn't the subclass inherit the False value? Then the user would need to remember to override the value again in the subclass, which is error prone. Antoine: I've used the pattern you describe on a couple of occasions, and it routinely confus

[issue9141] Allow objects to decide if they can be collected by GC

2012-04-17 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Tue, Apr 17, 2012 at 4:08 AM, Antoine Pitrou wrote: > has_finalizer() in gcmodule.c doesn't check for weakref callbacks, so a > weakref callback can still be invoked from tp_dealloc. Unless I'm mistaken, weakrefs will be handle

[issue18606] Add statistics module to standard library

2013-08-04 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: As the person originally trying to take the mean of timedelta objects, I'm personally fine with the workaround of: py> m = statistics.mean([x.total_seconds() for x in data]) py> td(seconds=m) datetime.timedelta(2, 43200) At the time I was trying

[issue2226] Small _abcoll Bugs / Oddities

2013-01-16 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : -- assignee: stutzbach -> rhettinger ___ Python tracker <http://bugs.python.org/issue2226> ___ ___ Python-bugs-list mai

[issue19081] zipimport behaves badly when the zip file changes while the process is running

2013-09-24 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : -- nosy: +stutzbach ___ Python tracker <http://bugs.python.org/issue19081> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue3366] Add gamma function, error functions and other C99 math.h functions to math module

2009-09-21 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I'll test your patch on Windows. Are you working against the trunk or the py3k branch? -- ___ Python tracker <http://bugs.python.org/i

[issue3366] Add gamma function, error functions and other C99 math.h functions to math module

2009-09-21 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I'm only setup to test the official Windows build setup under PCbuild. I'm not testing the legacy build setups under PC/VC6, PC/VS7.1, or PC/VS8.0. The patch against the trunk failed for PC/VC6/pythoncore.dsp. I don't need that to build

[issue3366] Add gamma function, error functions and other C99 math.h functions to math module

2009-09-30 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I agree with your reasoning. Any chance of also getting the incomplete beta and gamma functions, needed to compute the CDF of many commonly used probability distributions? (Beta, Logarithmic, Poisson, Chi-Square, Gamma, etc

[issue7079] file_close() ignores return value of close_the_file

2009-10-07 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : I noticed that file_close() calls close_the_file(), then frees the buffer for the file object. However, close_the_file() may fail and return NULL if the file object is currently in use by another thread, in which case freeing the buffer from underneath the

[issue7079] file_close() ignores return value of close_the_file

2009-10-07 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : Added file: http://bugs.python.org/file15077/crash.py ___ Python tracker <http://bugs.python.org/issue7079> ___ ___ Python-bugs-list mailin

[issue7088] New (in 2.6) functions in signal module are not documented as unix-only

2009-10-08 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : 2.6 introduced several new functions to the signal module that are not available on Windows (setitimer, getitimer, and siginterrupt). However, they aren't documented with Availability: Unix. -- assignee: georg.brandl components: Document

[issue7104] test_descr uses __cmp__ which will never be called

2009-10-11 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : The following is from Lib/test/test_descr.py. It's trying to test if looking up a special method on an object leaks references. It tests it by using __cmp__. The test will always pass because Python 3 is trying to look up __eq__, not __cmp__.

[issue7111] core dump when stderr is moved

2009-10-13 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: After some searching around with Google, "2>&-" means "close file descriptor 2" (i.e., standard error). -- nosy: +stutzbach ___ Python tracker <ht

[issue7111] core dump when stderr is moved

2009-10-13 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Is it even possible to portably test the validity of a file descriptor without trying to write/read it? When I first saw this bug, my gut feeling was "well, don't do that then!" However, I then recalled that Windows GUI applications have n

[issue7126] Contradictory documentation for os.putenv and os.system

2009-10-14 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : The documentation for os.putenv states that "changes to the environment affect subprocesses started with os.system(), popen() or fork() and execv()" and "assignments to items in os.environ are automatically translated into corresponding

[issue7141] 2to3 should add from __future__ import print_statement

2009-10-15 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : I'm in the process of converting several Python scripts so that they work under both Python 2.6 and 3.1. For the most part, 2to3 does an amazing job. Great tool. One little feature request: could we make it add "from __future__ import print_sta

[issue6672] Add Mingw recognition to pyport.h to allow building extensions

2009-10-19 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : -- nosy: +stutzbach ___ Python tracker <http://bugs.python.org/issue6672> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue6672] Add Mingw recognition to pyport.h to allow building extensions

2009-10-19 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: svn.python.org seems to be up again. Could you create a patch? -- ___ Python tracker <http://bugs.python.org/issue6

[issue7170] subclasses of (some) built-in types are not weakref-able

2009-10-19 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : The documentation for weakref contains the following example: http://docs.python.org/3.1/library/weakref.html -- Several built-in types such as list and dict do not directly support weak references but can add

[issue7170] subclasses of (some) built-in types are not weakref-able

2009-10-19 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I parsed the documentation this way: "Several built-in types such as list and dict do not directly support weak references" (true) "but [all of those that do not directly support weak references] can add support through subclassing" I w

[issue7170] subclasses of (some) built-in types are not weakref-able

2009-10-20 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: That's fair. I suggest the following change: current text: "Several built-in types such as list and dict do not directly support weak references but can add support through subclassing:" new text: "Several built-in types such as

[issue7182] For non-debug builds, the cygwinccompiler.py should define NDEBUG

2009-10-21 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : Currently, msvccompiler.py defines NDEBUG for non-debug builds. Unix builds do as well, via python-config. However, cygwinccompiler.py does not. -- assignee: tarek components: Distutils messages: 94315 nosy: stutzbach, tarek severity: normal

[issue7182] For non-debug builds, the cygwinccompiler.py should define NDEBUG

2009-10-21 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Sorry, I should have said the mingw32 compiler, which is contained in cygwincompiler.py The mingw32 compiler is a free compiler compatible with MSVC. Since it's used with the Windows version of python, there is no configure script. I noticed this

[issue3366] Add gamma function, error functions and other C99 math.h functions to math module

2010-01-02 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Any time I've ever needed log2(x), log(x)/log(2) was sufficient. In Python, exp2(x) can be spelled 2.0**x. What would exp2(x) gain us? -- ___ Python tracker <http://bugs.python.org/i

[issue5229] Documentation for super() neglects to say what super() actually does

2009-02-25 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Thanks! These improvements are very helpful. The one missing notion is that "object-or-type" may be a proxy object, in which case super() returns a new proxy that additionally skips "type". Perhaps add the following sentence to

[issue5229] Documentation for super() neglects to say what super() actually does

2009-02-25 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Actually, it's essential to how super() works. Here's an example using single inheritance: class A(object): def foo(self): print 'A' class B(object): def foo(self): super(B, self).foo() print 'B' class C(objec

[issue5229] Documentation for super() neglects to say what super() actually does

2009-02-25 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: In the previous example, I meant to type class B(A) and class C(B) rather than having them all derive from object. That's what I get for not actually testing the code. ;-) ___ Python tracker <http://bugs.py

[issue5546] PyDict_SetItemString mentions PyString_FromString which does not exist

2009-03-23 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : The documentation for PyDict_SetItemString contains the text "The key object is created using PyString_FromString(key)". However, PyString_FromString has been removed in Python 3. Perhaps it should read PyUnicode_FromString? -

[issue5547] The Py_InitModule functions no longer exist, but remain in the docs

2009-03-23 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : Py_InitModule, Py_InitModule3, etc. are mentioned in the docs (including the extending tutorial!), but no longer exist. -- assignee: georg.brandl components: Documentation messages: 84044 nosy: georg.brandl, stutzbach severity: normal status: open

[issue5548] In the tutorial, PyMODINIT_FUNC is shown as having a return type of void rather than PyObject *

2009-03-23 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : PyMODINIT_FUNC functions should return the module object or NULL on error. Or at least that what it looks like the core modules are doing. ;-) -- assignee: georg.brandl components: Documentation messages: 84045 nosy: georg.brandl, stutzbach

[issue5549] PyModule_Create and PyModuleDef are undocumented

2009-03-23 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : -- assignee: georg.brandl components: Documentation nosy: georg.brandl, stutzbach severity: normal status: open title: PyModule_Create and PyModuleDef are undocumented versions: Python 3.0, Python 3.1 ___ Python tracker

[issue5549] PyModule_Create and PyModuleDef are undocumented

2009-03-23 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: That was quick! Thanks! :-) -- ___ Python tracker <http://bugs.python.org/issue5549> ___ ___ Python-bugs-list mailin

[issue5553] Py_LOCAL_INLINE(type) doesn't actually inline except using MSC

2009-03-24 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : Below is the relevant snippet from pyport.h. There are two reasons that Py_LOCAL_INLINE doesn't actually emit the "inline" keyword (unless compiling with MSC). First, "configure" does not have code to test the compiler

[issue3829] Tuple comparison masking exception

2009-03-29 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I don't think the compare is actually masking an exception. The set type defines a tp_richcompare routine that gets called when comparing them as members of a tuple, but the set type also defines a tp_compare routine that does nothing but raise an exce

[issue4295] closing stdout in a child process on cygwin means that process doesn't receive bytes from stdin anymore. I think.

2009-03-29 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I created a simple parent/child pair using subprocess under cygwin and Python 2.5 and for me closing stdout did not affect stdin. It would appear the problem is caused by something else? -- nosy: +stutzbach Added file: http://bugs.python.org

[issue4295] closing stdout in a child process on cygwin means that process doesn't receive bytes from stdin anymore. I think.

2009-03-29 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : Added file: http://bugs.python.org/file13464/child.py ___ Python tracker <http://bugs.python.org/issue4295> ___ ___ Python-bugs-list mailin

[issue2560] removal of stale code from myreadline.c

2009-03-29 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: This patch looks good to me and applies cleanly to the trunk. Here's a synopsis of the code (before the patch) in question: static int my_fgets(char *buf, int len, FILE *fp) { for(;;) { /* a bunch of code that does not contain bre

[issue5606] The makefile dependencies listing formatter.h are wrong

2009-03-30 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : The makefile lists Objects/stringlib/formatter.h as a dependency for Objects/unicodeobject.o, which doesn't include formatter.h. Python/formatter_unicode includes it, but doesn't list it as a dependency. I've attached a patch for Makefile

[issue4482] 10e667.__format__('+') should return 'inf'

2009-03-30 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Here's a patch to add tests for this and a few other problems with formatting inf/-inf/nan, as well as a patch that fixes the problems. -- keywords: +patch nosy: +stutzbach versions: +Python 2.7, Python 3.1 Added file: http://bugs.pytho

[issue4482] 10e667.__format__('+') should return 'inf'

2009-03-30 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : Added file: http://bugs.python.org/file13475/inf.patch ___ Python tracker <http://bugs.python.org/issue4482> ___ ___ Python-bugs-list mailin

[issue3326] py3k shouldn't use -fno-strict-aliasing anymore

2009-03-30 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I'm using gcc 3.4.4 (cygwin) and I get the sames warnings as Alexandre. I examined a random sampling of the code generating the warnings, all of which followed this pattern: some_function((some_type **) &var_of_some_other_type); Since the

[issue4385] Py_Object_HEAD_INIT in Py3k

2009-03-30 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : -- versions: +Python 3.1 ___ Python tracker <http://bugs.python.org/issue4385> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue2443] uninitialized access to va_list

2009-03-30 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Rolland, The va_list is initialized by the function that calls objargs_mktuple. va_start() and va_end() need to be called in the function that takes "..." as a parameter, and it is. Not a bug, but +1 on Alexander's patch to consolidate all t

[issue1324770] Adding redblack tree to collections module

2009-03-30 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I agree with Raymond. In general, the collections module should define containers that are named after their function rather than their implementation. That way the implementation can be changed at a later date (or in other Python implementations) without

[issue5615] linking fails when configured --without-threads

2009-03-30 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : A few spots are missing #ifdef WITH_THREAD I've included a patch for the relevant bits. -- components: Extension Modules, Interpreter Core files: without-threads.patch keywords: patch messages: 84673 nosy: stutzbach severity: normal status:

[issue808164] socket.close() doesn't play well with __del__

2009-03-31 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Daniel, _closedsocket is a global, so it isn't safe to be used within __del__ during shutdown. In the py3k branch, socket.__del__ calls socket._real_close which references the global _socket. So it's not safe their, either. -- nosy:

[issue1641] asyncore delayed calls feature

2009-04-01 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : -- nosy: +stutzbach ___ Python tracker <http://bugs.python.org/issue1641> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue4482] 10e667.__format__('+') should return 'inf'

2009-04-12 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: The patch I submitted adds a special-case for inf/-inf/NaN so that sprintf is avoided for those values. Should work on any platform, I believe. I'm not sure how it interacts with your 3.x plans. Seems like it would be a good patch for 2.7 at least, t

[issue5774] _winreg.OpenKey() is documented with keyword arguments, but doesn't take them

2009-04-16 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : I noticed this in 2.6, but I imagine it affects 2.7, and 3.x as well. The documentation for _winreg.OpenKey reads in part: _winreg.OpenKey(key, sub_key[, res=0][, sam=KEY_READ]) However: >>> import _winreg >>> _winreg.OpenKey(_winreg

[issue4482] 10e667.__format__('+') should return 'inf'

2009-04-17 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I used 'inf' instead of "+inf' because the original bug report states that the docs say it should be 'inf'. Now that I actually look at the docs, I don't agree with the original report's interp

[issue5921] PEP 362 can be marked as finished?

2009-05-04 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : It looks like PEP 362 has been implemented in the py3k branch: >>> def f(x: int): ... pass ... >>> -- components: None messages: 87125 nosy: stutzbach severity: normal status: open title: PEP 362 can be marked as finished? ve

[issue5921] PEP 362 can be marked as finished?

2009-05-04 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: You're right. I got them mixed up. Please disregard. I'm just having that kind of day. :-) -- ___ Python tracker <http://bugs.python.

[issue6357] tempfile.NamedTemporaryFile does not accept the delete= parameter on Windows

2009-06-28 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : Likely affects Python 2.7 and Python3.x as well, but I have not checked. Under Windows: >>> tempfile.NamedTemporaryFile('w', delete = False) TypeError: NamedTemporaryFile() got an unexpected keyword argument &

<    1   2   3   4   5   >