Josh Rosenberg 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 would fail; if a
new file is opene
Josh Rosenberg 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
___
Python tracker
<ht
Josh Rosenberg 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
will fail with a TypeError should you do any
Josh Rosenberg 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 __index__ and not __int__
gets erroneously
Josh Rosenberg 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 a type to
define __
New submission from Josh Rosenberg :
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__ method). In
Python 3, this was
Josh Rosenberg 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 subclass of Integral); no need to expli
Josh Rosenberg 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
<https://bugs.python.org/issue20
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
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:
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:
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:
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
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:
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 :
--
versions: -Python 2.7
___
Python tracker
<https://bugs.python.org/issue32723>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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 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
Change by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<https://bugs.python.org/issue29943>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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, and
that it
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
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 for
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
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:
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
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:
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:
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:
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:
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:
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:
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:
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:
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
Changes by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<http://bugs.python.org/issue29989>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<http://bugs.python.org/issue29971>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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:
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 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:
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:
>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,
>do
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 no
Changes by Josh Rosenberg :
--
pull_requests: +670
___
Python tracker
<http://bugs.python.org/issue29871>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
Changes by Josh Rosenberg :
--
title: Executor.map should not submit all futures prior to yielding any results
-> Make Executor.map work with infinite/large inputs correctly
___
Python tracker
<http://bugs.python.org/issu
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 GitH
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
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.
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, if the
Josh Rosenberg added the comment:
Yeah, that sounds fine.
--
___
Python tracker
<http://bugs.python.org/issue29752>
___
___
Python-bugs-list mailing list
Unsub
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
<http://bugs.python.o
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
<http://bugs.python.
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
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
Changes by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<http://bugs.python.org/issue23267>
___
___
Python-bugs-list mailing list
Unsubscribe:
Changes by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<http://bugs.python.org/issue27151>
___
___
Python-bugs-list mailing list
Unsubscribe:
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 pr
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 iterato
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
<http://bugs.python.org/is
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
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. The
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 be
Changes by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<http://bugs.python.org/issue29331>
___
___
Python-bugs-list mailing list
Unsubscribe:
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&
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
<http://bugs.python.org/issue29
Josh Rosenberg added the comment:
Seems reasonable to me.
--
nosy: +josh.r
___
Python tracker
<http://bugs.python.org/issue29055>
___
___
Python-bugs-list mailin
Changes by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<http://bugs.python.org/issue29049>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
Changes by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<http://bugs.python.org/issue28969>
___
___
Python-bugs-list mailing list
Unsubscribe:
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 ca
Changes by Josh Rosenberg :
--
nosy: -josh.r
___
Python tracker
<http://bugs.python.org/issue28944>
___
___
Python-bugs-list mailing list
Unsubscribe:
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 exception
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
<http://bugs.python.org/is
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
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 trivia
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 yo
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
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 n
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
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
<http://bugs.python.org/issu
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 no
Changes by Josh Rosenberg :
--
nosy: +josh.r
___
Python tracker
<http://bugs.python.org/issue28818>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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 an
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
<http://bugs.python.org/is
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
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
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
Changes by Josh Rosenberg :
--
type: -> crash
___
Python tracker
<http://bugs.python.org/issue28709>
___
___
Python-bugs-list mailing list
Unsubscrib
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 soluti
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
Changes by Josh Rosenberg :
--
title: PyStructSequence_NewType is broken -> PyStructSequence_NewType is
broken; makes GC type without setting Py_TPFLAGS_HEAPTYPE
___
Python tracker
<http://bugs.python.org/issu
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
Changes by Josh Rosenberg :
Added file: http://bugs.python.org/file45496/setup.py
___
Python tracker
<http://bugs.python.org/issue28709>
___
___
Python-bugs-list mailin
Josh Rosenberg added the comment:
#28651 opened for the general problem with empty __slots__ and gc failures.
--
___
Python tracker
<http://bugs.python.org/issue24
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 instant
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
301 - 400 of 727 matches
Mail list logo