Josh Rosenberg added the comment:
Apparently similar issue occurs when tarfile assumes a GzipFile can have its
fileno() fstat-ed (see #22468). An awful lot of libraries seem to assume that
fileno() will provide useful information about the data you'd read from the
file-like object itself
Josh Rosenberg added the comment:
Blech, typo earlier "since they produce the *compressed* data (likely useless)
when read as subprocess stdin". Context should make it obvious, but trying to
be clear.
--
___
Python tracker
<http://bu
Changes by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<http://bugs.python.org/issue24379>
___
___
Python-bugs-list mailing list
Unsubscribe:
Josh Rosenberg added the comment:
Obvious possibility: input.csv is empty, so the loop never executes. You could
always add prints within the loop as well, so you know it actually read
something.
--
nosy: +josh.r
___
Python tracker
<h
Josh Rosenberg added the comment:
Shouldn't it also disable the relevant fixers for map, filter, zip, etc. as
appropriate? Otherwise a whole bunch of calls will be wrapper in list() or the
like to mimic a behavior the code never had in Py2 in the first place.
--
nosy: +j
Josh Rosenberg added the comment:
Ah, my mistake. Apologies.
--
___
Python tracker
<http://bugs.python.org/issue19111>
___
___
Python-bugs-list mailing list
Unsub
Josh Rosenberg added the comment:
Neither of those example should work (and neither do on my 3.4.0 installation).
Heaps must have sortable components; you could only include callables (which
are not sortable) in the tuples being sorted if you guarantee that some
element(s) before the callable
Josh Rosenberg added the comment:
You're correct about what is going on; aside from bypassing a bounds check
(when not compiled with asserts enabled), the function it uses to get each
index is the same as that used to implement indexing at the Python layer. It
looks up the getitem fun
Josh Rosenberg added the comment:
So this has sign off on Python ideas, and it's not fundamentally changing the
language (it's implemented in pure Python after all), it's passed a dozen code
reviews. Can someone with commit privileges just finish
Changes by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<http://bugs.python.org/issue24305>
___
___
Python-bugs-list mailing list
Unsubscribe:
Josh Rosenberg added the comment:
It looks like between 3.4.3 and 3.5, datetime_best_possible changed from using
_PyTime_gettimeofday with a _PyTime_timeval to using _PyTime_AsTimeval with
struct timeval. The difference is that _PyTime_timeval appears to have been
defined with a proper time_t
Josh Rosenberg added the comment:
Agreed. Having a named positional varargs argument makes subsequently defined
arguments keyword only automatically.
--
nosy: +josh.r
___
Python tracker
<http://bugs.python.org/issue25
Josh Rosenberg added the comment:
The example for Parsing an element with a few attributes and a title:" in
https://docs.python.org/2/library/htmlparser.html#examples demonstrates this as
expected behavior, so I'm not sure it can be changed:
>>> parser.feed(
New submission from Josh Rosenberg:
In weakref.finalize's documentation (
https://docs.python.org/3/library/weakref.html#weakref.finalize ), it says:
"A finalizer will never invoke its callback during the later part of the
interpreter shutdown when module globals are liable to
Josh Rosenberg added the comment:
I actually have a patch (still requires a little cleanup) that makes
translations for non-ASCII and 1-n translations substantially faster. I've been
delaying posting it largely because it makes significant changes to
str.maketrans so it returns a sp
Josh Rosenberg added the comment:
Is there a reason ipython's import completer couldn't be borrowed in its
entirety? At work, I use a lightly adapted version of the code from ipython to
do completion when I'm using the plain interactive interpreter (for whatever
reason), an
Josh Rosenberg added the comment:
Also crashes in 3.5.0 (on Windows 7, with 64 bit build).
--
nosy: +josh.r
___
Python tracker
<http://bugs.python.org/issue25
Josh Rosenberg added the comment:
Do you have any benchmarks on the before and after? I strongly suspect that
moving from float to Fraction-based ratios is going to kill performance in the
common case, particularly for longer input sequences, but that's a hunch only.
--
nosy: +j
Josh Rosenberg added the comment:
Does this introduce a slowdown when the type doesn't match? That is, clearly
George's example:
try:
{}["a"]
except KeyError:
pass
won't be slowed because the fast path will get an immediate hit. But wha
Josh Rosenberg added the comment:
This looks like a duplicate of #12029. The delays on addressing that bug seem
to indicate that initially there was a fairly substantial performance cost for
all exception handling paths when ABC friendly checking was performed, but that
was at least partially
Josh Rosenberg added the comment:
On rereading #22540, maybe that won't be an issue (in the common case where no
custom metaclasses are used for the exceptions to be caught, it looks like
maybe there is no slow path to traverse?). Still worth double che
Josh Rosenberg added the comment:
Checking the source (
https://hg.python.org/cpython/file/tip/Python/structmember.c#l51 ), it calls
PyUnicodeFromString (
https://docs.python.org/3/c-api/unicode.html?highlight=pyunicode_fromstring#c.PyUnicode_FromString
), so it's always interpreted as
Josh Rosenberg added the comment:
Patch doesn't let me comment, but I believe to be strictly standards
conformant, sigwinch_received should be declared as a `volatile sig_atomic_t`,
not `char`. See:
https://www.securecoding.cert.org/confluence/display/c/SIG31-C.+Do+not+access+shared+ob
Josh Rosenberg added the comment:
The Python 2 sort order is a result of the "arbitrary but consistent fallback
comparison" (omitting details, it's comparing the names of the types), thus the
"strange" sort order. Python 3 (justifiably) said that incomparable type
Josh Rosenberg added the comment:
As a workaround (should you absolutely need to sort keys by some arbitrary
criteria), you can initialize a collections.OrderedDict from the sorted items
of your original dict (using whatever key function you like), then dump without
using sort_keys=True. For
Josh Rosenberg added the comment:
Oops, minor flaw with that. It's str-ifying the tuples, not the keys, which
could (in some cases) cause issues with keys whose reprs have different
quoting. So you'd end up with lambdas. Boo. Anyway, corrected version (which
would probably not be on
Josh Rosenberg added the comment:
Okay, sorry for repeated nitpicks, but I think you can keep the visibility of
sigwinch_received as static like it was as char (to avoid having it be exported
for potential use by other modules, though it won't gain any optimization
benefits of static,
Josh Rosenberg added the comment:
Counter is documented as being primarily intended for integer counts. While you
can use them with floats, I'm not sure they're the right data type for this use
case. Having some methods that only make sense with floats, and others (like
elements)
Josh Rosenberg added the comment:
I could see the argument for this to make methodcaller more like an unbound
version of functools.partial. Partial lets you prebind some things and not
others, you might want to do the same thing with methods, where you prebind the
method name and some
Josh Rosenberg added the comment:
Adding interested parties from earlier ticket.
--
nosy: +josh.r, martin.panter, r.david.murray
___
Python tracker
<http://bugs.python.org/issue25
Josh Rosenberg added the comment:
Martin: I think the primary reason I suggested an empty __slots__ was to avoid
people doing dumb stuff like attaching attributes to the singleton, and then
getting annoyed if support for them was removed in some future release (e.g. if
this ever moved to C
Josh Rosenberg added the comment:
You used explicit control flow keywords and you're surprised that it listened?
Regardless, this is already documented
https://docs.python.org/3/reference/compound_stmts.html#finally :
"If the finally clause executes a return or break statement,
Josh Rosenberg added the comment:
A utility like this seems like it would belong in `itertools`, not
`collections`. It should also ideally avoid fully realizing the sequence so it
could work with iterators/generators as well; PySequence_Fast will force
creation of a `list`/`tuple` of the
Josh Rosenberg added the comment:
Aho Corasick doesn't seem likely to be useful here; it's good if the haystack
is huge (or you have many haystacks to search) and you have many needles to
look for (and the needles never change), but it pays a fairly steep setup cost;
for a ut
Josh Rosenberg added the comment:
Heck, with the addition of additional unpacking generalizations in 3.5, you can
make an empty set even without a comprehension: {*()}
Not really recommending the "one-eyed monkey operator", but the addition of
unpacking generalizations undoes seve
Josh Rosenberg added the comment:
The docstring doesn't give details, but many docstrings don't. The docs
themselves do; not sure it's a good idea to expand every docstring into
complete documentation; if you don't know the function you read the real docs,
the docstr
Josh Rosenberg added the comment:
So would the goal of a fix be something like dev/inode memoization to prevent
traversing the same link twice? To provide an argument to prevent following
symlinks at all (as in stuff like os.walk), possibly defaulting to
followlinks=False? It looks like
Josh Rosenberg added the comment:
Given that lru_cache uses the cache dict in very specific ways, supporting
arbitrary mapping types would be extremely hard. Among other things:
1. The C code uses the concrete dict APIs (including private APIs) that would
not work on arbitrary mappings that
New submission from Josh Rosenberg:
Minor bug introduced while implementing the fix for #7830:
In the case where functools.partial is wrapping another functools.partial
instance, both of them providing positional arguments, the value nargs is not
freed when the tuple concatenation fails and
Changes by Josh Rosenberg :
--
type: -> enhancement
___
Python tracker
<http://bugs.python.org/issue26166>
___
___
Python-bugs-list mailing list
Unsubscrib
New submission from Josh Rosenberg:
zlib.compressobj and zlib.decompressobj objects (actually zlib.Compress and
zlib.Decompress, the other names are the function constructors I guess?) have a
.copy() method, but don't implement `__copy__` or `__deepcopy__`. This leads to
the mildly
New submission from Josh Rosenberg:
copy.copy uses a relatively high overhead approach to copying list, set and
dict, using:
def _copy_with_constructor(x):
return type(x)(x)
This is despite the fact that all three types implement a .copy() method, and
there is already a defined
Josh Rosenberg added the comment:
Oops. Sorry. I swear I searched, but I can't figure out how I missed the
obvious duplicate there.
--
___
Python tracker
<http://bugs.python.org/is
Josh Rosenberg added the comment:
Patch looks good, but incomplete. Supporting __deepcopy__ (as a simple wrapper
around __copy__ that ignores the second argument) would provide complete
support.
Also, should there be tests? I mean, I assume the .copy() method itself is
tested, but just to
Changes by Josh Rosenberg :
--
title: Improve copy.copy speed for built-in types -> Improve copy.copy speed
for built-in types (list/set/dict)
___
Python tracker
<http://bugs.python.org/issu
Changes by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<http://bugs.python.org/issue26168>
___
___
Python-bugs-list mailing list
Unsubscribe:
Josh Rosenberg added the comment:
Good point. Though I don't see any attached patches...
--
___
Python tracker
<http://bugs.python.org/issue26167>
___
___
Josh Rosenberg added the comment:
I agree with Tim that arbitrarily deciding that insert should behave more like
appendleft is surprising. This really feels like guessing at what the user
wants, silently doing something that really isn't predictable.
Any of the following seem nicer
Josh Rosenberg added the comment:
It seems odd to have a slice of a deque return a list. Are there any other
examples of non-buffer protocol objects behaving like this in the standard
library/built-ins? Only examples I can come up with are mmap objects and ctypes
arrays (which are making raw
Josh Rosenberg added the comment:
Overallocating by 50% might be overkill here; I wouldn't imagine most users of
epoll.poll would use anything but:
1. Limit to 1 event
2. Limit to some constant K events
3. Use default maxevents (FD_SETSIZE - 1)
Even if called in pathological order, that
Josh Rosenberg added the comment:
Just FYI, if you're only trying to make immutable objects, that's what
subclassing tuple with properties and __slots__ = () is for
(collections.namedtuple does exactly this, building the Python declaration as a
string and then eval-ing it to produ
Josh Rosenberg added the comment:
Presumably it would involve using private set APIs to make this work, right?
Since normally you can't look up the actual value in a set, just check for
existence?
--
nosy: +josh.r
___
Python tracker
Josh Rosenberg added the comment:
Adding a ResourceWarning even if the generator is run to completion? That
seems... dev hostile. I mean, yes, probably best to document it as best
practice to use with with statement, but something simple like `files =
sorted(os.scandir('.'), ke
New submission from Josh Rosenberg:
Don't know when the problem was introduced, but dictviews_sub is doing:
tmp = _PyObject_CallMethodId(result, &PyId_difference_update, "O", other);
to implement subtraction (after creating result as a set of the keys in
question). T
Changes by Josh Rosenberg :
--
components: +Interpreter Core
___
Python tracker
<http://bugs.python.org/issue26478>
___
___
Python-bugs-list mailing list
Unsub
Josh Rosenberg added the comment:
It's not exactly what was asked for, but it's actually better (in that the
__ne__ default implementation handles NotImplemented correctly). Per the docs
at https://docs.python.org/3/reference/datamodel.html#object.__eq__ :
"By default, __ne__
Josh Rosenberg added the comment:
Per the docs ( https://docs.python.org/3/library/threading.html#rlock-objects ):
"To unlock the lock, a thread calls its release() method. acquire()/release()
call pairs may be nested; only the final release() (the release() of the
outermost pair) reset
New submission from Josh Rosenberg:
Unclear if this is just unclear docs, or incorrect behavior.
Per this Stack Overflow question (
https://stackoverflow.com/questions/36191447/why-doesnt-the-daemon-program-exit-without-join
), you get some rather odd behavior when you have both daemon and
Josh Rosenberg added the comment:
Oops, left the info log in my replacement code for the non-daemon case outside
the if not daemon: block; it should be inside (since it's not joining the
daemon threads).
--
___
Python tracker
Changes by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<http://bugs.python.org/issue26647>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Josh Rosenberg:
According to a note on the pickle docs (
https://docs.python.org/3/library/pickle.html#object.__getstate__ ): "If
__getstate__() returns a false value, the __setstate__() method will not be
called upon unpickling."
The phrasing is a little
Josh Rosenberg added the comment:
You used the `fileno` based initialization in the child, which creates a
wrapper around the same file descriptor without duplicating it, so when the
first socket disappears, that file descriptor becomes invalid.
I think this is a doc bug more than a behavior
Josh Rosenberg added the comment:
For source reference, the behavior for this case is to just copy out the file
descriptor and stick it in a new socket object (
https://hg.python.org/cpython/file/3.5/Modules/socketmodule.c#l4289 ); no work
is being done to somehow collaboratively manage the
Josh Rosenberg added the comment:
This already behaves usefully in 3.5 where reading fieldnames from a DictReader
wrapping a file opened in binary mode gets you:
_csv.Error: iterator should return strings, not bytes (did you open the file in
text mode?)
And 2.7 is highly unlikely to make fit
Josh Rosenberg added the comment:
LGTM. Had to check the definition of PyDescr_IsData to determine that checking
the value from tp_descr_set for NULL was exactly what that macro does, but
yeah, it looks like the first test was redundant, and f is never assigned
outside that block, so the
New submission from Josh Rosenberg:
Right now, in typeobject.c, the call_method and call_maybe utility functions
have a fast path for no argument methods, where a NULL or "" format string just
calls PyTuple_New(0) directly instead of wasting time parsing Py_VaBuildValue.
Problem i
Josh Rosenberg added the comment:
BTW, for a realistic use case that would be sped up by this patch (possibly a
lot), consider a recursive function that is continually doing a "virtual" pop
of the first argument, and receiving the rest as varargs, which are then
unpacked for the
New submission from Josh Rosenberg:
PyObject_CallMethod explicitly documents that "The C arguments are described by
a Py_BuildValue() format string that should produce a tuple." While
PyObject_CallFunction doesn't document this requirement, it has the same
behavior, and the sa
Josh Rosenberg added the comment:
The motivation for this change was Mr. STINNER's comment on #26814 (
https://bugs.python.org/issue26814#msg263923 ), where he mentioned the
weirdness of PyObject_CallFunction and friends, which complicates the
implementation of PyObject_FastCall and al
Josh Rosenberg added the comment:
Seems sensible for itemgetter and attrgetter, where all but the first argument
is nonsensical anyway.
It really seems like methodcaller should allow additional arguments (positional
and keyword though), a la functools.partial (the difference being the support
Josh Rosenberg added the comment:
"are equal to False" would be wrong though. Any "falsy" value is preserved by
filterfalse, and removed by filter. They need not be equal to False (the bool
singleton); empty containers (e.g. (), [], {}, "") are all conside
Josh Rosenberg added the comment:
That's why lower case "false" is used, not "False"; the former is the loose
definition, the latter is the strict singleton.
--
___
Python tracker
<http:
Josh Rosenberg added the comment:
The Queue module (queue on Py3) is for communication between threads, not
processes; what you've written wouldn't behave correctly on any version of
Python. You want to use multiprocessing's Queue class, not Queue.Queue, and to
avoid possible
Josh Rosenberg added the comment:
At some point someone really needs to decide if the C layer behavior of
performing an identity test before full equality checking is something that
should be emulated at the Python layer or not. The current state seems
ridiculous, where C containers check
Changes by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<http://bugs.python.org/issue26219>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<http://bugs.python.org/issue26110>
___
___
Python-bugs-list mailing list
Unsubscribe:
Josh Rosenberg added the comment:
Franklin said it better: The only difference between documentation and behavior
is invisible implementation details, which have no business being documented in
any event (since they needlessly tie the hands of maintainers of CPython and
other Python
Josh Rosenberg added the comment:
bool is not enough of a special case to call it out without confusing the
issue. No, the bool constructor is not actually called. But it will still
behave as if it was called for all intents and purpose, it just skips the
reference counting shenanigans for
Josh Rosenberg added the comment:
Agree with Steven; the whole reason Python 3 changed from unicode and str to
str and bytes was because having Py2 str be text sometimes, and binary data at
other times is confusing. The existing behavior can't change in Py2 in any
meaningful way wi
Josh Rosenberg added the comment:
Is this worth fixing? Delve into the innards and you get weird behaviors. If
you really need to iterate sys.modules (the example clearly doesn't, but that
doesn't mean no one would), you could just copy the parts you need beforehand
to get a consi
Josh Rosenberg added the comment:
This is intentional and documented behavior:
https://docs.python.org/3/library/__main__.html
--
nosy: +josh.r
___
Python tracker
<http://bugs.python.org/issue23
Josh Rosenberg added the comment:
Assuming Siphash is in fact cryptographically secure (in the sense you can't
choose a desired result hash with better odds that brute force), and it appears
to be so, with a keyspace of 64 bits, if it's evenly distributed (which a
cryptographica
Josh Rosenberg added the comment:
Is it worth the definition of tp_as_number and maintaining another method for a
micro-optimization? Presumably every collection in Python would benefit
slightly from this (say, defaultdict in the same file, list, tuple, etc.), but
none of them bother. Why
Josh Rosenberg added the comment:
On further checking, this probably gives slightly greater benefit to deque than
it would for list, tuple, dict, etc., only because PyObject_IsTrue checks for
mapping before sequence; deque is a pure sequence, no mapping, so it has to
fail an extra test before
Josh Rosenberg added the comment:
The behavior for multiplying or adding doesn't seem quite so intuitive when you
allow for a bounded deque. In particular, it doesn't seem obvious that
multiplying when the deque is bounded, you'll get results like:
>>> list(deque
Josh Rosenberg added the comment:
I think my first addition example is wrong (should produce [2, 1, 2]), but you
get the idea.
--
___
Python tracker
<http://bugs.python.org/issue23
Josh Rosenberg added the comment:
I agree that popping old inputs is the normal way. What I'm trying to say is
that it doesn't feel like "old" or "inputs" when you multiply. In that case
(and maybe this is just me), it feels like a "reasonable" outcom
Josh Rosenberg added the comment:
The nature of a Pool precludes assumptions about the availability of specific
objects in a forked worker process (particularly now that there are alternate
methods of forking processes). Since the workers are spun up when the pool is
created, objects created
Josh Rosenberg added the comment:
You shouldn't presize when the input is a potentially non-unique iterable. It
makes sense to presize for inputs of type dict or set, but for a list, the
assumption is that many duplicates will be present, since deduping is a common
use case for dicts (le
Josh Rosenberg added the comment:
The Pool workers are created eagerly, not lazily. That is, the fork occurs
before map is called, and Python can't know that the objects passed as
arguments were inherited in the first place (since they could be created after
the Pool was created). I
New submission from Josh Rosenberg:
Accidentally discovered this while running code that processes a whole bunch of
files, when it turned out the files were empty. The readline method of
fileinput.input will make a recursive call to continue processing when it
reaches the end of a file. This
Josh Rosenberg added the comment:
Ah. System I was working on when I checked this didn't have latest micro
release. Guess I can recheck when it gets updated.
--
___
Python tracker
<http://bugs.python.org/is
Josh Rosenberg added the comment:
Well, it's trading one person's style for the PEP7 official style, so it's not
completely arbitrary.
That said, I'm not sure it's justifiable to apply to the entire historic code
base; my impression was that PEP7 was not intended to
Josh Rosenberg added the comment:
Nick: Looks like it's quite a bit more work than just a dict lookup. That
PyImport_ImportModuleNoBlock call (which seems odd; the implementation of
NoBlock is just to wrap the blocking function; guess we don't allow
non-blocking imports anymore a
Josh Rosenberg added the comment:
Hmm... On checking down some of the code paths and realizing there were some
issues in 3.5 (redundant code, and what looked like two memory leaks), I
checked tip (to avoid opening bugs on stale code), and discovered that #22557
rewrote the import code
Josh Rosenberg added the comment:
General comment on the patch: I believe per PEP7, we're still sticking to ANSI
C (aka C89), and specifically, "all declarations must be at the top of a block
(not necessarily at the top of function".
The patch assumes lax standards com
Josh Rosenberg added the comment:
Removing those unrelated changes looks like it would dramatically reduce the
churn too, making review easier.
--
___
Python tracker
<http://bugs.python.org/issue28
Josh Rosenberg added the comment:
The fact that it's resolved by PyGC_Collect indicates there is a reference
cycle somewhere. PyGC_Collect is just looking for cyclic garbage and breaking
the cycles so it can be cleaned; it would happen eventually unless GC was
explicitly disabled o
Josh Rosenberg added the comment:
The "What’s New In Python 3.6" page should really get an update to mention
Flag, IntFlag and auto as enhancements to the enum module. Right now, the ssl
module update docs mentions (but does not properly link for some reason)
IntFlag, but otherwise
Josh Rosenberg added the comment:
Well, I could see a "friendly" repr being avoided to:
1. Save work (iterating safely involves iteration guards and explicitly
acquiring strong references to every key)
2. Avoid pretending the state is stable (the repr at time X could be different
601 - 700 of 727 matches
Mail list logo