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

2009-06-29 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Yes, I'm sure.  See below. Also, the 2.6 docs mention it as being new in 2.6: http://docs.python.org/library/tempfile.html Cashew:~$ python2.6 Python 2.6.2 (r262:71600, Apr 15 2009, 07:20:39) [GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125

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

2009-06-29 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: C:\>c:\python26\python Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import tempfile >>

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

2009-06-29 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Oy vey. That's what I get for not reading carefully. And in my original example it seems I had a python 2.5 install wandering around in my path. My apologies. -- status: open -> closed ___ Python tracke

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

2010-05-14 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Attached is an updated patch. In addition to the code cleanup and bug fix suggestions, it includes a new base-case for factorial_partial_product. Instead of: if (n >= m) return n if (n + 2 == m) return n*m otherwise divide-and-conquer It now d

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

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

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

2010-05-14 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I made a few minor updates to the patch. It redefines partial_product to product(range(n, m, 2)), which saved me a few operations and is more Pythonic than what I had before. :-) (Not quite what Alexander was after, but it's a step in the right dire

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

2010-05-14 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Fri, May 14, 2010 at 3:25 PM, Mark Dickinson wrote: > The patch looks good.  Just one issue: I think the overflow check for > num_operands * last_bit is bogus.  It's possible for the product to overflow > and still end up being less tha

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

2010-05-14 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Looks good. -- ___ Python tracker <http://bugs.python.org/issue8692> ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2010-05-15 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: The comment for bit_length is missing a space or two: "Objects/longobject.c.Someday" -- ___ Python tracker <http://bugs.python.

[issue8729] The Mapping ABC's __eq__ method should return NotImplemented if the other type is not a Mapping

2010-05-15 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : The Mapping ABC's __eq__ method should return NotImplemented if the other type is not a Mapping, to give the other type a chance at the comparison. Right now it simply returns false. The comparison methods on the other ABCs in _abcoll.py already r

[issue8729] The Mapping ABC's __eq__ method should return NotImplemented if the other type is not a Mapping

2010-05-15 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Will do, sometime this week. -- ___ Python tracker <http://bugs.python.org/issue8729> ___ ___ Python-bugs-list mailin

[issue8736] *= is undocumented for lists

2010-05-16 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : -- assignee: stutzbach components: Documentation keywords: easy nosy: stutzbach priority: normal severity: normal stage: needs patch status: open title: *= is undocumented for lists versions: Python 2.7, Python 3.2

[issue8736] *= is undocumented for lists

2010-05-17 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Good point, since I see now that *= (and +=) also works on immutable sequence types (though does something subtly different). I always forget that. -- resolution: -> invalid stage: needs patch -> committed/rejected status: open -&g

[issue8743] set() operators don't work with collections.Set instances

2010-05-17 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : The set() operators (__or__, __and__, __sub__, __xor__, and their in-place counterparts) require that the parameter also be an instance of set(). They're documented that way: "This precludes error-prone constructions like set('abc')

[issue8743] set() operators don't work with collections.Set instances

2010-05-17 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I should add: I discovered the inconsistency while working on my sortedset class, which provides the same interface as set() but is also indexable like a list (e.g., S[0] always returns the minimum element, S[-1] returns the maximum element, etc

[issue2521] ABC caches should use weak refs

2010-05-17 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Antoine, do you have a suggestion for someone with with better knowledge of ABCs to do the final review, so that I may very politely pester them? ;-) -- ___ Python tracker <http://bugs.python.org/issue2

[issue7079] file_close() ignores return value of close_the_file

2010-05-17 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Is there anything more I can do to help get this crash-fix committed before 2.7 rc1? -- ___ Python tracker <http://bugs.python.org/issue7

[issue8750] Many of MutableSet's methods assume that the other parameter is not self

2010-05-18 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : For example, here is one of MutableSet's methods: def __isub__(self, it): for value in it: self.discard(value) return self However, if I do "x -= x", then it mutates my set-like object during iteration,

[issue8752] set_contains, etc. should check for collections.Set in addition to PySet_Check

2010-05-18 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : For operations that test membership in a set, Python coerces sets and subclasses of set into a temporary frozenset before testing membership. For example, this works: >>> set() in set([frozenset()]) True Although the set() is not hashable itsel

[issue8753] Py_ReprEnter and Py_ReprLeave are undocumented

2010-05-18 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : -- assignee: stutzbach components: Documentation nosy: stutzbach priority: normal severity: normal stage: needs patch status: open title: Py_ReprEnter and Py_ReprLeave are undocumented versions: Python 2.7, Python 3.2

[issue8757] Race condition when checking for set in set

2010-05-18 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : "some_set in some_set_of_sets" contains a race condition that can lead to odd behavior. To perform the test, the set_contains() function in setobject.c creates a temporary frozenset object (t), swaps the bodies of some_set and t, checks

[issue8729] The Mapping ABC's __eq__ method should return NotImplemented if the other type is not a Mapping

2010-05-18 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Here's a patch that adds test cases. It exercises all of the following special methods on Set and Mapping to ensure that they return NotImplemented if they don't recognize the other type. lt, gt, le, ge, eq, ne, or, and, xor, sub I made

[issue8768] The checkempty_symmetric_difference test is never called

2010-05-19 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : In test_set.py (and test_sets.py in 2.x), there's a method named "checkempty_symmetric_difference". It should be named "test_checkempty_symmetric_difference" so that it will actually be called as a test. It's not refer

[issue8729] The Mapping ABC's __eq__ method should return NotImplemented if the other type is not a Mapping

2010-05-19 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Done: http://codereview.appspot.com/1193044 This is my first time using Rietveld. Let me know if I've done anything wrong. -- ___ Python tracker <http://bugs.python.org/i

[issue1289118] timedelta multiply and divide by floating point

2010-05-20 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : -- nosy: -agthorr ___ Python tracker <http://bugs.python.org/issue1289118> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue8781] 32-bit wchar_t doesn't need to be unsigned to be usable (I think)

2010-05-21 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : If ./configure detects that the system's wchar_t type is compatible, it will define "#define PY_UNICODE_TYPE wchar_t" and enable certain optimizations when converting between Py_UNICODE and wchar_t (i.e., it can just do a memcpy). Right n

[issue8781] 32-bit wchar_t doesn't need to be unsigned to be usable (I think)

2010-05-21 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Usually you wouldn't want to cast a char directly to a Py_UNICODE, because you need to take into account the encoding of the char and map it to the appropriate Unicode character. The exception is when you're certain the char is 7-bit ASCII,

[issue8781] 32-bit wchar_t doesn't need to be unsigned to be usable (I think)

2010-05-21 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Yeah, this is a "I noticed this small optimization while working on something else" kind of thing. ;) ("something else" being Issue8654) I can make a patch to change the #if's to test Py_UNICODE_SIZE == SIZEOF_WCHAR_T, though I

[issue8750] Many of MutableSet's methods assume that the other parameter is not self

2010-05-21 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Patch with unit test attached for MutableSet's: x ^= x x -= x I was wrong about |= and &= having a problem. Since they don't mutate the set, they don't raise an exception (they only .add items that are already in the set). I added

[issue8729] The Mapping ABC's __eq__ method should return NotImplemented if the other type is not a Mapping

2010-05-21 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Here is a revised patch based on Benjamin's comments on Rietveld. -- Added file: http://bugs.python.org/file17433/mapping2.patch ___ Python tracker <http://bugs.python.org/i

[issue8783] The external link to a "Hash Collision FAQ" points to some company's homepage

2010-05-21 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : At the bottom of the documentation for hashlib, there's a link to http://www.cryptography.com/cnews/hash.html which the hashlib documentation describes as "Hash Collision FAQ with information on which algorithms have known issues and what

[issue1289118] timedelta multiply and divide by floating point

2010-05-24 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I don't have a strong feeling about the method of rounding. My thinking is: If my application is sensitive to how the last microsecond is rounded, then I shouldn't be using a type that only gives me 1-microsecond precision. (Likewise, if my appl

[issue8005] datetime's comparison methods do not return NotImplemented when they should

2010-05-25 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: None here. -- ___ Python tracker <http://bugs.python.org/issue8005> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue2810] _winreg.EnumValue sometimes raises WindowsError ("More data is available")

2010-05-26 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I wrote a short C program to test a few different variations. It looks to me like a bug in the operating system's implementation of HKEY_PERFORMANCE_DATA (which is a virtual registry key). If I pass NULL as the second parameter to a more conventiona

[issue8647] PyUnicode_GetMax is undocumented

2010-06-15 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Yes, though it may be a while before I find time to do so. -- ___ Python tracker <http://bugs.python.org/issue8647> ___ ___

[issue8646] PyUnicode_EncodeDecimal is undocumented

2010-06-15 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Yes, though it may be a while before I find time to do so. -- ___ Python tracker <http://bugs.python.org/issue8646> ___ ___

[issue8645] PyUnicode_AsEncodedObject is undocumented

2010-06-15 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I'm not really clear on what PyUnicode_AsEncodedObject does (as opposed to PyUnicode_AsEncodedString). Someone already familiar with those two functions would have a much easier time writing a documentation

[issue9131] test_set_reprs in test_pprint is fragile

2010-06-30 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : test_set_reprs in test_pprint creates a complex arrangement of frozensets and tests the pretty-printed repr against a string hard-coded in the test. The hard-coded repr depends on the sort order of frozensets. However, "Since sets only define pa

[issue9132] Documentation for comparing dictionaries is out of date

2010-06-30 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : reference/expressions.html#notin reads: "Mappings (dictionaries) compare equal if and only if their sorted (key, value) lists compare equal. [4] Outcomes other than equality are resolved consistently, but are not otherwise defined. [5]" Ho

[issue9132] Documentation for comparing dictionaries is out of date

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

[issue8939] Use C type names (PyUnicode etc;) in the C API docs

2010-07-01 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: +1 on using the full name, PyUnicodeObject The shorthand "PyUnicode" is too easy to confuse with Py_UNICODE (an actual type). -- nosy: +stutzbach ___ Python tracker <http://bugs.python.

[issue9137] x.update(red=5, blue=6, other=7) doesn't work, where x is a MutableMapping

2010-07-01 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : Simple example, using collections.OrderedDict: >>> import collections >>> x = collections.OrderedDict() >>> x.update(red=5, blue=6, other=7) Traceback (most recent call last): File "", line 1, in File "/usr/lo

[issue9166] minor misstatement in What's New in 2.7

2010-07-05 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : "Finally, the Mapping abstract base class now raises a NotImplemented exception..." should read "returns" instead of "raises" Here's the relevant code patch: http://svn.python.org/view/python/trunk/Lib/_abcoll

[issue9191] winreg.c:Reg2Py() may leak memory (in unusual circumstances)

2010-07-07 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : In Reg2Py() in winreg.c, in the REG_MULTI_SZ case, there's the following: wchar_t **str = (wchar_t **)malloc(sizeof(wchar_t *)*s); if (str == NULL) return PyErr_NoMemory(); However, not all of the r

[issue9194] winreg:fixupMultiSZ should check that P < Q in the inner loop

2010-07-07 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : The comment before fixupMultiSZ and countString states: ** Note that fixupMultiSZ and countString have both had changes ** made to support "incorrect strings". The registry specification ** calls for strings to be terminated with 2 null bytes.

[issue9212] dict_keys purports to implement the Set ABC, but is missing the isdisjoint method

2010-07-09 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : >>> isinstance({}.keys(), collections.Set) True >>> [method for method in set(dir(collections.Set)) - set(dir({}.keys())) ... if not method.startswith('_')] ['isdisjoint'] (in Python 2.7, use "viewkeys()&q

[issue9212] dict_keys purports to implement the Set ABC, but is missing the isdisjoint method

2010-07-09 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : -- type: -> behavior ___ Python tracker <http://bugs.python.org/issue9212> ___ ___ Python-bugs-list mailing list Unsubscri

[issue9213] range purports to implement the Sequence ABC, but is missing index and count methods

2010-07-09 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : >>> isinstance(range, collections.Sequence) True >>> [method for method in set(dir(collections.Sequence)) - set(dir(range(1))) >>> if not method.startswith('_')] ['index', 'count'] --

[issue9213] range purports to implement the Sequence ABC, but is missing index and count methods

2010-07-09 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: In Python 2.6 and 2.7, the same problem applies to xrange objects. -- versions: +Python 2.6, Python 2.7 ___ Python tracker <http://bugs.python.org/issue9

[issue9214] Most Set methods of KeysView and ItemsView do not work right

2010-07-09 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : Attached is a simple Python 3 example script that defines a minimalist MutableMapping that simply wraps a dict, followed by: x = MySimpleMapping(red=5) y = x.keys() z = x.keys() | {'orange'} x['b

[issue9214] Most Set methods of KeysView and ItemsView do not work right

2010-07-09 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Oops. Somehow deleted a linefeed in there. The example should read: x = MySimpleMapping(red=5) y = x.keys() z = x.keys() | {'orange'} x['blue'] = 7 print(l

[issue9214] Most Set methods of KeysView and ItemsView do not work right

2010-07-09 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I guess roundup is deleting my linefeed? I'm sure I didn't do it that time. I'm not sure what's going on there, but the "x['blue'] = 7" should be on a line by itself. -- _

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

2010-07-09 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I posted some of this earlier in the week, but for some reason the bug tracker marked my message as spam. Hopefully this message will survive. ;-) Can you compare and contrast your approach with calling PyObject_GC_UnTrack and PyObject_GC_Track to mark

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

2010-07-09 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : -- ___ Python tracker <http://bugs.python.org/issue9141> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/m

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

2010-07-09 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: 2010/7/9 Kristján Valur Jónsson > Your message was classified as spam, I have no idea why, but this is why I > only noticed it now. > Yes, I just noticed that tonight as well. I filed a bug on the meta-tracker in the hopes that someone can dig

[issue8040] It would be nice if documentation pages linked to other versions of the same document

2010-07-10 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Sat, Jul 10, 2010 at 1:56 AM, Terry J. Reedy wrote: > I think this effectively impossible for volunteers. Microsoft has 1000s of > paid employees. Chapter and Sections numbers do not match from version to > version. > We don't need to

[issue8040] It would be nice if documentation pages linked to other versions of the same document

2010-07-10 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Sat, Jul 10, 2010 at 2:12 AM, Ezio Melotti wrote: > I think I've already discussed this with Georg a while ago and we ended up > adding the links on the left sidebar in http://docs.python.org/. > IIRC there's no easy way to find t

[issue8040] It would be nice if documentation pages linked to other versions of the same document

2010-07-10 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : Removed file: http://bugs.python.org/file17926/unnamed ___ Python tracker <http://bugs.python.org/issue8040> ___ ___ Python-bugs-list mailin

[issue8040] It would be nice if documentation pages linked to other versions of the same document

2010-07-10 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : Removed file: http://bugs.python.org/file17927/unnamed ___ Python tracker <http://bugs.python.org/issue8040> ___ ___ Python-bugs-list mailin

[issue9212] dict_keys purports to implement the Set ABC, but is missing the isdisjoint method

2010-07-10 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: In this case, the concrete class is the one missing a method. Concrete classes are allowed to provide more features than the corresponding ABC, but the converse is not true to the best of my knowledge. dict_keys .register()s as supporting the Set ABC, so

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

2010-07-20 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : Removed file: http://bugs.python.org/file17925/unnamed ___ Python tracker <http://bugs.python.org/issue9141> ___ ___ Python-bugs-list mailin

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

2010-07-20 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Yes, I see your point. Even if more expensive than strictly necessary, the cost should be swamped by other existing costs. -- ___ Python tracker <http://bugs.python.org/issue9

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

2010-07-22 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: +1 on better names, -1 on removing the reserved parameter The parameters of OpenKey mirror those of the underlying RegOpenKey call. If we remove the reserved parameter, then: 1) Any code currently using the sam parameter will break, since it's curr

[issue8757] Automatic set-to-frozenset conversions not thread-safe

2010-08-04 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: The swap bodies technique has been used in list.sort for a long time, but users expect list.sort to mutate the list. Even with a pure-Python implementation of sets, I would not expect __contains__ to be a mutating method (unless I have gone out of way to

[issue8757] Automatic set-to-frozenset conversions not thread-safe

2010-08-06 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: It is easy in online communications to interpret a response as a disagreement. I apologize for falling into that trap. I am +1 on removing implicit set-to-frozenset conversions, which would more effectively "fix" issue8752 for me (this is the o

[issue2521] ABC caches should use weak refs

2010-08-09 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Jack, The change is necessary because "None in WeakSet()" would throw an exception. -- ___ Python tracker <http://bugs.python.

[issue8041] No documentation for Py_TPFLAGS_HAVE_STACKLESS_EXTENSION or Py_TPFLAGS_HAVE_VERSION_TAG.

2010-08-09 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I think if they are mentioned, they should be documented. Removing mention of them would be fine with me. Looking at this again, I think the description of Py_TPFLAGS_DEFAULT is no longer accurate. It reads: "This is a bitmask of all the bits

[issue23565] local_clear walks the list of threads without holding head_lock.

2015-03-02 Thread Daniel Stutzbach
New submission from Daniel Stutzbach: local_clear in _threadmodule.c walks the list of threads without holding head_mutex. Since the list of threads can change when holding only head_mutex and not on the GIL, the list can change while local_clear is executing, which may cause Bad Things to

[issue9859] Add tests to verify API match of modules with 2 implementations

2015-04-14 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: With regret, I have not had time to work on patches and am unlikely to have time in the near future. -- ___ Python tracker <http://bugs.python.org/issue9

<    1   2   3   4   5