[issue43824] array.array.__deepcopy__() accepts a parameter of any type

2021-04-12 Thread Josh Rosenberg
Josh Rosenberg added the comment: __deepcopy__ is required to take a second argument by the rules of the copy module; the second argument is supposed to be a memo dictionary, but there's no reason to use it for array.array (it can't contain Python objects, and you only use the memo

[issue43464] set intersections should short-circuit

2021-03-10 Thread Josh Rosenberg
New submission from Josh Rosenberg : At present, set_intersection (the C name for set.intersection) optimizes for pairs of sets by iterating the smallest set and only adding entries found in the larger, meaning work is proportionate to the smallest input. But when the other input isn't a set

[issue43363] memcpy writes to wrong destination

2021-03-02 Thread Josh Rosenberg
Josh Rosenberg added the comment: Agreed, stack is a PyObject**, so adding an integer (pto_nargs) to the pointer (stack) is implicitly by multiples of sizeof(PyObject*). This is how pointer arithmetic works in all versions of C I'm aware of. The code is correct. -- nosy: +josh.r

[issue43297] bz2.open modes behaving differently than standard open() modes

2021-02-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: All of the compression modules (gzip, lzma) have this behavior, not just bz2; it's consistent in that sense. Changing it now, after literally decades with the old behavior, would needlessly break existing programs. As you say, it's documented clearly, I'm

[issue43209] system cannot find the file specified in subprocess.py

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

[issue43246] Dict copy optimization violates subclass invariant

2021-02-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: The cause is in dict_merge (see here: https://github.com/python/cpython/blob/master/Objects/dictobject.c ); it has a fast path for when the object being merged in (which is what the dict constructor does; it makes an empty dict, then merges the provided

[issue43119] asyncio.Queue.put never yields if the queue is unbounded

2021-02-04 Thread Josh Rosenberg
Josh Rosenberg added the comment: Making literally every await equivalent to: await asyncio.sleep(0) followed by the actual await (which is effectively what you're proposing when you expect all await to be preemptible) means adding non-trivial overhead to all async operations (asyncio

[issue42948] bytearray.copy is undocumented

2021-01-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: Does this need specific documentation? bytearray itself is documented with: > As bytearray objects are mutable, they support the mutable sequence > operations in addition to the common bytes and bytearray operations described > in Bytes and

[issue42958] filecmp.cmp(shallow=True) isn't actually shallow when only mtime differs

2021-01-19 Thread Josh Rosenberg
Josh Rosenberg added the comment: This is a problem with the docstring. The actual docs for it are a bit more clear, https://docs.python.org/3/library/filecmp.html#filecmp.cmp : "If shallow is true, files with identical os.stat() signatures are taken to be equal. Otherwise, the con

[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-01-12 Thread Josh Rosenberg
Josh Rosenberg added the comment: Gregory: Even in a low-level compiled language (say, C++), pretty sure the compiler can't automatically optimize out: if (x) { } unless it has sure knowledge of the implementation of operator bool; if operator bool's implementation isn't in the header

[issue15373] copy.copy() does not properly copy os.environment

2021-01-12 Thread Josh Rosenberg
Josh Rosenberg added the comment: Would we remove the functionality of os.environ.copy()? It seems very odd for types to have a .copy() method that works, while not supporting copy.copy, especially when there is zero documentation, on the web or the docstring, to even hint at the difference

[issue42826] typing.Iterable does not need __getitem__() method

2021-01-04 Thread Josh Rosenberg
Josh Rosenberg added the comment: As Serhiy says, the glossary term for an iterable is not the same as the documentation for typing.Iterable (which at this point is largely defined in terms of collections.abc.Iterable). True, collections.abc.Iterable does not detect classes that iterate via

[issue42699] Use `.join(k for k in g)` instead of `.join([k for k in g])`

2020-12-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: This is a pessimization given the current implementation of str.join; it calls PySequence_Fast as the very first step, which is effectively free for a tuple or list input (just reference count manipulation), but must convert a generator expression to a list

[issue42689] Installation

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

[issue42629] PyObject_Call not behaving as documented

2020-12-16 Thread Josh Rosenberg
Josh Rosenberg added the comment: Pingback from #42033. Proper fix for that issue likely involves moving the work for copying kwargs into PyObject_Call, which would fix this bug by side-effect. -- nosy: +josh.r ___ Python tracker <ht

[issue42033] Seemingly unnecessary complexification of foo(**kw)

2020-12-16 Thread Josh Rosenberg
Josh Rosenberg added the comment: Even if making a copy is necessary when the underlying function receives the dict "raw", preemptively performing the copy (before knowing if the function being called is a Vectorcall function) means that when it's a Vectorcall function (e.g

[issue42646] Add function that supports "applying" methods

2020-12-15 Thread Josh Rosenberg
Josh Rosenberg added the comment: If you're annoyed by having to use two lines, one to copy, one to call the mutating method, you can use the walrus operator: (y := x.copy()).some_method() or: (y := deepcopy(x)).some_method() Does that cover your use case? For the list case, you'd

[issue42612] Software Designer

2020-12-12 Thread Josh Rosenberg
Josh Rosenberg added the comment: A rough description is not sufficient. If you have code that reproduces the problem, post the reproducer so we can check, but odds are you've got a bug in your code. -- nosy: +josh.r status: open -> pend

[issue39707] Abstract property setter/deleter implementation not enforced, but documented as such

2020-12-09 Thread Josh Rosenberg
Josh Rosenberg added the comment: If this is going to be closed as rejected, I think it still needs some improvement to the documentation. Right now, the docs for abstractproperty (deprecated in favor of combining property and abstractmethod) state: "If only some components are abs

[issue42565] Traceback (most recent call last): File "", line 1, in NameError: name 'python' is not defined

2020-12-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: Looks like someone tried to run python inside an interactive Python shell, rather than the command line. I'm moving to pending and will eventually close unless they add a repro for some actual bug. -- nosy: +josh.r status: open -> pend

[issue42454] Move slice creation to the compiler for constants

2020-11-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: Yep, Mark Shannon's solution of contextual hashing is what I was trying (without success) when my last computer died (without backing up work offsite, oops) and I gave up on this for a while. And Batuhan Taskaya's note about compiler dictionaries

[issue41878] python3 fails to use custom mapping object as symbols in eval()

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

[issue42454] Move slice creation to the compiler for constants

2020-11-24 Thread Josh Rosenberg
Josh Rosenberg added the comment: There is an open issue for this already, under #11107 (a reopen of the closed #2268, where the reopen was justified due to Python 3 making slice objects more common), just so you know. I made a stab at this a while ago and gave up due to the problems

[issue26290] fileinput and 'for line in sys.stdin' do strange mockery of input buffering

2020-11-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: For those who find this in the future, the simplest workaround for the: for line in sys.stdin: issue on Python 2 is to replace it with: for line in iter(sys.stdin.readline, ''): The problem is caused by the way file.__next__'s buffering behaves

[issue42269] Add ability to set __slots__ in dataclasses

2020-11-10 Thread Josh Rosenberg
Josh Rosenberg added the comment: Is the plan to allow an argument to auto-generate __slots__, or would this require repeating the names once in __slots__, and once for annotations and the like? -- ___ Python tracker <https://bugs.python.

[issue42269] Add ability to set __slots__ in dataclasses

2020-11-10 Thread Josh Rosenberg
Change by Josh Rosenberg : -- nosy: +josh.r ___ Python tracker <https://bugs.python.org/issue42269> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39931] Global variables are not accessible from child processes (multiprocessing.Pool)

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

[issue42033] Seemingly unnecessary complexification of foo(**kw)

2020-10-15 Thread Josh Rosenberg
Change by Josh Rosenberg : -- nosy: +josh.r ___ Python tracker <https://bugs.python.org/issue42033> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue41972] bytes.find consistently hangs in a particular scenario

2020-10-07 Thread Josh Rosenberg
Change by Josh Rosenberg : -- type: performance -> behavior ___ Python tracker <https://bugs.python.org/issue41972> ___ ___ Python-bugs-list mailing list Un

[issue41972] bytes.find consistently hangs in a particular scenario

2020-10-07 Thread Josh Rosenberg
Josh Rosenberg added the comment: Can reproduce on Alpine Linux, with CPython 3.8.2 (running under WSLv2), so it's not just you. CPU usage is high; seems like it must be stuck in an infinite loop. -- nosy: +josh.r ___ Python tracker <ht

[issue41924] TextWrap's wrap method throws unhelpful error on bytes object

2020-10-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: It's not textwrap that's doing it, which is why the error is so unhelpful; the input is assumed to be a str, and the translate method is called on it with a dict argument, which is valid for str.translate, but not for bytes.translate. You'll get other

[issue41878] python3 fails to use custom mapping object as symbols in eval()

2020-09-29 Thread Josh Rosenberg
Josh Rosenberg added the comment: Yes, list comprehensions having their own local scope was a change from Py2 to Py3. Python 2 did not do this for list comps initially, and it was left that way during the 2.x timeframe due to back compat constraints, but 2.x did it from the start

[issue41702] Inconsistent behaviour in strftime

2020-09-03 Thread Josh Rosenberg
Josh Rosenberg added the comment: 3.8.2 (on Alpine Linux under WSL) produces '0020-10-05', just like your 3.6 example. Not seeing anything obvious in commit history that would break it for 3.7. That said, 3.7 is in security fix only mode at this point (see https://devguide.python.org

[issue41694] python3 futures.as_completed timeout broken if future contains undefined reference

2020-09-02 Thread Josh Rosenberg
Josh Rosenberg added the comment: The problem is a lot simpler than you're making it: 1. You submit a time.sleep(30) task. This begins running immediately 2. You try to submit another task, but a NameError is raised, bypassing the rest of the code (you never call as_completed

[issue36172] csv module internal consistency

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

[issue41652] An Advice on Turning Ellipsis into Keyword

2020-08-28 Thread Josh Rosenberg
Josh Rosenberg added the comment: I'm closing this as not being worth the costs of adding new keywords. You're welcome to propose it on the python-ideas list (a more appropriate place to propose and suss out the details of significant language changes), but you'll need to formulate a much

[issue41652] An Advice on Turning Ellipsis into Keyword

2020-08-28 Thread Josh Rosenberg
Josh Rosenberg added the comment: You can do the same thing to replace int, float, dict, len, and all the other built-in classes and functions. Why is Ellipsis so special that it needs protection, especially when, as you note, ... is an available unoverrideable way to refer to it? Making

[issue36379] nb_inplace_pow is always called with an invalid argument

2020-08-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: Zackery, should this be closed? Or is there something missing from the patch? -- ___ Python tracker <https://bugs.python.org/issue36

[issue36921] Deprecate yield from and @coroutine in asyncio

2020-06-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: Was this supposed to deprecate using types.coroutine as a decorator as well? Because that's not clearly documented, which means people can still use it to make generator-based coroutines without async def. -- nosy: +josh.r

[issue40269] Inconsistent complex behavior with (-1j)

2020-04-12 Thread Josh Rosenberg
Josh Rosenberg added the comment: The final entry is identical to the second to last, because ints have no concept of -0. If you used a float literal, it would match the first two: >>> -0.-1j (-0-1j) I suspect the behavior here is due to -1j not actually being a literal on its

[issue40201] Last digit count error

2020-04-05 Thread Josh Rosenberg
Josh Rosenberg added the comment: Your script is using "true" division with / , (that produces potentially inaccurate float results) not floor division with // , (which gets int results). When the inputs vastly exceed the integer representational capabilities of floats (52-53 bits

[issue36144] Dictionary union. (PEP 584)

2020-02-26 Thread Josh Rosenberg
Josh Rosenberg added the comment: Sorry, I think I need examples to grok this in the general case. ChainMap unioned with dict makes sense to me (it's equivalent to update or copy-and-update on the top level dict in the ChainMap). But ChainMap unioned with another ChainMap is less clear

[issue36144] Dictionary union. (PEP 584)

2020-02-26 Thread Josh Rosenberg
Josh Rosenberg added the comment: What is ChainMap going to do? Normally, the left-most argument to ChainMap is the "top level" dict, but in a regular union scenario, last value wins. Seems like layering the right hand side's dict on top of the left hand side's would match

[issue39693] tarfile's extractfile documentation is misleading

2020-02-19 Thread Josh Rosenberg
New submission from Josh Rosenberg : The documentation for extractfile ( https://docs.python.org/3/library/tarfile.html#tarfile.TarFile.extractfile ) says: "Extract a member from the archive as a file object. member may be a filename or a TarInfo object. If member is a regular

[issue36051] Drop the GIL during large bytes.join operations?

2019-12-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: This will introduce a risk of data races that didn't previously exist. If you do: ba1 = bytearray(b'\x00') * 5 ba2 = bytearray(b'\x00') * 5 ... pass references to thread that mutates them ... ba3 = b''.join((ba1, ba2)) then two

[issue39167] argparse boolean type bug

2019-12-30 Thread Josh Rosenberg
Change by Josh Rosenberg : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> ArgumentParser should support bool type according to truth values ___ Python tracker <https://bugs.python

[issue38971] codecs.open leaks file descriptor when invalid encoding is passed

2019-12-04 Thread Josh Rosenberg
Josh Rosenberg added the comment: Any reason not to just defer opening the file until after the codec has been validated, so the resource acquisition comes last? -- nosy: +josh.r ___ Python tracker <https://bugs.python.org/issue38

[issue38934] Dictionaries of dictionaries behave incorrectly when created from dict.fromkeys()

2019-11-27 Thread Josh Rosenberg
Josh Rosenberg added the comment: That's the expected behavior, and it's clearly documented here: https://docs.python.org/3/library/stdtypes.html#dict.fromkeys Quote: "All of the values refer to just a single instance, so it generally doesn’t make sense for value to be a mutable o

[issue38874] asyncio.Queue: putting items out of order when it is full

2019-11-26 Thread Josh Rosenberg
Josh Rosenberg added the comment: Yes, five outstanding blocked puts can be bypassed by a put that comes in immediately after a get creates space. But this isn't really a problem; there are no guarantees on what order puts are executed in, only a guarantee that once a put succeeds, it's

[issue38874] asyncio.Queue: putting items out of order when it is full

2019-11-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: The items that haven't finished the put aren't actually "in" the queue yet, so I don't see how non-FIFO order of insertion violates any FIFO guarantees for the contents of the queue; until the items are actually "in", they're not sequen

[issue38853] set.repr breaches docstring contract

2019-11-19 Thread Josh Rosenberg
Josh Rosenberg added the comment: To be clear, the docstring is explicitly disclaiming any ordering contract. If you're reading "unordered" as meaning "not reordered" (like a list or tuple, where the elements appear in insertion order), that's not what "unorder

[issue38710] unsynchronized write pointer in io.TextIOWrapper in 'r+' mode

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

[issue38710] unsynchronized write pointer in io.TextIOWrapper in 'r+' mode

2019-11-06 Thread Josh Rosenberg
Change by Josh Rosenberg : -- components: +Library (Lib) ___ Python tracker <https://bugs.python.org/issue38710> ___ ___ Python-bugs-list mailing list Unsub

[issue36906] Compile time textwrap.dedent() equivalent for str or bytes literals

2019-11-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: Is there a reason folks are supporting a textwrap.dedent-like behavior over the generally cleaner inspect.cleandoc behavior? The main advantage to the latter being that it handles: '''First Second Third ''' just fine (removing the common

[issue38560] Allow iterable argument unpacking after a keyword argument?

2019-10-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: I'd be +1 on this, but I'm worried about existing code relying on the functional use case from your example. If we are going to discourage it, I think we either have to: 1. Have DeprecationWarning that turns into a SyntaxError, or 2. Never truly remove

[issue38566] Description of '\w' behavior is vague in `re` documentation

2019-10-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: The definition of \w, historically, has corresponded to the set of characters that can occur in legal variable names in C (alphanumeric ASCII plus underscores, making it equivalent to [a-zA-Z0-9_] for ASCII regex). That's why, on top of the definitely wordy

[issue34172] multiprocessing.Pool and ThreadPool leak resources after being deleted

2019-10-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: It should probably be backport to all supported 3.x branches though, so people aren't required to move to 3.8 to benefit from it. -- ___ Python tracker <https://bugs.python.org/issue34

[issue34172] multiprocessing.Pool and ThreadPool leak resources after being deleted

2019-10-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: Pablo's fix looks like a superset of the original fix applied here, so I'm assuming it fixes this issue as well. -- nosy: +josh.r ___ Python tracker <https://bugs.python.org/issue34

[issue32856] Optimize the `for y in [x]` idiom in comprehensions

2019-10-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: OOC, rather than optimizing a fairly ugly use case, might another approach be to make walrus less leaky? Even if observable leakage is considered desirable, it strikes me that use cases for walrus in genexprs and comprehensions likely break up into: 1. 90

[issue38167] O_DIRECT read fails with 4K mmap buffer

2019-10-10 Thread Josh Rosenberg
Josh Rosenberg added the comment: Yeah, not a bug. The I/O subsystem was substantially rewritten between Python 2 and Python 3, so you sometimes need to be more explicit about things like buffering, but as you note, once the buffering is correct, the code works; there's nothing to fix

[issue38167] O_DIRECT read fails with 4K mmap buffer

2019-10-04 Thread Josh Rosenberg
Josh Rosenberg added the comment: > I do not believe an unbuffered file uses O_DIRECT. This is why I use > os.open(fpath, os.O_DIRECT). Problem is you follow it with: fo = os.fdopen(fd, 'rb+') which introduces a Python level of buffering around the kernel unbuffered file desc

[issue36947] Fix 3.3.3.1 Metaclasses Documentation

2019-09-24 Thread Josh Rosenberg
Josh Rosenberg added the comment: The existing documentation is correct, just hard to understand if you don't already understand the point of metaclasses (metaclasses are hard, the language to describe them will be inherently a little klunky). At some point, it might be nice to write

[issue38255] Replace "method" with "attribute" in the description of super()

2019-09-24 Thread Josh Rosenberg
Josh Rosenberg added the comment: I prefer rhettinger's PR to your proposed PR; while super() may be useful for things other than methods, the 99% use case is methods, and deemphasizing that is a bad idea. rhettinger's PR adds a note about other use cases without interfering with super()'s

[issue38241] Pickle with protocol=0 in python 3 does not produce a 'human-readable' format

2019-09-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: I'll note, the same bug appears in Python 2, but only when pickling bytearray; since bytes in Python 2 is just a str alias, you don't see this misbehavior with it, only with bytearray (which is consistently incorrect/non-ASCII on both 2 and 3

[issue38241] Pickle with protocol=0 in python 3 does not produce a 'human-readable' format

2019-09-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: This seems like a bug in pickle; protocol 0 is *defined* to be ASCII compatible. Nothing should encode to a byte above 0x7f. It's not actually supposed to be "human-readable" (since many ASCII bytes aren't printable), so the docs should

[issue38167] O_DIRECT read fails with 4K mmap buffer

2019-09-13 Thread Josh Rosenberg
Josh Rosenberg added the comment: Works just fine for me on 3.7.3 on Ubuntu, reading 4096 bytes. How is it failing for you? Is an exception raised? It does seem faintly dangerous to explicitly use O_DIRECT when you're wrapping it in a buffered reader that doesn't know it has to read

[issue33214] join method for list and tuple

2019-09-13 Thread Josh Rosenberg
Josh Rosenberg added the comment: Note that all of Serhiy's examples are for a known, fixed number of things to concatenate/union/merge. str.join's API can be used for that by wrapping the arguments in an anonymous tuple/list, but it's more naturally for a variable number of things

[issue38116] Make select module PEP-384 compatible

2019-09-11 Thread Josh Rosenberg
Josh Rosenberg added the comment: Why do you describe these issues (this one, #38069, #38071-#38076, maybe more) as making the module PEP 384 compatible? There is no reason to make the built-in modules stick to the limited API, and it doesn't look like you're doing that in any event (among

[issue38003] Incorrect "fixing" of isinstance tests for basestring

2019-09-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: basestring in Python 2 means "thing that is logically text", because in Python 2, str can mean *either* logical text *or* binary data, and unicode is always logical text. str and unicode can kinda sorta interoperate on Python 2, so it can make sen

[issue38046] Can't use sort_keys in json.dumps with mismatched types

2019-09-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: This is an exact duplicate of #25457. -- nosy: +josh.r resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> json dump fails for mixed-type keys when sort_keys is specified __

[issue23670] Modifications to support iOS as a cross-compilation target

2019-09-03 Thread Josh Rosenberg
Change by Josh Rosenberg : -- title: Restore -> Modifications to support iOS as a cross-compilation target ___ Python tracker <https://bugs.python.org/issu

[issue37976] zip() shadows TypeError raised in __iter__() of source iterable

2019-08-29 Thread Josh Rosenberg
Josh Rosenberg added the comment: Raymond: "Since there isn't much value in reporting which iterable number has failed" Isn't there though? If the error just points to the line with the zip, and the zip is zipping multiple similar things (especially things which won't have a trac

[issue37872] Move statics in Python/import.c to top of the file

2019-08-16 Thread Josh Rosenberg
Change by Josh Rosenberg : -- title: Move statitics in Python/import.c to top of the file -> Move statics in Python/import.c to top of the file ___ Python tracker <https://bugs.python.org/issu

[issue33007] Objects referencing private-mangled names do not roundtrip properly under pickling.

2019-08-15 Thread Josh Rosenberg
Josh Rosenberg added the comment: This problem is specific to private methods AFAICT, since they're the only things which have an unmangled __name__ used to pickle them, but are stored as a mangled name. More details on cause and solution on issue #37852, which I closed as a duplicate

[issue37852] Pickling doesn't work for name-mangled private methods

2019-08-15 Thread Josh Rosenberg
Change by Josh Rosenberg : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Objects referencing private-mangled names do not roundtrip properly under pickling. ___ Python tracker <https://

[issue37852] Pickling doesn't work for name-mangled private methods

2019-08-14 Thread Josh Rosenberg
New submission from Josh Rosenberg : Inspired by this Stack Overflow question, where it prevented using multiprocessing.Pool.map with a private method: https://stackoverflow.com/q/57497370/364696 The __name__ of a private method remains the unmangled form, even though only the mangled form

[issue37831] bool(~True) == True

2019-08-12 Thread Josh Rosenberg
Change by Josh Rosenberg : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> ~True is not False ___ Python tracker <https://bugs.python

[issue37790] subprocess.Popen() is extremely slow

2019-08-07 Thread Josh Rosenberg
Josh Rosenberg added the comment: Have you tried switching to using Popen itself (or run, which keeps it to one layer of convenience wrapping)? subprocess.getstatusoutput is three layers of wrapping (it calls check_output, which in turn calls run, which in turn calls Popen), and (unlike

[issue37774] Micro-optimize vectorcall using PY_LIKELY

2019-08-07 Thread Josh Rosenberg
Josh Rosenberg added the comment: Is the intent to make these macros public? If not, shouldn't they be prefixed with an underscore, like _Py_SIZE_ROUND_DOWN/_Py_SIZE_ROUND_UP in the same header? -- ___ Python tracker <https://bugs.python.

[issue35712] Make NotImplemented unusable in boolean context

2019-08-07 Thread Josh Rosenberg
Josh Rosenberg added the comment: In the docs for my PR, I mention using NotImplemented in a boolean context is deprecated, raising DeprecationWarning, and will raise TypeError in a future version of Python. Serhiy has suggested the end state might be RuntimeWarning instead of TypeError

[issue37774] Micro-optimize vectorcall using PY_LIKELY

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

[issue24413] Inconsistent behavior between set and dict_keys/dict_items: for non-iterable object x, set().__or__(x) returns NotImplemented, but {}.keys().__or__(x) raises TypeError

2019-08-07 Thread Josh Rosenberg
Josh Rosenberg added the comment: To be clear, set().__or__(x) returns NotImplemented, it doesn't raise NotImplementedError. I've edited the title to match. One major problem that gets in the way of a fix is that the interface of set and dict views doesn't match, because dict views only

[issue35786] get_lock() method is not present for Values created using multiprocessing.Manager()

2019-08-07 Thread Josh Rosenberg
Josh Rosenberg added the comment: Reading the docs, I'd definitely expect multiprocessing.Manager().Value to obey the same interface as multiprocessing.Value. The SyncManager docs say: > Its methods create and return Proxy Objects for a number of commonly used > data

[issue37729] gc: stats from multi process are mixed up

2019-07-31 Thread Josh Rosenberg
Josh Rosenberg added the comment: Delaying the write means you don't get an indication of the steps in the process; if someone is trying to debug a crash caused by corruption of the gc list (e.g. due to a bad extension module), deferring the writes means they won't see any output before

[issue35712] Make NotImplemented unusable in boolean context

2019-07-26 Thread Josh Rosenberg
Josh Rosenberg added the comment: Moving to 3.9 target, per Serhiy's request. PR has been rebased against master, including updating the What's New info to be in the 3.9 version, not 3.8. -- versions: +Python 3.9 -Python 3.8 ___ Python tracker

[issue37685] Fix equality checks for some types

2019-07-26 Thread Josh Rosenberg
Josh Rosenberg added the comment: Serhiy: Is there a reason not to use the functools.total_ordering decorator on TimerHandle, so you can get rid of __le__/__ge__/__gt__ rather than fixing them individually? I notice at least one behavioral difference (total_ordering's le/ge methods use

[issue37685] Fix equality checks for some types

2019-07-26 Thread Josh Rosenberg
Josh Rosenberg added the comment: @p-ganssle: Yup. If both sides return NotImplemented, __eq__ and __ne__ return a result based on an identity comparison; all other rich comparisons raise TypeError in that case. Code is here: https://github.com/python/cpython/blob/3.7/Objects/object.c#L679

[issue37648] Fix minor inconsistency in the order of == operands

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

[issue37636] Deprecate slicing and ordering operations on sys.version

2019-07-20 Thread Josh Rosenberg
Josh Rosenberg added the comment: Rolling to 4.0 implies backward incompatible changes; doing just to avoid 3.10 is breaking semantic versioning rules. -- nosy: +josh.r ___ Python tracker <https://bugs.python.org/issue37

[issue36793] Do not define unneeded __str__ equal to __repr__

2019-07-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: Serhiy: Did you plan to do any further work, or can this issue be closed? -- ___ Python tracker <https://bugs.python.org/issue36

[issue37602] nonzero fixer problem

2019-07-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: I suspect these fixers were left out simply because no one expected anyone to call the dunder names directly; the whole point of the dunder names is that they're not used directly, being invoked by syntax/context (__nonzero__ being the first thing tried

[issue37600] os.sched_getaffinity() is missing - module 'os' has no attribute 'sched_getaffinity'

2019-07-15 Thread Josh Rosenberg
Josh Rosenberg added the comment: Per the docs on the function group that includes os.sched_getaffinity ( https://docs.python.org/3/library/os.html#interface-to-the-scheduler ): > These functions control how a process is allocated CPU time by the operating > system. They are only ava

[issue30550] Document order-preserving dictionary output in json

2019-07-11 Thread Josh Rosenberg
Josh Rosenberg added the comment: Is there a reason to document object_pairs_hook=OrderedDict rather than just making the decoder populate a regular dict in an order-preserving way? (No idea if it does this already) -- nosy: +josh.r ___ Python

[issue37568] Misleading UnBoundLocalError on assignment to closure variable

2019-07-11 Thread Josh Rosenberg
Josh Rosenberg added the comment: I'm inclined to close as Not a Bug as well. I'm worried the expanded error message would confuse people when they simply failed to assign a variable, and make them try bad workarounds like adding global/nonlocal when it's not the problem, e.g.: def foo(bar

[issue37267] os.dup() creates an inheritable fd when handling a character file on Windows

2019-07-10 Thread Josh Rosenberg
Josh Rosenberg added the comment: This may have caused a regression, see #37549. -- nosy: +josh.r ___ Python tracker <https://bugs.python.org/issue37

[issue37549] os.dup() fails for standard streams on Windows 7

2019-07-10 Thread Josh Rosenberg
Josh Rosenberg added the comment: This seems likely to have been caused by the fixes for #37267, which fixes an issue with os.dup leaving character streams inheritable (when the documentation specifies that the result must be non-inheritable). The code originally didn't try to make

[issue37340] remove free_list for bound method objects

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

[issue37150] Do not allow to pass FileType class object instead of instance in add_argument

2019-06-04 Thread Josh Rosenberg
Josh Rosenberg added the comment: Ah, right. It doesn't actually validate the mode string (it just stores it for when open is called, assuming open will validate it). So yeah, it silently accepts any string, not just valid mode strings. Not a contractual guarantee or anything, just how

[issue37150] Do not allow to pass FileType class object instead of instance in add_argument

2019-06-04 Thread Josh Rosenberg
Josh Rosenberg added the comment: The docs specify what argparse.FileType() does via the default parameters: https://docs.python.org/3/library/argparse.html#argparse.FileType If you mean what does it do when you fail to call it at all (passing type=argparse.FileType), the answer is the same

[issue37051] Glossary item "hashable" incorrect

2019-05-26 Thread Josh Rosenberg
Josh Rosenberg added the comment: For that matter, slices are immutable built-ins, but they're not hashable (presumably to avoid silently working with dictionaries in a non-slice capacity). -- nosy: +josh.r ___ Python tracker <ht

  1   2   3   4   5   6   7   >