[issue21233] Add *Calloc functions to CPython memory allocation API

2014-04-15 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue21233> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21233] Add *Calloc functions to CPython memory allocation API

2014-04-15 Thread Josh Rosenberg
Josh Rosenberg added the comment: General comment on patch: For the flag value that toggles zero-ing, perhaps use a different name, e.g. setzero, clearmem, initzero or somesuch instead of calloc? calloc already gets used to refer to both the C standard function and the function pointer

[issue21233] Add *Calloc functions to CPython memory allocation API

2014-04-15 Thread Josh Rosenberg
Josh Rosenberg added the comment: Additional comment on clarity: Might it make sense to make the calloc structure member take both the num and size arguments that the underlying calloc takes? That is, instead of: void* (*calloc) (void *ctx, size_t size); Declare it as: void* (*calloc) (void

[issue21233] Add *Calloc functions to CPython memory allocation API

2014-04-15 Thread Josh Rosenberg
Josh Rosenberg added the comment: Sorry for breaking it up, but the same comment on consistent prototypes mirroring the C standard lib calloc would apply to all the API functions as well, e.g. PyMem_RawCalloc, PyMem_Calloc, PyObject_Calloc and _PyObject_GC_Calloc, not just the structure

[issue16991] Add OrderedDict written in C

2014-04-15 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue16991> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21237] Update Python 2/3 porting HOWTO's suggestion for dealing with map()

2014-04-16 Thread Josh Rosenberg
Josh Rosenberg added the comment: I think the suggestion is intended for "how do I keep Python 2 semantics in Python 3?", not "how can I write my Python 2 code so it will run equivalently in Python 3?" It wouldn't be a bad idea to point out that you can adopt Py3 sema

[issue21233] Add *Calloc functions to CPython memory allocation API

2014-04-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: Julian: No. See the diff: http://bugs.python.org/review/21233/diff/11644/Objects/typeobject.c The original GC_Malloc was explicitly memset-ing after confirming that it received a non-NULL pointer from the underlying malloc call; that memset is removed in

[issue21233] Add *Calloc functions to CPython memory allocation API

2014-04-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: Well, to be more specific, PyType_GenericAlloc was originally calling one of two methods that didn't zero the memory (one of which was GC_Malloc), then memset-ing. Just realized you're talking about something else; not sure if you're correct

[issue21279] str.translate documentation incomplete

2014-04-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: For the record, I have intentionally used bytes.maketrans to make translation table for str.translate for precisely this reason; it's much faster to look up a ordinal in a bytes object than in a dictionary. Before the recent (partial) patch for str.tran

[issue21308] PEP 466: backport ssl changes

2014-04-18 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue21308> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21305] PEP 466: update os.urandom

2014-04-18 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue21305> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21314] Bizarre help

2014-04-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: I don't know about the other bits, but that trailing '/' is how Argument Clinic (which makes full featured inspection available to built-in functions) notes that the parameters are positional only, and cannot be passed by keyword. See PEP436.

[issue17552] socket.sendfile()

2014-04-21 Thread Josh Rosenberg
Josh Rosenberg added the comment: For TransmitFile support, the Windows function to turn an integer file descriptor into a WinAPI file HANDLE should be _get_osfhandle: http://msdn.microsoft.com/en-us/library/ks2530z6.aspx -- nosy: +josh.rosenberg

[issue21408] delegation of `!=` to the right-hand side argument is not always done

2014-05-01 Thread Josh Rosenberg
Josh Rosenberg added the comment: Why would an subclass of object that doesn't redefine either __eq__ or __ne__ have a different behavior for inequality than object itself? Bar never defined __eq__, so it shouldn't have an implicit __ne__ any more than object itself does... Sayin

[issue21419] Use calloc() instead of malloc() for int << int (lshift)

2014-05-02 Thread Josh Rosenberg
Josh Rosenberg added the comment: Looks like you forgot to actually use the use_calloc parameter you put in the long_alloc prototype. It accepts it, but it's never used or passed to another function. So right now, the only difference in behavior is that there is an extra layer of fun

[issue21419] Use calloc() instead of malloc() for int << int (lshift)

2014-05-02 Thread Josh Rosenberg
Josh Rosenberg added the comment: Given your benchmarks show improvements (you posted while I was typing my last comment), I'm guessing it's just the posted patch that's wrong, and your local changes actually use use_calloc? -- ___

[issue21419] Use calloc() instead of malloc() for int << int (lshift)

2014-05-02 Thread Josh Rosenberg
Josh Rosenberg added the comment: While you're doing this, might it make sense to add a special case to long_pow so it identifies cases where a (digit-sized) value with an absolute value equal to a power of 2 is being raised to a positive integer exponent, and convert said cases to equiv

[issue21419] Use calloc() instead of malloc() for int << int (lshift)

2014-05-02 Thread Josh Rosenberg
Josh Rosenberg added the comment: I swear, I need to refresh before I post a long comment. If this is slowing everything down a little just to make 1 << (2 ** 29) faster (and did you really mean 1 << (1 << 29) ? :-) ), th

[issue21419] Use calloc() instead of malloc() for int << int (lshift)

2014-05-02 Thread Josh Rosenberg
Josh Rosenberg added the comment: One possible way to salvage it: Have you considered declaring long_alloc as Py_LOCAL_INLINE, or, now that I've checked #5553, a macro for long_alloc, so it gets inlined, and doesn't add the check overhead to everything (since properly inlining with

[issue21419] Use calloc() instead of malloc() for int << int (lshift)

2014-05-02 Thread Josh Rosenberg
Josh Rosenberg added the comment: And now that I'm thinking about it, the probable cause of the slowdown is that, for any PyLongObject that's smaller than PAGESIZE (give or take), using Calloc means calloc is just calling memset to zero the PyLongObject header and the "used&qu

[issue21421] ABCs for MappingViews should declare __slots__ so subclasses aren't forced to have __dict__/__weakref__

2014-05-02 Thread Josh Rosenberg
New submission from Josh Rosenberg: Unlike the other collections ABCs, MappingView and its subclasses (Keys|Items|Values)View don't define __slots__, so users inheriting them to take advantage of the mix-in methods get a __dict__ and __weakref__, even if they try to avoid it by decl

[issue21421] ABCs for MappingViews should declare __slots__ so subclasses aren't forced to have __dict__/__weakref__

2014-05-02 Thread Josh Rosenberg
Josh Rosenberg added the comment: Hmm... First patch isn't generating a review diff (I'm guessing because my VM's time sync went farkakte). Trying again. -- Added file: http://bugs.python.org/file35142/slots_for_mappingview_abcs.patch ___

[issue21421] ABCs for MappingViews should declare __slots__ so subclasses aren't forced to have __dict__/__weakref__

2014-05-02 Thread Josh Rosenberg
Changes by Josh Rosenberg : Removed file: http://bugs.python.org/file35141/slots_for_mappingview_abcs.patch ___ Python tracker <http://bugs.python.org/issue21421> ___ ___

[issue21421] ABCs for MappingViews should declare __slots__ so subclasses aren't forced to have __dict__/__weakref__

2014-05-02 Thread Josh Rosenberg
Josh Rosenberg added the comment: I also wrote a slightly more thorough patch that simplifies some of the method implementations (largely just replacing a bunch of for/if/return True/False else return False/True with any/all calls against a generator expression). The one behavior difference

[issue21421] ABCs for MappingViews should declare __slots__ so subclasses aren't forced to have __dict__/__weakref__

2014-05-04 Thread Josh Rosenberg
Josh Rosenberg added the comment: Cool. Thanks for the feedback. I split it into two patches for a reason; I wasn't wedded to the simplification. -- ___ Python tracker <http://bugs.python.org/is

[issue21423] concurrent.futures.ThreadPoolExecutor should accept an initializer argument

2014-05-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: Do you mean ProcessPoolExecutor? Thread based pools don't involve serialization. It would be good for ThreadPoolExecutor to have it as well, to make it easier to switch between executors, but only ProcessPoolExecutor is suffering from serialization ove

[issue21449] Replace _PyUnicode_CompareWithId with _PyUnicode_CompareWithIdEqual

2014-05-06 Thread Josh Rosenberg
New submission from Josh Rosenberg: _PyUnicode_CompareWithId is used exclusively for equality comparisons (after all, identifiers aren't really sortable in a meaningful way; they're isolated values, not a continuum). But because _PyUnicode_CompareWithId maintains the general

[issue21423] concurrent.futures.ThreadPoolExecutor should accept an initializer argument

2014-05-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: I'm not a core developer, but writing the patch is usually considered helpful. Two notes: 1. Make sure to write unit tests for any new behavior 2. I'd suggest making any such argument keyword-only; if we move closer to the Java executor model,

[issue21484] More clarity needed about difference between "x += e" and "x = x + e"

2014-05-12 Thread Josh Rosenberg
Josh Rosenberg added the comment: It seems to me like that is one of the most obvious consequences. How is this not an immediately obvious consequence? -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue21

[issue21507] set and frozenset constructor should use operator.length_hint to guess the size of the iterator

2014-05-14 Thread Josh Rosenberg
Josh Rosenberg added the comment: I think the argument against using PyObject_LengthHint for the general iterable case is that for inputs other than sets or dicts, the assumption is that significant deduplication will occur. With your patch, if I run: myset = frozenset([0] * 100) it will

[issue21508] C API PyArg_ParseTuple doc is innacurate

2014-05-14 Thread Josh Rosenberg
Josh Rosenberg added the comment: You'd prefer it say it returns 1 on success and 0 on failure? Or non-zero on success, zero on failure? Is true/false that bad? After all, C says 0 is false, all other integer values are true; phrasing it as zero vs. non-zero may be slightly more techni

[issue21513] speed up some ipaddress properties

2014-05-15 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue21513> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21508] C API PyArg_ParseTuple doc is innacurate

2014-05-15 Thread Josh Rosenberg
Josh Rosenberg added the comment: Changing the docs isn't the main hurdle; the problem is that if we told people they could test == 1, rather than != 0, then new success return codes couldn't be added without a long period of warning. I don't think the convention is consi

[issue21507] set and frozenset constructor should use operator.length_hint to guess the size of the iterator

2014-05-15 Thread Josh Rosenberg
Josh Rosenberg added the comment: Not sure how much that really helps. If I understand you correctly, it would be a memory optimization that would require a round of rehashing to use? If you wanted to make a change that got "guaranteed" better performance, you might add support

[issue21515] Use Linux O_TMPFILE flag in tempfile.TemporaryFile?

2014-05-16 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue21515> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21527] concurrent.futures.ThreadPoolExecutor does not use a default value

2014-05-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: +1. Makes it easier to swap Executors (which is a big selling point for the Executor framework), and number of cores is a reasonable default value. -- nosy: +josh.rosenberg ___ Python tracker <h

[issue20260] Argument Clinic: add unsigned integers converters

2014-05-22 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue20260> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21637] Add a warning section exaplaining that tempfiles are opened in binary mode

2014-06-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: Adding warnings for something that is clearly documented (both in the constructor prototype line and again in the spelled out documentation of the "mode" argument) is wasteful, particularly when accidental misuse would immediately lead to an excep

[issue21559] OverflowError should not happen for integer operations

2014-06-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: It usually doesn't just mean "outside a required range", it means "outside the range of values representable due to implementation specific limitations (e.g. the function is converting to a C type)". You don't raise OverflowErr

[issue3931] codecs.charmap_build is untested and undocumented

2014-06-12 Thread Josh Rosenberg
Josh Rosenberg added the comment: I've found it rather ugly to even understand from the lack of code comments for the C level API it's wrapping. If nothing else, comments explaining the usage and purpose might be helpful. -- nosy: +josh

[issue21721] socket.sendfile() should use TransmitFile on Windows

2014-06-12 Thread Josh Rosenberg
Josh Rosenberg added the comment: Copying my comment from the previous issue: For TransmitFile support, the Windows function to turn an integer file descriptor into a WinAPI file HANDLE should be _get_osfhandle: http://msdn.microsoft.com/en-us/library/ks2530z6.aspx This was mentioned on the

[issue21744] itertools.islice() goes over all the pre-initial elements even if the iterable can seek

2014-06-13 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue21744> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21744] itertools.islice() goes over all the pre-initial elements even if the iterable can seek

2014-06-13 Thread Josh Rosenberg
Josh Rosenberg added the comment: I would think that allowing the special case optimization would be a good idea. As is, if you want to take slices of buffers without making copies, you can use memoryview and get O(1) views of a slice of the memory. But there's nothing built-in that&#

[issue17941] namedtuple should support fully qualified name for more portable pickling

2014-06-13 Thread Josh Rosenberg
Josh Rosenberg added the comment: I was already thinking of the same solution Christian.Tismer proposed before I reached his post. namedtuples seem cleaner if they naturally act as singletons, so (potentially whether or not pickling is involved) declaring a namedtuple with the same name and

[issue21744] itertools.islice() goes over all the pre-initial elements even if the iterable can seek

2014-06-13 Thread Josh Rosenberg
Josh Rosenberg added the comment: I will admit, on further consideration, a dedicated sequenceview might work more nicely. islice's interface is limited by its generality; since it doesn't assume a length, you can't use a negative value for end. Does anyone think a general seq

[issue5888] mmap ehancement - resize with sequence notation

2014-06-16 Thread Josh Rosenberg
Josh Rosenberg added the comment: I see a few issues with this: 1. Changing the default behavior is a compatibility issue. I've written code that depends on exceptions being raised if slice assignment sizes don't match. 2. The performance cost is high; changing from rewriting i

[issue21679] Prevent extraneous fstat during open()

2014-06-16 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue21679> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21794] stack frame contains name of wrapper method, not that of wrapped method

2014-06-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: I don't think you understand how wrapping works. At the time you're enumerating the stack, the wrapped function has not actually been called. Only the wrapper has been called. If the stack included "junk" when junk had not yet been execu

[issue20446] ipaddress: hash similarities for ipv4 and ipv6

2014-06-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: Correct me if I'm wrong, but wouldn't this only become a concern if: 1. You're storing both IPv4 and IPv6 addresses side-by-side 2. You're storing well over a billion IP addresses 3. Hash codes for the hex string of an IP address were pr

[issue21817] `concurrent.futures.ProcessPoolExecutor` swallows tracebacks

2014-06-20 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue21817> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue20446] ipaddress: hash similarities for ipv4 and ipv6

2014-06-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: @Tim: Sorry, forgot the internals there (I read all that a while ago, but it's not easy to keep all the details in mind). Apparently there are four reasons this isn't actually a problem. :-) I agree it's kind of silly that it's conve

[issue18032] Optimization for set/frozenset.issubset()

2014-06-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: Patch needs some work. See comments on patch. -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue18

[issue21830] ssl.wrap_socket fails on Windows 7 when specifying ca_certs

2014-06-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: Are you 100% sure your CA files is in the precise PEM format required by Python for CA certs, as described in https://docs.python.org/3/library/ssl.html#ssl-certificates ? The most likely cause of your failure and success would be if you were using some

[issue5888] mmap enhancement - resize with sequence notation

2014-06-23 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- title: mmap ehancement - resize with sequence notation -> mmap enhancement - resize with sequence notation ___ Python tracker <http://bugs.python.org/iss

[issue21864] Error in documentation of point 9.8 'Exceptions are classes too'

2014-06-24 Thread Josh Rosenberg
Josh Rosenberg added the comment: No. The first form, raise Class, is in fact a shorthand for raise Class(). That's the point. You only actually raise instances, but if you pass it a class directly, it instantiates it by calling its constructor with no arguments. The second form i

[issue21864] Error in documentation of point 9.8 'Exceptions are classes too'

2014-06-24 Thread Josh Rosenberg
Josh Rosenberg added the comment: I think the section could use some additional rewording actually. The wording about deriving from type dates back to the Python 2 days; nowadays, all exceptions are actually required to derive from BaseException. The section definitely needs rewording

[issue10978] Add optional argument to Semaphore.release for releasing multiple threads

2014-06-24 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue10978> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21872] LZMA library sometimes fails to decompress a file

2014-06-25 Thread Josh Rosenberg
Josh Rosenberg added the comment: Just to be clear, when you say "1 - 5 times per 1000 downloaded files", have you confirmed that redownloading the same file a second time produces the same error? Just making sure we've ruled out corruption during transfer over the network; sma

[issue10978] Add optional argument to Semaphore.release for releasing multiple threads

2014-06-25 Thread Josh Rosenberg
Josh Rosenberg added the comment: Never know whether to comment on issue itself, but just in case: There are issues with the patch when n < 0 is passed, as n is not sanity checked, which would break the Semaphore invariant (value must be >= 0). n == 0 is also a weird value, but harml

[issue21861] io class name are hardcoded in reprs

2014-06-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: Is it common for C implementations to introspect to figure out their "real" name? I do this manually for reprs of my user defined classes, but I haven't noticed many built-ins that consider extensibility for the repr. Maybe I'm just not us

[issue21906] Tools\Scripts\md5sum.py doesn't work in Python 3.x

2014-07-03 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue21906> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue20663] Introduce exception argument to iter

2014-07-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: +1; I've had several cases where I'd have used something like this (for the exact purpose mentioned, to destructively consume an input iterable). I don't think it's more or less useful than the sentinel version, which is convenient for

[issue21911] "IndexError: tuple index out of range" should include the requested index and tuple length

2014-07-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: TypeError also should be more specific because it can occur for a multitude of reasons; along with stuff like AttributeError, it's one of those exceptions that could arise from multiple causes on a single line of code, none of them obvious. For the spe

[issue21911] "IndexError: tuple index out of range" should include the requested index and tuple length

2014-07-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: As I said, the main reason is that every feature has to start at minus 100 points. It's not that your idea is bad, it's that it has to be sufficiently good to warrant the risks that come with any code churn, no matter how small. "Simple and ob

[issue18212] No way to check whether Future is finished?

2014-07-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: Have an idea for a name? It already has a done method, which happens to cover the case of a Future having completed successfully, completed due to an exception or having been cancelled. Simply calling it "finished()", "completed()"

[issue18212] No way to check whether Future is finished?

2014-07-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: Ugh. Left out a key word: "I see this as making it even easier to do threading *badly*, rather than a legitimate improvement." -- ___ Python tracker <http://bugs.python.o

[issue14189] Documentation for some C APIs is missing clear specification of the type of reference they return

2014-07-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: If any of these actually return borrowed references, I'd consider it a serious documentation bug to not mention it. New reference semantics are the default, and while it's best to call them out, it can be assumed in most cases. Returning borrowed

[issue21910] File protocol should document if writelines must handle generators sensibly

2014-07-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: +1. I've been assuming writelines handled arbitrary generators without an issue; guess I've gotten lucky and only used the ones that do. I've fed stuff populated by enormous (though not infinite) generators created from stuff like itertools.

[issue13946] readline completer could return an iterable

2014-07-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: I agree the design requiring it to pass the same information over and over is a bit odd (I've occasionally had cause to "borrow" some of ipython's niftyness for a plain Python terminal, and making custom completers work is one of the more

[issue21913] Possible deadlock in threading.Condition.wait() in Python 2.7.7

2014-07-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: So you want it to raise the same exception that is raised in Python 3.4? Either way, I don't think this is a deadlock (to get a deadlock, you'd have to have contested locks; this lock is being acquired only once). You're explicitly violati

[issue1425127] os.remove OSError: [Errno 13] Permission denied

2014-07-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: Similar reference regarding the same basic behavior: http://blogs.msdn.com/b/oldnewthing/archive/2012/09/07/10347136.aspx Short version: Indexing and anti-virus tools prevent deletion from occurring. Longer version: DeleteFile (and all the stuff that

[issue1425127] os.remove OSError: [Errno 13] Permission denied

2014-07-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: Please pretend I didn't leave off the actual os.remove call at the end of my second example that bypasses the issue. -- ___ Python tracker <http://bugs.python.org/issu

[issue21922] PyLong: use GMP

2014-07-05 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue21922> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21913] Possible deadlock in threading.Condition.wait() in Python 2.7.7

2014-07-05 Thread Josh Rosenberg
Josh Rosenberg added the comment: Antoine: It's possible this is a legitimate failure in the signal handling code. The lack of a RuntimeError seems more likely to be due to the code never executing, not an issue with Condition.wait/Condition.n

[issue21911] "IndexError: tuple index out of range" should include the requested index and tuple length

2014-07-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: Looking at a single lookup performed over and over isn't going to get you a very good benchmark. If your keys are constantly reused, most of the losses won't show themselves. A more fair comparison I've used before is the difference between

[issue21943] To duplicate a list has biyective properties, not inyective ones

2014-07-09 Thread Josh Rosenberg
Josh Rosenberg added the comment: This is a natural consequence of Python using reference semantics. x = y just makes x and y references to the same object. For immutable objects like int and str, you'll never notice consequences of this, since changes to the value (x += 1) replac

[issue21943] To duplicate a list has biyective properties, not inyective ones

2014-07-09 Thread Josh Rosenberg
Josh Rosenberg added the comment: Short answer: This is not a bug. Run through one of the comprehensive Python tutorials on the net (or in Learning Python); reference semantics and their fairly varied consequences are covered in detail in most of them

[issue21955] ceval.c: implement fast path for integers with a single digit

2014-07-11 Thread Josh Rosenberg
Josh Rosenberg added the comment: On: if (... a+b will not overflow ...) { Since you limited the optimization for addition to single digit numbers, at least for addition and subtraction, overflow is impossible. The signed twodigit you use for the result is guaranteed to be able to store far

[issue21984] list(itertools.repeat(1)) causes the system to hang

2014-07-14 Thread Josh Rosenberg
Josh Rosenberg added the comment: It's unlikely to have hung the system entirely. It will slow down a lot though, as it will consume ridiculous amounts of RAM, and occasionally involve copying the existing data due to reallocation. The cost of performing this pointless work may consume e

[issue20663] Introduce exception argument to iter

2014-07-15 Thread Josh Rosenberg
Josh Rosenberg added the comment: The main example that comes to mind was a variant of functools.lru_cache I wrote that expired cache entries after they reached a staleness threshold. The details elude me (this was a work project from a year ago), but it was basically what I was describing; a

[issue18395] Make _Py_char2wchar() and _Py_wchar2char() public

2014-07-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: How often do people need to convert to do platform independent locale encoding before Python is initialized? Encouraging use of platform dependent wchar_t's seems like a bad idea when PyUnicode abstracts away the difference ever since 3.3 rel

[issue17127] multiprocessing.dummy.Pool does not accept maxtasksperchild argument

2014-07-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: Note: To my knowledge there is little or no benefit to using maxtasksperchild when the implementation is using threads. Cleaning up worker processes intermittently will guarantee that memory, handles, etc., are returned to the OS. But memory and handles

[issue17127] multiprocessing.dummy.Pool does not accept maxtasksperchild argument

2014-07-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: Actually, now that I think about, most thread local stuff wouldn't be freed automatically either, since it's still allocated from a common pool of memory, and interleaved allocations would still prevent memory blocks from being returned to the OS.

[issue22089] collections.MutableSet does not provide update method

2014-07-28 Thread Josh Rosenberg
Josh Rosenberg added the comment: Minor correction to example. That should be: class MySet(Set): update = Set.__ior__ (no paren after __ior__, since we're assigning, not calling) -- nosy: +josh.rosenberg ___ Python tracker

[issue15986] memoryview: expose 'buf' attribute

2014-07-31 Thread Josh Rosenberg
New submission from Josh Rosenberg: To do what? -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue15986> ___ ___ Python-bugs-list mailin

[issue11271] concurrent.futures.ProcessPoolExecutor.map() doesn't batch function arguments by chunks

2014-08-01 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue11271> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue22181] os.urandom() should use Linux 3.17 getrandom() syscall

2014-08-17 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue22181> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue22274] subprocess.Popen(stderr=STDOUT) fails to redirect subprocess stderr to stdout

2014-08-25 Thread Josh Rosenberg
Josh Rosenberg added the comment: Okay, dumb question: Is there a reason the Windows code explicitly initializes c2pwrite in the "stdout not passed" case, while the Linux code leaves it as -1? Windows doesn't look like it would have the problem (because c2pwrite is always set t

[issue22361] Ability to join() threads in concurrent.futures.ThreadPoolExecutor

2014-09-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: Can you explain what benefit this would provide? Forcing the thread to exit gets you relatively little benefit. If it's an infrequently used executor, I suppose you avoid the cost of leaving worker threads blocked waiting for work, but that cost is tiny

[issue22373] PyArray_FromAny tries to deallocate double: 12 (d)

2014-09-09 Thread Josh Rosenberg
Josh Rosenberg added the comment: This sounds like a bug in Numpy. You should probably post it to their tracker: https://github.com/numpy/numpy/issues -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue22

[issue22427] TemporaryDirectory attempts to clean up twice

2014-09-17 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue22427> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue19380] Optimize parsing of regular expressions

2014-09-18 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue19380> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue22459] str.strip() documentation: wrong example

2014-09-22 Thread Josh Rosenberg
Josh Rosenberg added the comment: LGTM. About a straightforward as it gets. -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue22

[issue22515] Implement partial order on Counter

2014-09-29 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.rosenberg ___ Python tracker <http://bugs.python.org/issue22515> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue22533] Counter with no keys does not compare equal to Counter with keys which zero value

2014-10-01 Thread Josh Rosenberg
Josh Rosenberg added the comment: Reading the note on the Counter class (about intent vs. actual use), it looks like changing this behavior would involve potentially breaking a lot of code. If you're using Counters that are intended to maintain positive counts (treating a count <= 0 a

[issue7830] Flatten nested functools.partial

2014-10-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: If it affects the decision, I just had to debug some code at work that triggered a "excessive recursion" bug because they used functools.partial over and over on the same base function, thinking they could safely replace some keyword bindings ove

[issue7830] Flatten nested functools.partial

2014-10-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: The use case in question, simplified, was: from functools import partial class Foo: Bar = othermodule.Bar def __new__(cls, ...): ... cls.Bar(...) ... def bind_stuff(cls, *args, **kwargs): cls.Bar = partial(Bar

[issue22583] Segmentation fault with string concatenation

2014-10-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: It's not out of memory at all. It's (probably) a blown stack during compilation optimization. Modern Py3 has "fixed" this by simply preventing silly levels of literal concatenation like this causing indefinite call stack expansion; the old

[issue22583] Segmentation fault with string concatenation

2014-10-09 Thread Josh Rosenberg
Josh Rosenberg added the comment: You're supposed to use that code to create a file (the output file is just ""+""+""+""+""+""+""+""+""+...+""). If you want something that won'

[issue20858] Enhancements/fixes to pure-python datetime module

2014-03-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: _check_int_field seems needlessly complex. When you want a value that is logically an integer (not merely capable of being coerced to an integer), you want object.__index__, per PEP 357, or to avoid explicit calls to special methods, use operator.index. Any

<    1   2   3   4   5   6   7   8   >