[issue33021] Some fstat() calls do not release the GIL, possibly hanging all threads

2018-03-07 Thread Josh Rosenberg
Josh Rosenberg <shadowranger+pyt...@gmail.com> added the comment: fstat is async signal safe, and I suspect it's thread safe in general, though usage does rely on the file descriptor remaining valid. If the fd in question is closed in another thread after the GIL is released, fstat woul

[issue33004] Shutil module functions could accept Path-like objects

2018-03-05 Thread Josh Rosenberg
Josh Rosenberg <shadowranger+pyt...@gmail.com> added the comment: I think this falls under the umbrella of #30235, which posits that Path-like objects should be supported by shutil (and includes notes on doc validation). -- nosy: +josh.r ___

[issue33002] Making a class formattable as hex/oct integer with printf-style formatting requires both __int__ and __index__ for no good reason

2018-03-05 Thread Josh Rosenberg
Josh Rosenberg <shadowranger+pyt...@gmail.com> added the comment: To be clear, this is a problem with old-style (printf-style) formatting, and applies to both bytes formatting and str formatting. So a class like: class Foo: def __index__(self): return 1 wil

[issue20092] type() constructor should bind __int__ to __index__ when __index__ is defined and __int__ is not

2018-03-05 Thread Josh Rosenberg
Josh Rosenberg <shadowranger+pyt...@gmail.com> added the comment: Pingback from #33002, which is caused by the fact that parts of the CPython code base that use PyNumber_Index for type conversion still pre-check for valid types with PyNumber_Check, meaning that a type with __i

[issue33002] Making a class formattable as hex/oct integer requires both __int__ and __index__ for no good reason

2018-03-05 Thread Josh Rosenberg
Josh Rosenberg <shadowranger+pyt...@gmail.com> added the comment: Note: Obviously, defining __index__ without defining __int__ is a little strange (it's *equivalent* to int, but can't be *coerced* to int?), so yet another fix would be addressing #20092 so it wouldn't be possible for

[issue33002] Making a class formattable as hex/oct integer requires both __int__ and __index__ for no good reason

2018-03-05 Thread Josh Rosenberg
New submission from Josh Rosenberg <shadowranger+pyt...@gmail.com>: In Python 2, making a user-defined class support formatting using the integer-specific type codes required that __int__ be defined and nothing else (that is, '%x' % Foo() only required Foo to provide a __int__

[issue32886] new Boolean ABC in numbers module + Integral>Integer renaming

2018-02-20 Thread Josh Rosenberg
Josh Rosenberg <shadowranger+pyt...@gmail.com> added the comment: First off, link to discussion: https://groups.google.com/d/topic/python-ideas/-3QW3cxj3ko/discussion 1. bool is already a virtual subclass of Integral since it's an actual subclass of int (which is a virtual su

[issue20632] Define a new __key__ protocol

2018-02-12 Thread Josh Rosenberg
Josh Rosenberg <shadowranger+pyt...@gmail.com> added the comment: Ah, never mind. Looks like dataclasses.InitVar fields seem to be the answer to excluding a field from the auto-generated methods. -- ___ Python tracker <rep...@bugs.python.or

[issue20632] Define a new __key__ protocol

2018-02-12 Thread Josh Rosenberg
Josh Rosenberg <shadowranger+pyt...@gmail.com> 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 nec

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

2018-02-12 Thread Josh Rosenberg
Josh Rosenberg <shadowranger+pyt...@gmail.com> 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. -

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

2018-02-06 Thread Josh Rosenberg
Josh Rosenberg <shadowranger+pyt...@gmail.com> 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

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

2018-02-03 Thread Josh Rosenberg
Josh Rosenberg <shadowranger+pyt...@gmail.com> 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

[issue31356] Add context manager to temporarily disable GC

2018-01-31 Thread Josh Rosenberg
Josh Rosenberg <shadowranger+pyt...@gmail.com> 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

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

2018-01-30 Thread Josh Rosenberg
Change by Josh Rosenberg <shadowranger+pyt...@gmail.com>: -- title: Can no longer specify OpenSLL locations with CPPFLAGS / LDFLAGS ? -> Can no longer specify OpenSSL locations with CPPFLAGS / LDFLAGS ? ___ Python tracker <rep...@bug

[issue32387] Disallow untagged C extension import on major platforms

2018-01-30 Thread Josh Rosenberg
Josh Rosenberg <shadowranger+pyt...@gmail.com> 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 d

[issue32723] codecs.open silently ignores argument errors

2018-01-30 Thread Josh Rosenberg
Change by Josh Rosenberg <shadowranger+pyt...@gmail.com>: -- versions: -Python 2.7 ___ Python tracker <rep...@bugs.python.org> <https://bugs.python

[issue32723] codecs.open silently ignores argument errors

2018-01-30 Thread Josh Rosenberg
Josh Rosenberg <shadowranger+pyt...@gmail.com> 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 (

[issue32723] codecs.open silently ignores argument errors

2018-01-30 Thread Josh Rosenberg
Josh Rosenberg <shadowranger+pyt...@gmail.com> 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 Py

[issue32723] codecs.open silently ignores argument errors

2018-01-29 Thread Josh Rosenberg
Josh Rosenberg <shadowranger+pyt...@gmail.com> 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

[issue29943] PySlice_GetIndicesEx change broke ABI in 3.5 and 3.6 branches

2017-09-27 Thread Josh Rosenberg
Change by Josh Rosenberg <shadowranger+pyt...@gmail.com>: -- nosy: +josh.r ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue29943> ___

[issue31475] Bug in argparse - not supporting utf8

2017-09-25 Thread Josh Rosenberg
Josh Rosenberg added the comment: Based on the OP's patch, it looks like they have a problem where they have non-ASCII text in their output strings (either due to using non-ASCII switches, or using non-ASCII help documentation), but sys.stdout/sys.stderr are configured for some encoding

[issue31513] Document structure of memo dictionary to enable more advanced __deepcopy__ uses

2017-09-18 Thread Josh Rosenberg
New submission from Josh Rosenberg: At present, the documentation for the copy module doesn't document anything about the memo dictionary for deepcopy except to say that it must be received by custom __deepcopy__ methods and passed along when calling copy.deepcopy

[issue31356] Add context manager to temporarily disable GC

2017-09-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: I'd be -1 on this without a demonstrated broad need for this in at least some context outside of microbenchmarking utilities (which presumably have already implemented similar stuff). If a minimum bar for applicability isn't applied, we'll end up with dozens

[issue28638] Optimize namedtuple creation

2017-09-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: Side-note: Some of the objections to a C level namedtuple implementation appear to be based on the maintenance hurdle, and other have noted that a structseq-based namedtuple might be an option. I have previously attempted to write a C replacement

[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 value

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

2017-05-14 Thread Josh Rosenberg
Changes by Josh Rosenberg <shadowranger+pyt...@gmail.com>: -- title: getpass.getpass() does not except stdin from an Expect script -> getpass.getpass() does not accept stdin from an Expect script ___ Python tracker <rep...@bugs.pytho

[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 <rep...@bugs.python.org> <http://bugs.python.org/i

[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: +josh.r

[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

[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

[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

[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 wouldn't

[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'd

[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 apply here

[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

[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 use that width

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

2017-04-06 Thread Josh Rosenberg
Changes by Josh Rosenberg <shadowranger+pyt...@gmail.com>: -- nosy: +josh.r ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29989> ___

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

2017-04-03 Thread Josh Rosenberg
Changes by Josh Rosenberg <shadowranger+pyt...@gmail.com>: -- nosy: +josh.r ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29971> ___

[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 <

[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

[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 plain function.

[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. It

[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

[issue28767] Readd __index__ support on ipaddress objects

2017-03-21 Thread Josh Rosenberg
Josh Rosenberg added the comment: >From the original bugs, it looks like people liked being able to directly >produce the hex of the IP addresses using hex(). I'll admit I'm only +0.5 on >restoring __index__; having them be equivalent to int, not just convertable, >doesn't seem

[issue29871] Enable optimized locks on Windows

2017-03-21 Thread Josh Rosenberg
Josh Rosenberg added the comment: Note: Beyond turning on the new primitives by default, I also made a change to PyCOND_TIMEDWAIT. The original code looked wrong, in that: 1. It assumed that when SleepConditionVariableSRW returned non-zero, you didn't know if the wait had timed out or not, so

[issue29871] Enable optimized locks on Windows

2017-03-21 Thread Josh Rosenberg
Changes by Josh Rosenberg <shadowranger+pyt...@gmail.com>: -- pull_requests: +670 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue29871] Enable optimized locks on Windows

2017-03-21 Thread Josh Rosenberg
New submission from Josh Rosenberg: Kristjan wrote improved locking primitives in #15038 that use the new (in Vista) SRWLock and Condition Variable APIs. SRWLocks (used in exclusive mode only) replace Critical Sections, which is slower than SRWLock and provides no features we use that might

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

2017-03-19 Thread Josh Rosenberg
Changes by Josh Rosenberg <shadowranger+pyt...@gmail.com>: -- title: Executor.map should not submit all futures prior to yielding any results -> Make Executor.map work with infinite/large inputs correctly ___ Python tracker <rep...@bug

[issue29842] Executor.map should not submit all futures prior to yielding any results

2017-03-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: Nosying folks suggested by GitHub, hope that's the right etiquette. For the record, filled out contributor agreement ages ago, but hadn't linked (or even created) GitHub account until after I got the warning. I've linked this account to my GitHub username now

[issue29842] Executor.map should not submit all futures prior to yielding any results

2017-03-17 Thread Josh Rosenberg
New submission from Josh Rosenberg: As currently implemented, Executor.map is not particularly lazy. Specifically, if given huge argument iterables, it will not begin yielding results until all tasks have been submitted; if given an infinite input iterable, it will run out of memory before

[issue29831] os.path.exists seems can not recgnize "~"

2017-03-16 Thread Josh Rosenberg
Josh Rosenberg added the comment: That's because os.system is executing the command in a shell (which expands ~). Without shell support, ~ doesn't mean anything unless used with the APIs that specifically support it (e.g. os.path.expanduser). You wanted os.path.exists(os.path.expanduser

[issue29800] functools.partial segfaults in repr when keywords attribute is abused

2017-03-13 Thread Josh Rosenberg
Josh Rosenberg added the comment: I feel like adding a type check to partial_repr might not be the correct fix here. If PyUnicode_FromFormat returned NULL and set an exception here, then the existing code would work as written (raising an exception, but not segfaulting). Alternatively

[issue29752] Enum._missing_ not called for __getattr__ failures

2017-03-09 Thread Josh Rosenberg
Josh Rosenberg added the comment: Yeah, that sounds fine. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29752> ___ ___ Pyth

[issue29762] Use "raise from None"

2017-03-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: Particularly when the type of the exception isn't being changed, it's only altering the message to provide more information? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue29762] Use "raise from None"

2017-03-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: To tie the exceptions to the actual line, would it perhaps make sense to copy over the traceback of the original exception using .with_traceback? -- nosy: +josh.r ___ Python tracker <rep...@bugs.python.org>

[issue29756] Improve documentation for list methods that compare items by equality

2017-03-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: Steven: Technically, in CPython, they use both identity and equality testing, as a function of using RichCompareBool (which tests identity first, then equality), rather than RichCompare (which only tests equality). It makes a difference for stuff like NaN

[issue29752] Enum._missing_ not called for __getattr__ failures

2017-03-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: Could that perhaps be intentional? Attribute access seems like something where the developer would be explicitly naming a single, hard coded, canonical name for the type, while string construction seems like something where you're getting a string from

[issue23267] multiprocessing pool.py doesn't close inqueue and outqueue pipes on termination

2017-03-07 Thread Josh Rosenberg
Changes by Josh Rosenberg <shadowranger+pyt...@gmail.com>: -- nosy: +josh.r ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23267> ___

[issue27151] multiprocessing.Process leaves read pipes open (Process.sentinel)

2017-03-07 Thread Josh Rosenberg
Changes by Josh Rosenberg <shadowranger+pyt...@gmail.com>: -- nosy: +josh.r ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27151> ___

[issue13566] Increase pickle compatibility

2017-03-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: Right, but Antoine's objection is that suddenly strs pickled in Py3 can end up as strs in Py2, rather than unicode. If the library enforces a Py3-like type separation on Py2 (text arguments are unicode only, binary data is str only), then you have the problem

[issue29733] concurrent.futures as_completed raise TimeoutError wrong

2017-03-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: The docs ( https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.as_completed ) do seem to indicate it shouldn't do so as long as results were available before the timeout expired: "The returned iterator r

[issue29518] 'for' loop not automatically breaking (index error on line of loop header)

2017-02-09 Thread Josh Rosenberg
Josh Rosenberg added the comment: You're going to need to actually provide the source file here. This makes no sense as is. -- nosy: +josh.r ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue29423] using concurrent.futures.ProcessPoolExecutor in class giving 'TypeError: can't pickle _thread.RLock objects' in 3.6, but not 3.5

2017-02-02 Thread Josh Rosenberg
Josh Rosenberg added the comment: Looks like the problem here is that pickling self._consume implicitly pickles self, and after the first submission, self._futures contains Future objects. Those are probably what have the RLock in them (to synchronize between reading and populating threads

[issue29358] Add tp_fastnew and tp_fastinit to PyTypeObject, 15-20% faster object instanciation

2017-01-24 Thread Josh Rosenberg
Josh Rosenberg added the comment: So just to be clear, the issue with non-string or non-unique keywords is purely about performance, right, not correctness/non-crashiness? Non-string keywords, while technically accepted by CPython, are at best barely legal by the language standard

[issue29352] provide the authorative source for s[i:j] negative slice indices (<-len(s)) behavior for standard sequences

2017-01-24 Thread Josh Rosenberg
Josh Rosenberg added the comment: I think the wording could be improved, but there is another option I wanted to put here. Right now, we're being overly detailed about the implementation, specifying the bounds substitutions performed. If we're just trying to describe logical behavior, we

[issue29331] Simplify argument parsing in sorted() and list.sort()

2017-01-20 Thread Josh Rosenberg
Changes by Josh Rosenberg <shadowranger+pyt...@gmail.com>: -- nosy: +josh.r ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29331> ___

[issue29293] Missing parameter "n" on multiprocessing.Condition.notify()

2017-01-18 Thread Josh Rosenberg
Josh Rosenberg added the comment: Looks like, despite what the multiprocessing.Condition docs say (claiming it's an alias for threading.Condition), at least in Python 3.5, it's a completely separate animal from multiprocessing.synchronize, and the notify method on it doesn't take any

[issue29061] secrets.randbelow(-1) hangs

2016-12-27 Thread Josh Rosenberg
Josh Rosenberg added the comment: SystemRandom._randbelow has this problem, perhaps it should be fixed there, not in one of many possible wrappers for it? -- nosy: +josh.r ___ Python tracker <rep...@bugs.python.org> <http://bugs.p

[issue29055] random.choice on empty sequence should hide previous exception [patch]

2016-12-23 Thread Josh Rosenberg
Josh Rosenberg added the comment: Seems reasonable to me. -- nosy: +josh.r ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29055> ___ __

[issue29049] Lazy GC tracking frame

2016-12-22 Thread Josh Rosenberg
Changes by Josh Rosenberg <shadowranger+pyt...@gmail.com>: -- nosy: +josh.r ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29049> ___

[issue28982] multiprocessing.Queue.get(block=True, timeout=0) always raises queue.Empty

2016-12-15 Thread Josh Rosenberg
Josh Rosenberg added the comment: That argument combination appears to be undefined in the docs, the only cases covered are: block truthy, timeout is None block truthy, timeout is positive block falsy, (timeout unspecified) The case of block truthy, timeout <= 0 is not documented. Say

[issue28969] lru_cache is not threadsafe

2016-12-15 Thread Josh Rosenberg
Changes by Josh Rosenberg <shadowranger+pyt...@gmail.com>: -- nosy: +josh.r ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28969> ___

[issue28984] json.dump + indent creates trailing extra spaces

2016-12-15 Thread Josh Rosenberg
Josh Rosenberg added the comment: This is documented behavior for Python 2 ( https://docs.python.org/2/library/json.html#basic-usage ): >Note: Since the default item separator is ', ', the output might include >trailing whitespace when indent is specified. You can use sepa

[issue28944] A lack of line 6

2016-12-13 Thread Josh Rosenberg
Changes by Josh Rosenberg <shadowranger+pyt...@gmail.com>: -- nosy: -josh.r ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue28962] Crash when throwing an exception with a malicious __hash__ override

2016-12-13 Thread Josh Rosenberg
Josh Rosenberg added the comment: Is this something that needs to be defended against? My understanding is that it's pretty easy to segfault CPython in a number of ways if you can execute 100% arbitrary code. The only way to cause this problem is if you can define malicious exceptions

[issue28944] A lack of line 6

2016-12-12 Thread Josh Rosenberg
Josh Rosenberg added the comment: You're reusing the same issue for completely different things. Make a separate issue for separate docs issues. -- nosy: +josh.r ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue28882] RFC: Slice confusing with negative strides and the 0th element.

2016-12-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: I find this report nigh incomprehensible, but I will admit that I can't seem to find any good explanations of the extended slicing rules in the Python docs. The tutorial covers slicing, but, AFAICT, it never mentions extended slicing at all, not in 3.1.2

[issue28864] Add devnull file-like object

2016-12-05 Thread Josh Rosenberg
Josh Rosenberg added the comment: Didn't pre-opened (or lazily opened) file descriptors cause headaches with os.urandom? I'm not sure I'd want my programming environment eating file descriptors "just in case", even if it might make certain tasks trivially faster aft

[issue26861] shutil.copyfile() doesn't close the opened files

2016-12-02 Thread Josh Rosenberg
Josh Rosenberg added the comment: You're going to need to provide a real repro; your description is effectively useless. For the record, Python is not precisely pass by reference (it's roughly equivalent to passing a pointer in C, binding the local name to the same pointer, so if you reassign

[issue28839] _PyFunction_FastCallDict(): replace PyTuple_New() with PyMem_Malloc()

2016-11-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: Minor correction: No allocation when small stack used, so you'd only see (possibly) regressions with 6+ keyword arguments (assuming the tuple free list applies for tuples that large). Admittedly a minor concern; keyword processing is already pretty slow

[issue28839] _PyFunction_FastCallDict(): replace PyTuple_New() with PyMem_Malloc()

2016-11-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: Given you can't avoid the refcounting overhead, how much does this really help? Are there meaningful benefits in microbenchmarks? I'd worry that unconditional allocation from PyMem_Malloc might lose out relative to PyTuple_New, which is likely to not involve

[issue28842] PyInstanceMethod_Type isn't hashable

2016-11-30 Thread Josh Rosenberg
Josh Rosenberg added the comment: Note: It's a little strange that instancemethod as a type sticks around even though literally nothing in Python uses it. Is there some reason we kept it in the 3.x transition? Extension types are using it, so I guess we can't drop it now, but I'm trying

[issue26861] shutil.copyfile() doesn't close the opened files

2016-11-29 Thread Josh Rosenberg
Josh Rosenberg added the comment: Agreed. 2.7 source is definitely using with: https://hg.python.org/cpython/file/2.7/Lib/shutil.py#l82 -- nosy: +josh.r status: pending -> open ___ Python tracker <rep...@bugs.python.org> <http://bug

[issue28820] Typo in section 6 of the Python 3.4 documentation

2016-11-29 Thread Josh Rosenberg
Josh Rosenberg added the comment: Just OOC, what version of English are the docs supposed to use? In American English, noun vs. verb doesn't matter, it's always "practice" (there is no such word as "practise"). In this case it doesn't matter (it's a noun, and everyone agr

[issue28818] simplify lookdict functions

2016-11-28 Thread Josh Rosenberg
Changes by Josh Rosenberg <shadowranger+pyt...@gmail.com>: -- nosy: +josh.r ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28818> ___

[issue28767] Readd __index__ support on ipaddress objects

2016-11-21 Thread Josh Rosenberg
New submission from Josh Rosenberg: It looks like, due to #16722, in #15559, __index__ was removed from ipaddress objects. #16722 was fixed a few months later, but the comments asking for it to be readded were put on a closed issue, so no one noticed. Can __index__ support be readded now

[issue28745] Python 3.5.2 "from ... import" statement is different from official documentation

2016-11-18 Thread Josh Rosenberg
Josh Rosenberg added the comment: Why is this unexpected? Per the docs, the process is: find the module specified in the from clause, loading and initializing it if necessary; for each of the identifiers specified in the import clauses: check if the imported module has

[issue28718] '*' matches entire path in fnmatch.translate

2016-11-16 Thread Josh Rosenberg
Josh Rosenberg added the comment: Oops, altsep is None, not the empty string when there is only one separator. And I didn't handle inverting the match. Sigh. You get the idea. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.p

[issue28718] '*' matches entire path in fnmatch.translate

2016-11-16 Thread Josh Rosenberg
Josh Rosenberg added the comment: Presumably something like: r'(?:' + r'|'.join({re.escape(os.path.sep), re.escape(os.path.altsep)}) + r')' would cover it completely. I switched to using non-capturing groups over a character class both to deal with the fact that escaping doesn't work the same

[issue28716] Fractions instantiation revisited

2016-11-16 Thread Josh Rosenberg
Josh Rosenberg added the comment: Similarly, type checking for int might be replaced with calling operator.index on the input and handling the TypeError; that way, anything that has declared itself logically int-like is handled without explicit type checking at all

[issue28716] Fractions instantiation revisited

2016-11-16 Thread Josh Rosenberg
Josh Rosenberg added the comment: Might it make sense to make instantiation from numbers.Rational duck typing based as well? Just try to get the numerator and denominator attributes, on AttributeError, skip it and move on. Unless there is some concern that a non-Rational type might have both

[issue28709] PyStructSequence_NewType is broken; makes GC type without setting Py_TPFLAGS_HEAPTYPE

2016-11-15 Thread Josh Rosenberg
Changes by Josh Rosenberg <shadowranger+pyt...@gmail.com>: -- type: -> crash ___ Python tracker <rep...@bugs.python.org> <http://bugs.pyt

[issue28709] PyStructSequence_NewType is broken; makes GC type without setting Py_TPFLAGS_HEAPTYPE

2016-11-15 Thread Josh Rosenberg
Josh Rosenberg added the comment: On further checking, looks like there is a lot of work that should be done to initialize heap types (see PyType_FromSpecWithBases) that PyStructSequeuence_Init2 doesn't do (because it thinks it's working on a static type). I think the solution here

[issue28709] PyStructSequence_NewType is broken; makes GC type without setting Py_TPFLAGS_HEAPTYPE

2016-11-15 Thread Josh Rosenberg
Josh Rosenberg added the comment: Note: Uncommenting the line that forces Py_TPFLAGS_HEAPTYPE isn't enough, since it looks like the PyHeapTypeObject fields aren't initialized properly, causing seg faults if you access, for example, __name__/__qualname__ (or print the type's repr, which

[issue28709] PyStructSequence_NewType is broken; makes GC type without setting Py_TPFLAGS_HEAPTYPE

2016-11-15 Thread Josh Rosenberg
Changes by Josh Rosenberg <shadowranger+pyt...@gmail.com>: -- title: PyStructSequence_NewType is broken -> PyStructSequence_NewType is broken; makes GC type without setting Py_TPFLAGS_HEAPTYPE ___ Python tracker <rep...@bugs.pytho

[issue28709] PyStructSequence_NewType is broken

2016-11-15 Thread Josh Rosenberg
New submission from Josh Rosenberg: I could be missing something, but it looks like PyStructSequence_NewType is guaranteed broken. Specifically, it allocates the memory with PyType_GenericAlloc (use PyType_Type as the base), and PyType declares itself to have garbage collected instances, so

[issue28709] PyStructSequence_NewType is broken

2016-11-15 Thread Josh Rosenberg
Changes by Josh Rosenberg <shadowranger+pyt...@gmail.com>: Added file: http://bugs.python.org/file45496/setup.py ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue24379] Add operator.subscript as a convenience for creating slices

2016-11-09 Thread Josh Rosenberg
Josh Rosenberg added the comment: #28651 opened for the general problem with empty __slots__ and gc failures. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue28649] refleak in typing.py

2016-11-09 Thread Josh Rosenberg
Josh Rosenberg added the comment: Serhiy: I think you forgot to make a global instance of the type for your demonstration. You mentioned in msg253899 that the loop is: global instance -> type -> method -> module globals -> global instance The example you gave doesn't insta

[issue28584] ICC compiler check is too permissive

2016-11-04 Thread Josh Rosenberg
Josh Rosenberg added the comment: It's probably bad form, but I've seen people set CC to name/path to compiler followed by switches, e.g.: export CC='gcc -march=native -O3' or the like (usually because they want to keep the build tool's default CFLAGS, and setting CFLAGS causes them

<    1   2   3   4   5   6   7   8   >