[issue24358] Should compression file-like objects provide .fileno(), misleading subprocess?

2015-06-01 Thread Josh Rosenberg
Josh Rosenberg added the comment: Apparently similar issue occurs when tarfile assumes a GzipFile can have its fileno() fstat-ed (see #22468). An awful lot of libraries seem to assume that fileno() will provide useful information about the data you'd read from the file-like object itself

[issue24358] Should compression file-like objects provide .fileno(), misleading subprocess?

2015-06-02 Thread Josh Rosenberg
Josh Rosenberg added the comment: Blech, typo earlier "since they produce the *compressed* data (likely useless) when read as subprocess stdin". Context should make it obvious, but trying to be clear. -- ___ Python tracker <http://bu

[issue24379] operator.subscript

2015-06-22 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.r ___ Python tracker <http://bugs.python.org/issue24379> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue24503] csv.writer fails when within csv.reader

2015-06-24 Thread Josh Rosenberg
Josh Rosenberg added the comment: Obvious possibility: input.csv is empty, so the loop never executes. You could always add prints within the loop as well, so you know it actually read something. -- nosy: +josh.r ___ Python tracker <h

[issue19111] 2to3 should remove from future_builtins import *

2015-06-24 Thread Josh Rosenberg
Josh Rosenberg added the comment: Shouldn't it also disable the relevant fixers for map, filter, zip, etc. as appropriate? Otherwise a whole bunch of calls will be wrapper in list() or the like to mimic a behavior the code never had in Py2 in the first place. -- nosy: +j

[issue19111] 2to3 should remove from future_builtins import *

2015-06-25 Thread Josh Rosenberg
Josh Rosenberg added the comment: Ah, my mistake. Apologies. -- ___ Python tracker <http://bugs.python.org/issue19111> ___ ___ Python-bugs-list mailing list Unsub

[issue24660] Heapq + functools.partial : TypeError: unorderable types

2015-07-18 Thread Josh Rosenberg
Josh Rosenberg added the comment: Neither of those example should work (and neither do on my 3.4.0 installation). Heaps must have sortable components; you could only include callables (which are not sortable) in the tuples being sorted if you guarantee that some element(s) before the callable

[issue24700] array compare is hideously slow

2015-07-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: You're correct about what is going on; aside from bypassing a bounds check (when not compiled with asserts enabled), the function it uses to get each index is the same as that used to implement indexing at the Python layer. It looks up the getitem fun

[issue24379] operator.subscript

2015-08-16 Thread Josh Rosenberg
Josh Rosenberg added the comment: So this has sign off on Python ideas, and it's not fundamentally changing the language (it's implemented in pure Python after all), it's passed a dozen code reviews. Can someone with commit privileges just finish

[issue24305] The new import system makes it impossible to correctly issue a deprecation warning for a module

2015-08-21 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.r ___ Python tracker <http://bugs.python.org/issue24305> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue25155] datetime.datetime.now() raises

2015-09-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: It looks like between 3.4.3 and 3.5, datetime_best_possible changed from using _PyTime_gettimeofday with a _PyTime_timeval to using _PyTime_AsTimeval with struct timeval. The difference is that _PyTime_timeval appears to have been defined with a proper time_t

[issue25201] lock of multiprocessing.Value is not a keyword-only argument

2015-09-21 Thread Josh Rosenberg
Josh Rosenberg added the comment: Agreed. Having a named positional varargs argument makes subsequently defined arguments keyword only automatically. -- nosy: +josh.r ___ Python tracker <http://bugs.python.org/issue25

[issue25258] HtmlParser doesn't handle void element tags correctly

2015-09-28 Thread Josh Rosenberg
Josh Rosenberg added the comment: The example for Parsing an element with a few attributes and a title:" in https://docs.python.org/2/library/htmlparser.html#examples demonstrates this as expected behavior, so I'm not sure it can be changed: >>> parser.feed(&#x

[issue25337] weakref.finalize documentation refers to old interpreter shutdown behavior

2015-10-07 Thread Josh Rosenberg
New submission from Josh Rosenberg: In weakref.finalize's documentation ( https://docs.python.org/3/library/weakref.html#weakref.finalize ), it says: "A finalizer will never invoke its callback during the later part of the interpreter shutdown when module globals are liable to

[issue21165] Optimize str.translate() for replacement with substrings and non-ASCII strings

2015-10-14 Thread Josh Rosenberg
Josh Rosenberg added the comment: I actually have a patch (still requires a little cleanup) that makes translations for non-ASCII and 1-n translations substantially faster. I've been delaying posting it largely because it makes significant changes to str.maketrans so it returns a sp

[issue25419] Readline completion of module names in import statements

2015-10-16 Thread Josh Rosenberg
Josh Rosenberg added the comment: Is there a reason ipython's import completer couldn't be borrowed in its entirety? At work, I use a lightly adapted version of the code from ipython to do completion when I'm using the plain interactive interpreter (for whatever reason), an

[issue25429] Can segfault Python with itertools.chain.from_iterable

2015-10-16 Thread Josh Rosenberg
Josh Rosenberg added the comment: Also crashes in 3.5.0 (on Windows 7, with 64 bit build). -- nosy: +josh.r ___ Python tracker <http://bugs.python.org/issue25

[issue25177] OverflowError in statistics.mean when summing large floats

2015-10-19 Thread Josh Rosenberg
Josh Rosenberg added the comment: Do you have any benchmarks on the before and after? I strongly suspect that moving from float to Fraction-based ratios is going to kill performance in the common case, particularly for longer input sequences, but that's a hunch only. -- nosy: +j

[issue12029] Catching virtual subclasses in except clauses

2015-10-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: Does this introduce a slowdown when the type doesn't match? That is, clearly George's example: try: {}["a"] except KeyError: pass won't be slowed because the fast path will get an immediate hit. But wha

[issue25448] Exception ABC doesn't work in Python 3 (but does in Python 2.7)

2015-10-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: This looks like a duplicate of #12029. The delays on addressing that bug seem to indicate that initially there was a fairly substantial performance cost for all exception handling paths when ABC friendly checking was performed, but that was at least partially

[issue12029] Catching virtual subclasses in except clauses

2015-10-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: On rereading #22540, maybe that won't be an issue (in the common case where no custom metaclasses are used for the exceptions to be caught, it looks like maybe there is no slow path to traverse?). Still worth double che

[issue25438] document what codec PyMemberDef T_STRING decodes the char * as

2015-10-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: Checking the source ( https://hg.python.org/cpython/file/tip/Python/structmember.c#l51 ), it calls PyUnicodeFromString ( https://docs.python.org/3/c-api/unicode.html?highlight=pyunicode_fromstring#c.PyUnicode_FromString ), so it's always interpreted as

[issue23735] Readline not adjusting width after resize with 6.3

2015-10-22 Thread Josh Rosenberg
Josh Rosenberg added the comment: Patch doesn't let me comment, but I believe to be strictly standards conformant, sigwinch_received should be declared as a `volatile sig_atomic_t`, not `char`. See: https://www.securecoding.cert.org/confluence/display/c/SIG31-C.+Do+not+access+shared+ob

[issue25457] json dump fails for mixed-type keys when sort_keys is specified

2015-10-22 Thread Josh Rosenberg
Josh Rosenberg added the comment: The Python 2 sort order is a result of the "arbitrary but consistent fallback comparison" (omitting details, it's comparing the names of the types), thus the "strange" sort order. Python 3 (justifiably) said that incomparable type

[issue25457] json dump fails for mixed-type keys when sort_keys is specified

2015-10-22 Thread Josh Rosenberg
Josh Rosenberg added the comment: As a workaround (should you absolutely need to sort keys by some arbitrary criteria), you can initialize a collections.OrderedDict from the sorted items of your original dict (using whatever key function you like), then dump without using sort_keys=True. For

[issue25457] json dump fails for mixed-type keys when sort_keys is specified

2015-10-22 Thread Josh Rosenberg
Josh Rosenberg added the comment: Oops, minor flaw with that. It's str-ifying the tuples, not the keys, which could (in some cases) cause issues with keys whose reprs have different quoting. So you'd end up with lambdas. Boo. Anyway, corrected version (which would probably not be on

[issue23735] Readline not adjusting width after resize with 6.3

2015-10-22 Thread Josh Rosenberg
Josh Rosenberg added the comment: Okay, sorry for repeated nitpicks, but I think you can keep the visibility of sigwinch_received as static like it was as char (to avoid having it be exported for potential use by other modules, though it won't gain any optimization benefits of static,

[issue25478] Consider adding a normalize() method to collections.Counter()

2015-10-26 Thread Josh Rosenberg
Josh Rosenberg added the comment: Counter is documented as being primarily intended for integer counts. While you can use them with floats, I'm not sure they're the right data type for this use case. Having some methods that only make sense with floats, and others (like elements)

[issue25454] operator.methodcaller should accept additional arguments during the call

2015-10-27 Thread Josh Rosenberg
Josh Rosenberg added the comment: I could see the argument for this to make methodcaller more like an unbound version of functools.partial. Partial lets you prebind some things and not others, you might want to do the same thing with methods, where you prebind the method name and some

[issue25156] shutil.copyfile should internally use os.sendfile when possible

2015-10-28 Thread Josh Rosenberg
Josh Rosenberg added the comment: Adding interested parties from earlier ticket. -- nosy: +josh.r, martin.panter, r.david.murray ___ Python tracker <http://bugs.python.org/issue25

[issue24379] operator.subscript

2015-11-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: Martin: I think the primary reason I suggested an empty __slots__ was to avoid people doing dumb stuff like attaching attributes to the singleton, and then getting annoyed if support for them was removed in some future release (e.g. if this ever moved to C

[issue25832] Document weird behavior of `finally` when it has `break` in it

2015-12-10 Thread Josh Rosenberg
Josh Rosenberg added the comment: You used explicit control flow keywords and you're surprised that it listened? Regardless, this is already documented https://docs.python.org/3/reference/compound_stmts.html#finally : "If the finally clause executes a return or break statement,

[issue25898] Check for subsequence inside a sequence

2015-12-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: A utility like this seems like it would belong in `itertools`, not `collections`. It should also ideally avoid fully realizing the sequence so it could work with iterators/generators as well; PySequence_Fast will force creation of a `list`/`tuple` of the

[issue25898] Check for subsequence inside a sequence

2015-12-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: Aho Corasick doesn't seem likely to be useful here; it's good if the haystack is huge (or you have many haystacks to search) and you have many needles to look for (and the needles never change), but it pays a fairly steep setup cost; for a ut

[issue23677] Mention dict and set comps in library reference

2016-01-04 Thread Josh Rosenberg
Josh Rosenberg added the comment: Heck, with the addition of additional unpacking generalizations in 3.5, you can make an empty set even without a comprehension: {*()} Not really recommending the "one-eyed monkey operator", but the addition of unpacking generalizations undoes seve

[issue26011] Document necesities for cmp argument of sorted

2016-01-04 Thread Josh Rosenberg
Josh Rosenberg added the comment: The docstring doesn't give details, but many docstrings don't. The docs themselves do; not sure it's a good idea to expand every docstring into complete documentation; if you don't know the function you read the real docs, the docstr

[issue26012] pathlib.Path().rglob() is fooled by symlink loops

2016-01-04 Thread Josh Rosenberg
Josh Rosenberg added the comment: So would the goal of a fix be something like dev/inode memoization to prevent traversing the same link twice? To provide an argument to prevent following symlinks at all (as in stuff like os.walk), possibly defaulting to followlinks=False? It looks like

[issue26082] functools.lru_cache user specified cachedict support

2016-01-11 Thread Josh Rosenberg
Josh Rosenberg added the comment: Given that lru_cache uses the cache dict in very specific ways, supporting arbitrary mapping types would be extremely hard. Among other things: 1. The C code uses the concrete dict APIs (including private APIs) that would not work on arbitrary mappings that

[issue26104] Reference leak in functools.partial constructor in failure case

2016-01-13 Thread Josh Rosenberg
New submission from Josh Rosenberg: Minor bug introduced while implementing the fix for #7830: In the case where functools.partial is wrapping another functools.partial instance, both of them providing positional arguments, the value nargs is not freed when the tuple concatenation fails and

[issue26166] zlib compressor/decompressor objects should support copy protocol

2016-01-20 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- type: -> enhancement ___ Python tracker <http://bugs.python.org/issue26166> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue26166] zlib compressor/decompressor objects should support copy protocol

2016-01-20 Thread Josh Rosenberg
New submission from Josh Rosenberg: zlib.compressobj and zlib.decompressobj objects (actually zlib.Compress and zlib.Decompress, the other names are the function constructors I guess?) have a .copy() method, but don't implement `__copy__` or `__deepcopy__`. This leads to the mildly

[issue26167] Improve copy.copy speed for built-in types

2016-01-20 Thread Josh Rosenberg
New submission from Josh Rosenberg: copy.copy uses a relatively high overhead approach to copying list, set and dict, using: def _copy_with_constructor(x): return type(x)(x) This is despite the fact that all three types implement a .copy() method, and there is already a defined

[issue26166] zlib compressor/decompressor objects should support copy protocol

2016-01-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: Oops. Sorry. I swear I searched, but I can't figure out how I missed the obvious duplicate there. -- ___ Python tracker <http://bugs.python.org/is

[issue25007] Add support of copy protocol to zlib compressors and decompressors

2016-01-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: Patch looks good, but incomplete. Supporting __deepcopy__ (as a simple wrapper around __copy__ that ignores the second argument) would provide complete support. Also, should there be tests? I mean, I assume the .copy() method itself is tested, but just to

[issue26167] Improve copy.copy speed for built-in types (list/set/dict)

2016-01-20 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- title: Improve copy.copy speed for built-in types -> Improve copy.copy speed for built-in types (list/set/dict) ___ Python tracker <http://bugs.python.org/issu

[issue26168] Py_BuildValue may leak 'N' arguments on PyTuple_New failure

2016-01-20 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.r ___ Python tracker <http://bugs.python.org/issue26168> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue26167] Improve copy.copy speed for built-in types (list/set/dict)

2016-01-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: Good point. Though I don't see any attached patches... -- ___ Python tracker <http://bugs.python.org/issue26167> ___ ___

[issue26194] Undefined behavior for deque.insert() when len(d) == maxlen

2016-01-27 Thread Josh Rosenberg
Josh Rosenberg added the comment: I agree with Tim that arbitrarily deciding that insert should behave more like appendleft is surprising. This really feels like guessing at what the user wants, silently doing something that really isn't predictable. Any of the following seem nicer

[issue17394] Add slicing support to collections.deque

2016-01-27 Thread Josh Rosenberg
Josh Rosenberg added the comment: It seems odd to have a slice of a deque return a list. Are there any other examples of non-buffer protocol objects behaving like this in the standard library/built-ins? Only examples I can come up with are mmap objects and ctypes arrays (which are making raw

[issue26233] select.epoll.poll() should away calling malloc() each time

2016-01-28 Thread Josh Rosenberg
Josh Rosenberg added the comment: Overallocating by 50% might be overkill here; I wouldn't imagine most users of epoll.poll would use anything but: 1. Limit to 1 event 2. Limit to some constant K events 3. Use default maxevents (FD_SETSIZE - 1) Even if called in pathological order, that

[issue1475692] replacing obj.__dict__ with a subclass of dict

2016-01-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: Just FYI, if you're only trying to make immutable objects, that's what subclassing tuple with properties and __slots__ = () is for (collections.namedtuple does exactly this, building the Python declaration as a string and then eval-ing it to produ

[issue26314] interned strings are stored in a dict, a set would use less memory

2016-02-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: Presumably it would involve using private set APIs to make this work, right? Since normally you can't look up the actual value in a set, just check for existence? -- nosy: +josh.r ___ Python tracker

[issue25994] File descriptor leaks in os.scandir()

2016-02-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: Adding a ResourceWarning even if the generator is run to completion? That seems... dev hostile. I mean, yes, probably best to document it as best practice to use with with statement, but something simple like `files = sorted(os.scandir('.'), ke

[issue26478] dict views don't implement subtraction correctly

2016-03-03 Thread Josh Rosenberg
New submission from Josh Rosenberg: Don't know when the problem was introduced, but dictviews_sub is doing: tmp = _PyObject_CallMethodId(result, &PyId_difference_update, "O", other); to implement subtraction (after creating result as a set of the keys in question). T

[issue26478] dict views don't implement subtraction correctly

2016-03-03 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- components: +Interpreter Core ___ Python tracker <http://bugs.python.org/issue26478> ___ ___ Python-bugs-list mailing list Unsub

[issue26514] Object defines '__ne__' as 'not __eq__' if '__ne__' is not implemented

2016-03-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: It's not exactly what was asked for, but it's actually better (in that the __ne__ default implementation handles NotImplemented correctly). Per the docs at https://docs.python.org/3/reference/datamodel.html#object.__eq__ : "By default, __ne__

[issue26608] RLock undocumented behavior in case of multiple acquire

2016-03-22 Thread Josh Rosenberg
Josh Rosenberg added the comment: Per the docs ( https://docs.python.org/3/library/threading.html#rlock-objects ): "To unlock the lock, a thread calls its release() method. acquire()/release() call pairs may be nested; only the final release() (the release() of the outermost pair) reset

[issue26633] multiprocessing behavior combining daemon with non-daemon children inconsistent with threading

2016-03-23 Thread Josh Rosenberg
New submission from Josh Rosenberg: Unclear if this is just unclear docs, or incorrect behavior. Per this Stack Overflow question ( https://stackoverflow.com/questions/36191447/why-doesnt-the-daemon-program-exit-without-join ), you get some rather odd behavior when you have both daemon and

[issue26633] multiprocessing behavior combining daemon with non-daemon children inconsistent with threading

2016-03-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: Oops, left the info log in my replacement code for the non-daemon case outside the if not daemon: block; it should be inside (since it's not joining the daemon threads). -- ___ Python tracker

[issue26647] ceval: use Wordcode, 16-bit bytecode

2016-03-30 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.r ___ Python tracker <http://bugs.python.org/issue26647> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue26695] pickle and _pickle accelerator have different behavior when unpickling an object with falsy __getstate__ return

2016-04-05 Thread Josh Rosenberg
New submission from Josh Rosenberg: According to a note on the pickle docs ( https://docs.python.org/3/library/pickle.html#object.__getstate__ ): "If __getstate__() returns a false value, the __setstate__() method will not be called upon unpickling." The phrasing is a little

[issue26703] Socket state corrupts when original socket object goes out of scope in a different thread

2016-04-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: You used the `fileno` based initialization in the child, which creates a wrapper around the same file descriptor without duplicating it, so when the first socket disappears, that file descriptor becomes invalid. I think this is a doc bug more than a behavior

[issue26703] Socket state corrupts when original socket object goes out of scope in a different thread

2016-04-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: For source reference, the behavior for this case is to just copy out the file descriptor and stick it in a new socket object ( https://hg.python.org/cpython/file/3.5/Modules/socketmodule.c#l4289 ); no work is being done to somehow collaboratively manage the

[issue26737] csv.DictReader throws generic error when fieldnames is accessed for non-text file

2016-04-11 Thread Josh Rosenberg
Josh Rosenberg added the comment: This already behaves usefully in 3.5 where reading fieldnames from a DictReader wrapping a file opened in binary mode gets you: _csv.Error: iterator should return strings, not bytes (did you open the file in text mode?) And 2.7 is highly unlikely to make fit

[issue26745] Redundant code in _PyObject_GenericSetAttrWithDict

2016-04-13 Thread Josh Rosenberg
Josh Rosenberg added the comment: LGTM. Had to check the definition of PyDescr_IsData to determine that checking the value from tp_descr_set for NULL was exactly what that macro does, but yeah, it looks like the first test was redundant, and f is never assigned outside that block, so the

[issue26758] Unnecessary format string handling for no argument slot wrappers in typeobject.c

2016-04-14 Thread Josh Rosenberg
New submission from Josh Rosenberg: Right now, in typeobject.c, the call_method and call_maybe utility functions have a fast path for no argument methods, where a NULL or "" format string just calls PyTuple_New(0) directly instead of wasting time parsing Py_VaBuildValue. Problem i

[issue26802] Avoid copy in call_function_var when no extra stack args are passed

2016-04-19 Thread Josh Rosenberg
Josh Rosenberg added the comment: BTW, for a realistic use case that would be sped up by this patch (possibly a lot), consider a recursive function that is continually doing a "virtual" pop of the first argument, and receiving the rest as varargs, which are then unpacked for the

[issue26820] Prevent uses of format string based PyObject_Call* that do not produce tuple required by docs

2016-04-21 Thread Josh Rosenberg
New submission from Josh Rosenberg: PyObject_CallMethod explicitly documents that "The C arguments are described by a Py_BuildValue() format string that should produce a tuple." While PyObject_CallFunction doesn't document this requirement, it has the same behavior, and the sa

[issue26820] Prevent uses of format string based PyObject_Call* that do not produce tuple required by docs

2016-04-21 Thread Josh Rosenberg
Josh Rosenberg added the comment: The motivation for this change was Mr. STINNER's comment on #26814 ( https://bugs.python.org/issue26814#msg263923 ), where he mentioned the weirdness of PyObject_CallFunction and friends, which complicates the implementation of PyObject_FastCall and al

[issue26822] itemgetter/attrgetter/methodcaller objects ignore keyword arguments

2016-04-21 Thread Josh Rosenberg
Josh Rosenberg added the comment: Seems sensible for itemgetter and attrgetter, where all but the first argument is nonsensical anyway. It really seems like methodcaller should allow additional arguments (positional and keyword though), a la functools.partial (the difference being the support

[issue26847] filter docs unclear wording

2016-04-25 Thread Josh Rosenberg
Josh Rosenberg added the comment: "are equal to False" would be wrong though. Any "falsy" value is preserved by filterfalse, and removed by filter. They need not be equal to False (the bool singleton); empty containers (e.g. (), [], {}, "") are all conside

[issue26847] filter docs unclear wording

2016-04-25 Thread Josh Rosenberg
Josh Rosenberg added the comment: That's why lower case "false" is used, not "False"; the former is the loose definition, the latter is the strict singleton. -- ___ Python tracker <http:

[issue26905] from multiprocessing.pool import Pool bug on linux

2016-05-02 Thread Josh Rosenberg
Josh Rosenberg added the comment: The Queue module (queue on Py3) is for communication between threads, not processes; what you've written wouldn't behave correctly on any version of Python. You want to use multiprocessing's Queue class, not Queue.Queue, and to avoid possible

[issue26915] Test identity first in membership operation of ItemsView, ValuesView and Sequence in collections.abc

2016-05-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: At some point someone really needs to decide if the C layer behavior of performing an identity test before full equality checking is something that should be emulated at the Python layer or not. The current state seems ridiculous, where C containers check

[issue26219] implement per-opcode cache in ceval

2016-05-03 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.r ___ Python tracker <http://bugs.python.org/issue26219> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue26110] Speedup method calls 1.2x

2016-05-03 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.r ___ Python tracker <http://bugs.python.org/issue26110> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue27000] improve document of filter

2016-05-11 Thread Josh Rosenberg
Josh Rosenberg added the comment: Franklin said it better: The only difference between documentation and behavior is invisible implementation details, which have no business being documented in any event (since they needlessly tie the hands of maintainers of CPython and other Python

[issue27000] improve document of filter

2016-05-11 Thread Josh Rosenberg
Josh Rosenberg added the comment: bool is not enough of a special case to call it out without confusing the issue. No, the bool constructor is not actually called. But it will still behave as if it was called for all intents and purpose, it just skips the reference counting shenanigans for

[issue26369] unicode.decode and str.encode are unnecessarily confusing for non-ascii

2016-05-19 Thread Josh Rosenberg
Josh Rosenberg added the comment: Agree with Steven; the whole reason Python 3 changed from unicode and str to str and bytes was because having Py2 str be text sometimes, and binary data at other times is confusing. The existing behavior can't change in Py2 in any meaningful way wi

[issue20703] RuntimeError caused by lazy imports in pdb

2015-02-25 Thread Josh Rosenberg
Josh Rosenberg added the comment: Is this worth fixing? Delve into the innards and you get weird behaviors. If you really need to iterate sys.modules (the example clearly doesn't, but that doesn't mean no one would), you could just copy the parts you need beforehand to get a consi

[issue23610] -m arg behavior

2015-03-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: This is intentional and documented behavior: https://docs.python.org/3/library/__main__.html -- nosy: +josh.r ___ Python tracker <http://bugs.python.org/issue23

[issue23712] Experiment: Assume that exact unicode hashes are perfect discriminators

2015-03-19 Thread Josh Rosenberg
Josh Rosenberg added the comment: Assuming Siphash is in fact cryptographically secure (in the sense you can't choose a desired result hash with better odds that brute force), and it appears to be so, with a keyspace of 64 bits, if it's evenly distributed (which a cryptographica

[issue23744] Speed-up deque.__bool__

2015-03-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: Is it worth the definition of tp_as_number and maintaining another method for a micro-optimization? Presumably every collection in Python would benefit slightly from this (say, defaultdict in the same file, list, tuple, etc.), but none of them bother. Why

[issue23744] Speed-up deque.__bool__

2015-03-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: On further checking, this probably gives slightly greater benefit to deque than it would for list, tuple, dict, etc., only because PyObject_IsTrue checks for mapping before sequence; deque is a pure sequence, no mapping, so it has to fail an extra test before

[issue23793] Support __add__, __mul__, and __imul__ for deques.

2015-03-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: The behavior for multiplying or adding doesn't seem quite so intuitive when you allow for a bounded deque. In particular, it doesn't seem obvious that multiplying when the deque is bounded, you'll get results like: >>> list(deque

[issue23793] Support __add__, __mul__, and __imul__ for deques.

2015-03-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: I think my first addition example is wrong (should produce [2, 1, 2]), but you get the idea. -- ___ Python tracker <http://bugs.python.org/issue23

[issue23793] Support __add__, __mul__, and __imul__ for deques.

2015-03-31 Thread Josh Rosenberg
Josh Rosenberg added the comment: I agree that popping old inputs is the normal way. What I'm trying to say is that it doesn't feel like "old" or "inputs" when you multiply. In that case (and maybe this is just me), it feels like a "reasonable" outcom

[issue23979] Multiprocessing Pool.map pickles arguments passed to workers

2015-04-16 Thread Josh Rosenberg
Josh Rosenberg added the comment: The nature of a Pool precludes assumptions about the availability of specific objects in a forked worker process (particularly now that there are alternate methods of forking processes). Since the workers are spun up when the pool is created, objects created

[issue23971] dict(list) and dict.fromkeys() doesn't account for 2/3 fill ratio

2015-04-16 Thread Josh Rosenberg
Josh Rosenberg added the comment: You shouldn't presize when the input is a potentially non-unique iterable. It makes sense to presize for inputs of type dict or set, but for a list, the assumption is that many duplicates will be present, since deduping is a common use case for dicts (le

[issue23979] Multiprocessing Pool.map pickles arguments passed to workers

2015-04-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: The Pool workers are created eagerly, not lazily. That is, the fork occurs before map is called, and Python can't know that the objects passed as arguments were inherited in the first place (since they could be created after the Pool was created). I

[issue28024] fileinput causes RecursionErrors when dealing with large numbers of empty files

2016-09-08 Thread Josh Rosenberg
New submission from Josh Rosenberg: Accidentally discovered this while running code that processes a whole bunch of files, when it turned out the files were empty. The readline method of fileinput.input will make a recursive call to continue processing when it reaches the end of a file. This

[issue28024] fileinput causes RecursionErrors when dealing with large numbers of empty files

2016-09-12 Thread Josh Rosenberg
Josh Rosenberg added the comment: Ah. System I was working on when I checked this didn't have latest micro release. Guess I can recheck when it gets updated. -- ___ Python tracker <http://bugs.python.org/is

[issue28145] Fix whitespace in C source code

2016-09-14 Thread Josh Rosenberg
Josh Rosenberg added the comment: Well, it's trading one person's style for the PEP7 official style, so it's not completely arbitrary. That said, I'm not sure it's justifiable to apply to the entire historic code base; my impression was that PEP7 was not intended to

[issue27400] Datetime NoneType after calling Py_Finalize and Py_Initialize

2016-09-15 Thread Josh Rosenberg
Josh Rosenberg added the comment: Nick: Looks like it's quite a bit more work than just a dict lookup. That PyImport_ImportModuleNoBlock call (which seems odd; the implementation of NoBlock is just to wrap the blocking function; guess we don't allow non-blocking imports anymore a

[issue27400] Datetime NoneType after calling Py_Finalize and Py_Initialize

2016-09-15 Thread Josh Rosenberg
Josh Rosenberg added the comment: Hmm... On checking down some of the code paths and realizing there were some issues in 3.5 (redundant code, and what looked like two memory leaks), I checked tip (to avoid opening bugs on stale code), and discovered that #22557 rewrote the import code

[issue28201] dict: perturb shift should be done when first conflict

2016-09-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: General comment on the patch: I believe per PEP7, we're still sticking to ANSI C (aka C89), and specifically, "all declarations must be at the top of a block (not necessarily at the top of function". The patch assumes lax standards com

[issue28201] dict: perturb shift should be done when first conflict

2016-09-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: Removing those unrelated changes looks like it would dramatically reduce the churn too, making review easier. -- ___ Python tracker <http://bugs.python.org/issue28

[issue28202] Python 3.5.1 C API, the global variable is not destroyed when delete the module

2016-09-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: The fact that it's resolved by PyGC_Collect indicates there is a reference cycle somewhere. PyGC_Collect is just looking for cyclic garbage and breaking the cycles so it can be cleaned; it would happen eventually unless GC was explicitly disabled o

[issue23591] enum: Add Flags and IntFlags

2016-09-26 Thread Josh Rosenberg
Josh Rosenberg added the comment: The "What’s New In Python 3.6" page should really get an update to mention Flag, IntFlag and auto as enhancements to the enum module. Right now, the ssl module update docs mentions (but does not properly link for some reason) IntFlag, but otherwise

[issue28278] Make `weakref.WeakKeyDictionary.__repr__` meaningful

2016-09-26 Thread Josh Rosenberg
Josh Rosenberg added the comment: Well, I could see a "friendly" repr being avoided to: 1. Save work (iterating safely involves iteration guards and explicitly acquiring strong references to every key) 2. Avoid pretending the state is stable (the repr at time X could be different

<    2   3   4   5   6   7   8   >