[issue29871] Enable optimized locks on Windows

2017-03-21 Thread Josh Rosenberg
Josh Rosenberg added the comment: Hmm... I was only running the threading related tests originally, and they passed, but it looks like this causes problems with multiprocessing (test_multiprocessing_spawn and test_concurrent_futures both stall out forever with this change, with or without my

[issue28041] Inconsistent behavior: Get st_nlink from os.stat() and os.scandir()

2017-03-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: This is documented behavior. Per the docs for os.DirEntry's stat method (the objects yielded by os.scandir): >On Windows, the st_ino, st_dev and st_nlink attributes of the stat_result are >always set to zero. Call os.stat() to get these attributes

[issue29944] Argumentless super() calls do not work in classes constructed with type()

2017-03-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: It looks like this is a general problem caused by the fact that a function that is: 1. Defined in a class 2. References the name "super" (even if it's a local variable name, even if it's never called) isn't "just" a p

[issue29944] Argumentless super() calls do not work in classes constructed with type()

2017-03-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: This is what I get for leaving a response up and working on it intermittently for three hours, and not rechecking: I found the same basic problem. For the record, I also found a terribly hacky way of doing this sort of rebinding manually, should you actually

[issue29954] multiprocessing.Pool.__exit__() calls terminate() instead of close()

2017-03-31 Thread Josh Rosenberg
Josh Rosenberg added the comment: I suspect it's far too late to change this, given compatibility constraints. If you want it to close instead of terminate, contextlib.closing is always an option. -- nosy: +josh.r ___ Python tracker

[issue29971] Lock.acquire() not interruptible on Windows

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

[issue29989] subprocess.Popen does not handle file-like objects without file descriptors

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

[issue29996] Use terminal width by default in pprint

2017-04-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: If you want the dir listing output in a column, you're just relying on your listing to be wider than 80 characters, it still doesn't columnize unless you pass that point. Personally, I feel if I made the terminal wider, I'd like to actually

[issue29996] Use terminal width by default in pprint

2017-04-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: Thus, you keep your default behavior of width=80, while I just add the following to my PYTHONSTARTUP file: from functools import partial from pprint import pprint, AUTOWIDTH pprint = partial(pprint, width=AUTOWIDTH) and we both get what we want

[issue30020] Make attrgetter use namedtuple

2017-04-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: Aside from other issues, namedtuples can't have fields beginning with underscores, attrgetter can get attributes beginning with underscores (and dotted attributes for that matter). There isn't going to be an obvious or intuitive mapping to

[issue30040] new empty dict can be more small

2017-04-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: For the record, legitimate case when many empty dicts are created, and few are populated, is the collections-free approach to defaultdict(dict): mydict.setdefault(key1, {})[key2] = val For, say, 100 unique key1s, and 10,000 total key1/key2 pairs, you&#

[issue30049] Don't cache tp_iternext

2017-04-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: I'm having a hard time thinking of legitimate cases where replacing __next__ mid-iteration is a thing. Doing so retroactively on the class (so it changes all outstanding iterators, no matter what state they're in) seems dubious at best, and it w

[issue30140] Binary arithmetic does not always call subclasses first

2017-04-25 Thread Josh Rosenberg
Josh Rosenberg added the comment: I'd assume the preference for __rop__ only on subclass overload is because __rop__ method are usually fallback methods, and differ behaviorally from the __op__ methods in type strictness. In particular, the __rop__ fallbacks are often so non-strict that

[issue30248] Using boolean arguments in the _json module

2017-05-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: So, incredibly minor note: This will prevent a ridiculous use case of passing in a mutable object as the argument (say, a list), and mutating it between truthy and falsy values (appending or clearing) to toggle behaviors in an existing Encoder. Note: As

[issue30250] StreamIO truncate behavior of current position

2017-05-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: For the record, the StringIO module is Python 2 only (replaced by io.StringIO and io.BytesIO for Py3, which are also available on 2.6 and higher if you need consistency), and only documents truncate by reference to the generic docs for the built-in file

[issue30340] Optimize out non-capturing groups

2017-05-11 Thread Josh Rosenberg
Josh Rosenberg added the comment: The PR includes defining and using a _uniq function that is actually a no-op function (it doesn't uniquify, the first line returns the argument, so the rest is skipped). Was that supposed to be removed, or should it actually uniqify? -- nosy: +j

[issue30323] concurrent.futures.Executor.map() consumes all memory when big generators are used

2017-05-13 Thread Josh Rosenberg
Josh Rosenberg added the comment: This is a strict duplicate of #29842, for which I've had a PR outstanding for a couple months now. -- nosy: +josh.r ___ Python tracker <http://bugs.python.org/is

[issue30360] getpass.getpass() does not accept stdin from an Expect script

2017-05-14 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- title: getpass.getpass() does not except stdin from an Expect script -> getpass.getpass() does not accept stdin from an Expect script ___ Python tracker <http://bugs.python.org/issu

[issue30517] Enum does not recognize enum.auto as unique values

2017-05-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: You didn't instantiate auto; read the docs ( https://docs.python.org/3/library/enum.html#using-automatic-values ): auto is a class, you instantiate it to make instances for use. If you omit the parens, it's just a plain class, not a special

[issue35459] Use PyDict_GetItemWithError() instead of PyDict_GetItem()

2019-02-26 Thread Josh Rosenberg
Josh Rosenberg added the comment: #36110 was closed as a duplicate; the superseder is #36109 (which has been fixed). The change should still be documented, just in case anyone gets bitten by it. -- nosy: +josh.r ___ Python tracker <ht

[issue36030] add internal API function to create tuple without items array initialization

2019-02-26 Thread Josh Rosenberg
Josh Rosenberg added the comment: Victor/vstinner: Isn't PR 12032 reintroducing the issue fixed in #29234? _PyStack_AsTuple was explicitly marked as _Py_NO_INLINE because inlining was creating excessive stack consumption in the callers (which were the bytecode interpreter loop), but th

[issue36119] Can't add/append in set/list inside shared dict

2019-02-26 Thread Josh Rosenberg
Josh Rosenberg added the comment: As Karthikeyan, this is an inevitable, and documented, consequence of the proxies not being aware of in-place modification of their contents. As your own example demonstrates, any approach that provides that information to the shared dict proxy will work

[issue36127] Argument Clinic: inline parsing code for functions with keyword parameters

2019-02-26 Thread Josh Rosenberg
Change by Josh Rosenberg : -- nosy: +josh.r ___ Python tracker <https://bugs.python.org/issue36127> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36127] Argument Clinic: inline parsing code for functions with keyword parameters

2019-02-26 Thread Josh Rosenberg
Josh Rosenberg added the comment: How much bigger does the core interpreter + built-in extension modules get when you make this change? How much more memory is used by real world programs? I'm a little concerned when I see individual functions growing by 140 lines in the first file o

[issue36118] Cannot correctly concatenate nested list that contains more than ~45 entries with other nested lists.

2019-02-26 Thread Josh Rosenberg
Josh Rosenberg added the comment: Agreed, I cannot reproduce this (online link showing behavior): https://tio.run/##K6gsycjPM/7/v0LBViE6WilRSUdBKQlI6OnpKQCZTlFKsbFclWDJWB2FaEMdIx1jHRMdU5gKS0uQfLRBLFBJBZDiKijKzCvRAIlocv3/DwA My guess is the code is subtly different, e.g. replacing: >>

[issue36129] io documentation unclear about flush() and close() semantics for wrapped streams

2019-02-26 Thread Josh Rosenberg
Josh Rosenberg added the comment: The general rule of thumb is to have the API behave as if no wrapping is occurring. The outermost layer should still adhere to the documented API requirements, so both flush and close should cascade (flush says it flushes the "buffers" plural; all

[issue36144] Dictionary addition.

2019-02-28 Thread Josh Rosenberg
Josh Rosenberg added the comment: scoder: dict(X, **M) is broken unless M is known to be string keyed (it used to work, but in Python 3, it will raise a TypeError). It's part of the argument for the additional unpacking generalizations from PEP 448; {**X, **M} does what dict(X, **

[issue36144] Dictionary addition.

2019-02-28 Thread Josh Rosenberg
Josh Rosenberg added the comment: Also note: That Python ideas thread that xtreak linked ( https://mail.python.org/pipermail/python-ideas/2015-February/031748.html ) largely rejected the proposal a couple weeks before PEP 448 was approved. At the time, the proposal wasn't just

[issue36158] Regex search behaves differently in list comprehension

2019-03-04 Thread Josh Rosenberg
Josh Rosenberg added the comment: Sounds like at least one such entity's trigger attribute doesn't match the regex. In the spelled out loop, you'd still get the exception on a failed match, but you'd store the results for however many entities matched before then (so ca

[issue36187] Get rid of NamedStore

2019-03-04 Thread Josh Rosenberg
Change by Josh Rosenberg : -- nosy: +josh.r ___ Python tracker <https://bugs.python.org/issue36187> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36172] csv module internal consistency

2019-03-04 Thread Josh Rosenberg
Josh Rosenberg added the comment: Unless someone disagrees soon, I'm going to close this as documented behavior/not a bug. AFAICT, the only "fixes" available for this are: 1. Changing the default dialect from 'excel' to something else. Problem: Breaks correct co

[issue36206] re.match() not matching escaped hyphens

2019-03-05 Thread Josh Rosenberg
Josh Rosenberg added the comment: "\\-" is equivalent to the raw string r"\-" (that it, it has one backslash, followed by a hyphen). \X (where X is any ASCII non-letter, non-digit) matches the character itself (the escape does nothing except ensure the punctuation does

[issue36206] re.match() not matching escaped hyphens

2019-03-05 Thread Josh Rosenberg
Change by Josh Rosenberg : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue36198] Misleading in library/sets document

2019-03-05 Thread Josh Rosenberg
Josh Rosenberg added the comment: The "returns" bit is accurate when referring to the in-place operator overloads (__ior__), so those lines may have been written referring to the overloads described on the same line (they shouldn't have been written that way, but that would e

[issue36158] Regex search behaves differently in list comprehension

2019-03-05 Thread Josh Rosenberg
Change by Josh Rosenberg : -- status: open -> pending ___ Python tracker <https://bugs.python.org/issue36158> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue36172] csv module internal consistency

2019-03-05 Thread Josh Rosenberg
Change by Josh Rosenberg : -- status: open -> pending ___ Python tracker <https://bugs.python.org/issue36172> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue33346] Syntax error with async generator inside dictionary comprehension

2019-03-06 Thread Josh Rosenberg
Change by Josh Rosenberg : -- nosy: +josh.r ___ Python tracker <https://bugs.python.org/issue33346> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36228] Add function to complex object

2019-03-07 Thread Josh Rosenberg
Josh Rosenberg added the comment: They already have a .real attribute to extract the real part, which you can call int on. I suspect the lack of support for float/int coercion is intentional; coercing float to int loses precision, but it's still a fundamentally similar value. Impli

[issue36228] Support coercion of complex to float/int

2019-03-07 Thread Josh Rosenberg
Change by Josh Rosenberg : -- title: Add function to complex object -> Support coercion of complex to float/int ___ Python tracker <https://bugs.python.org/issu

[issue36278] Truncate method

2019-03-12 Thread Josh Rosenberg
Change by Josh Rosenberg : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> File truncate() not defaulting to current position as documented ___ Python tracker <https://bugs.python

[issue36229] Avoid unnecessary copies for list, set, and bytearray ops.

2019-03-13 Thread Josh Rosenberg
Josh Rosenberg added the comment: Raymond said: "FWIW, the non-operator versions of these operations already support passing in multiple arguments and is the preferred way to do it." True for sets with union/intersection/difference (and their inplace equivalents), but not for

[issue36229] Avoid unnecessary copies for list, set, and bytearray ops.

2019-03-13 Thread Josh Rosenberg
Josh Rosenberg added the comment: I believe Tim Peters's concern with: Set1 = Set1 & Set2 is misplaced, because he's drawn an analogy with the string concatenation optimization, which *does* handle: Str1 = Str1 + Str2 because the optimization is in the ceval loop and

[issue36320] typing.NamedTuple to switch from OrderedDict to regular dict

2019-03-18 Thread Josh Rosenberg
Josh Rosenberg added the comment: Would it make sense to convert _field_types to a property, so the method(s) that implement the property can do: warnings.warn("_field_types is deprecated; use __annotations__ instead", DeprecationWarning) to indicate the deprecation programmati

[issue36320] typing.NamedTuple to switch from OrderedDict to regular dict

2019-03-18 Thread Josh Rosenberg
Josh Rosenberg added the comment: Blech. Just remembered _field_types is a *class* attribute, not an instance attribute, so it (just) can't be a plain property on NamedTuple itself. And because NamedTuple is super-weird (AFAICT, class X(typing.NamedTuple): pass defines a class wher

[issue36347] Add the constant READWRITE for PyMemberDef

2019-03-18 Thread Josh Rosenberg
Josh Rosenberg added the comment: Serhiy: Problem is that READONLY already exists, so PY_READWRITE would be inconsistent. Given currently READONLY is just defined as: #define READONLY 1 I suppose a solution to maintain consistency (of a sort) would be to add the definitions: #define

[issue36355] Remove documentation and internal use of the RESTRICTED constants for PyMemberDef's flags field

2019-03-18 Thread Josh Rosenberg
New submission from Josh Rosenberg : While looking up background info for #36347, I noticed that the docs for PyMemberDef ( https://docs.python.org/3/extending/newtypes.html#generic-attribute-management ) define the following flags: * READONLY * READ_RESTRICTED * WRITE_RESTRICTED

[issue36355] Remove documentation and internal use of the *RESTRICTED constants for PyMemberDef's flags field

2019-03-18 Thread Josh Rosenberg
Josh Rosenberg added the comment: To be clear, only the constants that include the substring RESTRICTED are useless; READONLY remains useful and should not be removed (though per my suggestion on #36347, it might be good to add an alias for it named PY_READONLY to match the Python C API

[issue36347] Renaming the constants for the .flags of PyMemberDef

2019-03-19 Thread Josh Rosenberg
Josh Rosenberg added the comment: Pretty sure you can't actually get rid of READONLY; it's part of the public API. Adding PY_READONLY to match PY_READWRITE is fine, but unlike WRITE_RESTRICTED/PY_WRITE_RESTRICTED (which isn't used at all in Py3, has been non-functional

[issue36380] collections.Counter in-place operators are unexpectedly slow

2019-03-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: @Nikita: Your examples aren't unexpected at all, per the documented behavior: >Several mathematical operations are provided for combining Counter objects to >produce multisets (counters that have counts greater than zero). Addition and >subtr

[issue36379] nb_inplace_pow is always called with an invalid argument

2019-03-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: object.__ipow__ is documented to take an optional third argument (though there is no way to pass it aside from explicitly calling __ipow__ directly since there is no syntax support for three-arg pow, in place or otherwise), so it's not some incompatib

[issue36355] Remove documentation and internal use of the *RESTRICTED constants for PyMemberDef's flags field

2019-03-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: Yes, they're set. They're never *read* anywhere. My suggestion was to stop setting them (because it gives the impression they do something when reading the docs, when in fact they do nothing), and remove them fro

[issue36355] Remove documentation and internal use of the *RESTRICTED constants for PyMemberDef's flags field

2019-03-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: Sorry, that should have been "it gives the impression they do something when reading the *source code*" -- ___ Python tracker <https://bugs.python.o

[issue36354] Use CreateProcessW for Python 2.7 on Windows.

2019-03-22 Thread Josh Rosenberg
Josh Rosenberg added the comment: 2.7 is in bug fix only mode, and even that ends at the end of this year. This seems more like a feature request than an actual bug; it works, but not great with Unicode in some cases (which describes large parts of Python 2). It does look like Python 3.7 at

[issue36422] tempfile.TemporaryDirectory() removes entire directory tree even if it's a mount-point

2019-03-25 Thread Josh Rosenberg
Josh Rosenberg added the comment: Allowing delete_on_error=False is kind of defeating the purpose here; the whole point of the with statement is guaranteed, consistent cleanup in both normal and error cases. If you knew enough to know you needed to pass delete_on_error, you'd also

[issue36408] Tkinter multi-processing performance, Linux 10-25 times faster than Windows 10

2019-03-25 Thread Josh Rosenberg
Josh Rosenberg added the comment: Could you provide a minimal reproducer script? With multiprocessing involved, I'd suspect some issue with data sharing (Windows can't fork after all, so it's possible something is involved there). I see nothing obvious in the _tkinter mo

[issue35473] Intel compiler (icc) does not fully support C11 Features, including atomics

2019-03-25 Thread Josh Rosenberg
Josh Rosenberg added the comment: Perhaps an alternative solution would be to provide conditional definitions for the stuff ICC leaves out? I'm assuming ICC can actually handle _Atomic uintptr_t if you type it out, it's just missing the typedef for it for whatever reason? -

[issue36455] collections.abc.Sequence doesn't support reflection/introspection

2019-03-27 Thread Josh Rosenberg
Josh Rosenberg added the comment: This is an exact duplicate of #35190 - "collections.abc.Sequence cannot be used to test whether a class provides a particular interface (doc issue)" -- nosy: +josh.r resolution: -> duplicate superseder: -> collections.abc.Sequence c

[issue36455] collections.abc.Sequence doesn't support reflection/introspection

2019-03-27 Thread Josh Rosenberg
Change by Josh Rosenberg : -- stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue36455> ___ ___ Python-bugs-list

[issue36488] os.sendfile() on BSD and macOS does not return bytes sent on EINTR

2019-04-01 Thread Josh Rosenberg
Josh Rosenberg added the comment: Wasn't the point of PEP475 that all EINTR returns would be explicitly handled by retrying rather than forcing the user to handle it? Seems like the correct solution is still to retry, but on OSX/FreeBSD we'd need to update the offset and count ar

[issue36499] unpickling of a datetime object in 3.5 fails when pickled with 2.7

2019-04-02 Thread Josh Rosenberg
Josh Rosenberg added the comment: As noted, this is fixed in 3.6+. 3.5 is in security fix only mode ( https://devguide.python.org/#status-of-python-branches ), which is why the fix for #22005 wasn't backported. -- nosy: +josh.r resolution: -> duplicate stage: -> reso

[issue36506] [security] CVE-2019-10268: An arbitrary execution vulnerability exists in the built-in function getattr

2019-04-02 Thread Josh Rosenberg
Josh Rosenberg added the comment: I'll note that, based on the title, I'm skeptical of the claim of a vulnerability. getattr is effectively *designed* to execute arbitrary code if called on an appropriate object (one where the class defines __getattribute__; defines __getattr

[issue36158] Regex search behaves differently in list comprehension

2019-04-02 Thread Josh Rosenberg
Change by Josh Rosenberg : -- resolution: -> not a bug stage: -> resolved status: pending -> closed ___ Python tracker <https://bugs.python.or

[issue36379] nb_inplace_pow is always called with an invalid argument

2019-04-02 Thread Josh Rosenberg
Josh Rosenberg added the comment: skrah: Is there any reason your patch, as written, wouldn't work? If you need a test case to verify, gmpy2's xmpz type supports in place pow (but requires the modulus to be None, since there is no normal way to pass it anyway), so you can

[issue32941] mmap should expose madvise()

2019-04-02 Thread Josh Rosenberg
Josh Rosenberg added the comment: It might be nice to expose a more limited API to prefetch memory in bulk while we're at it. Windows 8 and higher offers PrefetchVirtualMemory ( https://docs.microsoft.com/en-us/windows/desktop/api/memoryapi/nf-memoryapi-prefetchvirtualmemory ) which

[issue36525] Deprecate instancemethod

2019-04-04 Thread Josh Rosenberg
Josh Rosenberg added the comment: Actually, there is a use case, and it's one I've been intermittently trying to replicate ever since the functionality vanished in the Python 2 to 3 transition (or so I thought). The use case is taking an existing built-in function (as in a CPytho

[issue36488] os.sendfile() on BSD, macOS don't return bytes sent on EINTR

2019-04-07 Thread Josh Rosenberg
Josh Rosenberg added the comment: Right. So this is a hard problem for anyone to solve, and therefore os.sendfile should be the one solving it, not the caller of sendfile, right? -- ___ Python tracker <https://bugs.python.org/issue36

[issue36645] re.sub() library entry does not adequately document surprising change in behavior between versions

2019-04-16 Thread Josh Rosenberg
Josh Rosenberg added the comment: I believe the second note under "Changed in 3.7" is intended to address this: > Empty matches for the pattern are replaced when adjacent to a previous > non-empty match. Obviously not as detailed as the What's New entry, but it'

[issue23382] Maybe can not shutdown ThreadPoolExecutor when call the method of shutdown

2019-04-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: Correct me if I'm wrong, but this isn't actually an issue for CPython, right? The GIL ensures that when a thread writes to _shutdown, nothing else is reading it until the GIL is released and acquired by a new thread (which synchronizes _shutdown).

[issue36650] Cached method implementation no longer works on Python 3.7.3

2019-04-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: It seems highly likely this is related to #26110 which optimizes method calls by avoiding the creation of bound methods in certain circumstances, and/or the follow-up #29263. Side-note: bound_method = functools.partial(method, self) is not how you create

[issue36650] Cached method implementation no longer works on Python 3.7.3

2019-04-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: Hmm... Although I can't seem to reproduce on 3.7.2 (ob.calls is 1), so assuming it is really happening in 3.7.3, it wouldn't be either of those issues (which were fully in place long before 3.7.2

[issue36715] Dictionary initialization

2019-04-24 Thread Josh Rosenberg
Josh Rosenberg added the comment: This is the same basic problem seen with sequence multiplication, mutable default arguments to a function, etc. It's not going to change though; the documentation says it "Create a new dictionary with keys from iterable and values set to value

[issue36424] Pickle fails on frozen dataclass that has slots

2019-04-25 Thread Josh Rosenberg
Change by Josh Rosenberg : -- nosy: +josh.r ___ Python tracker <https://bugs.python.org/issue36424> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36757] uuid constructor accept invalid strings (extra dash)

2019-04-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: The documentation does describe a fairly flexible parser. Perhaps it's a little too flexible on stuff like URN prefixes, but I don't think we could start enforcing a stricter class of hyphen separations without potentially breaking existing code.

[issue36793] Do not define unneeded __str__ equal to __repr__

2019-05-05 Thread Josh Rosenberg
Josh Rosenberg added the comment: I like this. Always annoying to explicitly override both __repr__ and __str__ on subclasses of stuff like int when they should be the same. Patch looks good to me; I was originally wondering why some classes were replacing: __str__ = __repr__ with

[issue36781] Optimize sum() for bools

2019-05-05 Thread Josh Rosenberg
Change by Josh Rosenberg : -- nosy: +josh.r ___ Python tracker <https://bugs.python.org/issue36781> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36789] Unicode HOWTO incorrectly states that UTF-8 contains no zero bytes

2019-05-05 Thread Josh Rosenberg
Josh Rosenberg added the comment: Minor bikeshed: If updating the documentation, refer to U+ as "the null character" or "NUL", not "NULL". Using "NULL" allows for confusion with NULL pointers; "the null character" (the name used in t

[issue29842] Make Executor.map work with infinite/large inputs correctly

2019-05-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: Noticed unresolved comments (largely on documentation) on the PR and since I'm sprinting this week I finally had the time to address them. I merged the latest master into the PR, hope that's considered the correct way to app

[issue29842] Make Executor.map work with infinite/large inputs correctly

2019-05-06 Thread Josh Rosenberg
Change by Josh Rosenberg : -- versions: +Python 3.8 -Python 3.7 ___ Python tracker <https://bugs.python.org/issue29842> ___ ___ Python-bugs-list mailin

[issue11107] Cache constant "slice" instances

2019-05-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: I'm trying to sprint on this this week. I already had a PoC put together, but it has some significant issues caused by one major quirk with slices: 1. They're immutable, but 2. They're not hashable In various places, it is (reasonabl

[issue23697] Module level map & submit for concurrent.futures

2019-05-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: For the process based versions, it makes it too easy to accidentally fork bomb yourself, since each process that call psubmit would implicitly created another #CPUs workers of its own, so a process based version Brian's case with a mere four top-

[issue11107] Cache constant "slice" instances

2019-05-07 Thread Josh Rosenberg
Josh Rosenberg added the comment: Remi: The reason they're not hashable is presumably because it would make them valid dictionary keys, further confusing the difference between sequences and mappings. x[::-1] would, for a sequence, return a reversed sequence, but for a mapping, would e

[issue13824] argparse.FileType opens a file and never closes it

2019-05-07 Thread Josh Rosenberg
Josh Rosenberg added the comment: Mitar: argparse.FileType's __call__ (which is what "parses" the argument) returns whatever open (aka io.open) returns. Basically, post-parsing, there is nothing about the result of FileType that distinguishes it from a manually opened file

[issue14156] argparse.FileType for '-' doesn't work for a mode of 'rb'

2019-05-07 Thread Josh Rosenberg
Josh Rosenberg added the comment: Serhiy: To be clear, Moritz's patch won't work if stdin/stdout are io.StringIO or the like either, since StringIO lacks a buffer attribute. Personally, I'm content to: 1. Ignore the closeability of the standard handles; that's not pa

[issue14156] argparse.FileType for '-' doesn't work for a mode of 'rb'

2019-05-07 Thread Josh Rosenberg
Change by Josh Rosenberg : -- pull_requests: +13082 ___ Python tracker <https://bugs.python.org/issue14156> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue14156] argparse.FileType for '-' doesn't work for a mode of 'rb'

2019-05-07 Thread Josh Rosenberg
Josh Rosenberg added the comment: I've created PR13165 to address this bug. It's 99% test updates; the actual code changes to argparse.py are trivial and should be equally trivial to review. The only functional change beyond Moritz's proposal is that I added support for h

[issue35712] Make NotImplemented unusable in boolean context

2019-05-08 Thread Josh Rosenberg
Change by Josh Rosenberg : -- keywords: +patch pull_requests: +13106 stage: test needed -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue35712] Make NotImplemented unusable in boolean context

2019-05-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: I've submitted a PR for this. I did discover a use case for boolean evaluation while doing this in the functools.total_ordering helpers. While it's legitimate, it *looks* wrong (the code looks like it didn't consider the possibility of NotI

[issue36868] New behavior of OpenSSL hostname verification not exposed, incorrectly documented

2019-05-09 Thread Josh Rosenberg
New submission from Josh Rosenberg : The What's New in 3.7 docs mention the change from #31399 to use OpenSSL's built-in hostname verification ( https://docs.python.org/3/whatsnew/3.7.html#ssl ), but aside from that, information about the change is largely undiscoverable an

[issue33725] Python crashes on macOS after fork with no exec

2019-05-10 Thread Josh Rosenberg
Josh Rosenberg added the comment: I've seen far too many cases where Python code targeting Linux intentionally uses the COW benefits of fork for multiprocessing to think it would be a good idea to change the default start method there without *some* sort of deprecation p

[issue32723] codecs.open silently ignores argument errors

2018-01-29 Thread Josh Rosenberg
Josh Rosenberg added the comment: On both Py2 and Py3, calling codecs.open without passing an encoding argument is equivalent to adding 'b' to the mode string and calling the built-in open function directly; it returns a plain binary mode file object. The errors parameter is m

[issue32723] codecs.open silently ignores argument errors

2018-01-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: Ah, my mistake. That said, when you're not passing an encoding, you're still just calling regular open, it's not doing any special codecs.open wrapping (on Python 2, this meant you weren't decoding the input at all, on Python 3 it means

[issue32723] codecs.open silently ignores argument errors

2018-01-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: On rereading the docs for Python 3 codecs.open, it doesn't seem to document the whole "no encoding means no codecs.StreamReaderWriter wrapping behavior" at all. First off, any fix would only apply to Python 3 (I've removed 2.7 from the ve

[issue32723] codecs.open silently ignores argument errors

2018-01-30 Thread Josh Rosenberg
Change by Josh Rosenberg : -- versions: -Python 2.7 ___ Python tracker <https://bugs.python.org/issue32723> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32387] Disallow untagged C extension import on major platforms

2018-01-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: So, just for clarity, is there another approved mechanism for distributing an extension that just happens to act as a (Python version specific) C support library? I've wanted to be able to build a library (static or dynamic) that is installed t

[issue32694] Can no longer specify OpenSSL locations with CPPFLAGS / LDFLAGS ?

2018-01-30 Thread Josh Rosenberg
Change by Josh Rosenberg : -- title: Can no longer specify OpenSLL locations with CPPFLAGS / LDFLAGS ? -> Can no longer specify OpenSSL locations with CPPFLAGS / LDFLAGS ? ___ Python tracker <https://bugs.python.org/issu

[issue31356] Add context manager to temporarily disable GC

2018-01-31 Thread Josh Rosenberg
Josh Rosenberg added the comment: YoSTEALTH: I think this is one of those cases where the fact of it being a class is incidental; it's used the same as if it were a function, and just happens to be implemented as a class (the docs actually describe it in terms of a function). PEP8 gui

[issue32757] Python 2.7 : Buffer Overflow vulnerability in exec() function

2018-02-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: A server that exposes arbitrary exec's to user-submitted data can already be controlled. exec can do anything that Python can do, that's the whole point. Sure, crashing Python is bad, but it could also keep Python alive and start dumping the d

[issue32784] Wrong argument name for csv.DictReader in documentation

2018-02-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: Side-note: You say "how could i have known it was named 'f'?" >>> help(csv.DictReader) class DictReader | Methods defined here: | | __init__(self, f, fieldnames=None, restkey=None, restval=None, dialect='excel'

[issue32833] argparse doesn't recognise two option aliases as equal

2018-02-12 Thread Josh Rosenberg
Josh Rosenberg added the comment: To be clear, the specific error is: error: ambiguous option: --a could match --a-b, --ab which makes sense if they're separate switches, but doesn't make sense when both expansions are aliases of one another. -- nos

[issue20632] Define a new __key__ protocol

2018-02-12 Thread Josh Rosenberg
Josh Rosenberg added the comment: Do data classes let you define some fields as being excluded from the equality/ordering/hashing? I got the impression that if a field existed, it was part of the "key" no matter what, which isn't necessarily correct in the general case. Simple

<    1   2   3   4   5   6   7   8   >