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
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
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
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
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
Changes by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<http://bugs.python.org/issue29971>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<http://bugs.python.org/issue29989>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Change by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<https://bugs.python.org/issue36127>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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:
>>
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
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, **
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
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
Change by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<https://bugs.python.org/issue36187>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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
Change by Josh Rosenberg :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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
Change by Josh Rosenberg :
--
status: open -> pending
___
Python tracker
<https://bugs.python.org/issue36158>
___
___
Python-bugs-list mailing list
Unsubscrib
Change by Josh Rosenberg :
--
status: open -> pending
___
Python tracker
<https://bugs.python.org/issue36172>
___
___
Python-bugs-list mailing list
Unsubscrib
Change by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<https://bugs.python.org/issue33346>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
Change by Josh Rosenberg :
--
title: Add function to complex object -> Support coercion of complex to
float/int
___
Python tracker
<https://bugs.python.org/issu
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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?
-
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
Change by Josh Rosenberg :
--
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue36455>
___
___
Python-bugs-list
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
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
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
Change by Josh Rosenberg :
--
resolution: -> not a bug
stage: -> resolved
status: pending -> closed
___
Python tracker
<https://bugs.python.or
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
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
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
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
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'
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).
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
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
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
Change by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<https://bugs.python.org/issue36424>
___
___
Python-bugs-list mailing list
Unsubscribe:
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.
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
Change by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<https://bugs.python.org/issue36781>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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
Change by Josh Rosenberg :
--
versions: +Python 3.8 -Python 3.7
___
Python tracker
<https://bugs.python.org/issue29842>
___
___
Python-bugs-list mailin
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
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-
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
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
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
Change by Josh Rosenberg :
--
pull_requests: +13082
___
Python tracker
<https://bugs.python.org/issue14156>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
Change by Josh Rosenberg :
--
keywords: +patch
pull_requests: +13106
stage: test needed -> patch review
___
Python tracker
<https://bugs.python.org/issu
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
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
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
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
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
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
Change by Josh Rosenberg :
--
versions: -Python 2.7
___
Python tracker
<https://bugs.python.org/issue32723>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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
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
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
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'
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
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
201 - 300 of 727 matches
Mail list logo