Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue43721>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Antony Lee :
In a first Python process, repeatedly create and delete a file:
from pathlib import Path
while True:
Path("foo").touch(); Path("foo").unlink()
In another process, repeatedly check for the path's existence:
from pathlib import Pa
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue46785>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue26792>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Antony Lee :
Starting from the custom2 example at
https://docs.python.org/3/extending/newtypes_tutorial.html#adding-data-and-methods-to-the-basic-example,
change the methods table to
static PyMethodDef Custom_methods[] = {
{"foo", (PyCFunction)
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue37743>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Antony Lee :
Consider the following example
from enum import Flag
F = Flag("F", list("abcdefghijklm"))
for idx in range(2**len(F) - 1):
F(idx)
creating all possible combos of 13 flags, so 8192 instances (yes, I know the
instances a
Antony Lee added the comment:
Actually, microoptimizing _power_of_two is a red herring and the problem is the
quadratic complexity of _decompose (_value2member_map_ becomes bigger and
bigger at each iteration). Replacing the implementation of _decompose by the
following fixes the
New submission from Antony Lee :
Currently, `inspect.getdoc()` fails to inherit docstrings in dynamically
generated subclasses, such as
```
class Base:
def method(self): "some docstring"
def make_subclass():
class subclass(Base):
def method(self): return supe
Change by Antony Lee :
--
keywords: +patch
pull_requests: +16485
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/16957
___
Python tracker
<https://bugs.python.org/issu
New submission from Antony Lee :
property.{getter,setter,deleter} returns a new property with a new
{fget,fset,fdel}. This is documented at
https://docs.python.org/3/library/functions.html#property, and intended
behavior (see e.g. https://bugs.python.org/issue1620).
However the
New submission from Antony Lee :
Adding a call/__call__ function to the operator module (where
`operator.call(*args, **kwargs)(func) == func(*args, **kwargs)`, similarly to
operator.methodcaller) seems consistent with the design with the rest of the
operator module.
An actual use case I had
New submission from Antony Lee :
https://docs.python.org/3/library/multiprocessing.html#address-formats
currently states
> An 'AF_PIPE' address is a string of the form r'\.\pipe{PipeName}'. To use
> Client() to connect to a named pipe on a remote computer called Se
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue34389>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue20012>
___
___
Python-bugs-list mailing list
Unsubscribe:
Antony Lee added the comment:
Actually, upon further thought, the semantics I suggested above should go into
`operator.caller` (cf. `operator.methodcaller`), and
`operator.call`/`operator.__call__` should instead be defined as
`operator.call(f, *args, **kwargs) == f(*args, **kwargs)`, so
New submission from Antony Lee :
Currently, methodcaller is not faster than a plain lambda:
```
In [1]: class T:
...: a = 1
...: def f(self): pass
...:
In [2]: from operator import *
In [3]: %%timeit t = T(); mc = methodcaller("f")
...: mc(t)
...:
...
Change by Antony Lee :
--
keywords: +patch
pull_requests: +26252
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/27782
___
Python tracker
<https://bugs.python.org/issu
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue38956>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Antony Lee :
--
keywords: +patch
pull_requests: +26342
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/27888
___
Python tracker
<https://bugs.python.org/issu
Antony Lee added the comment:
> I'm not convinced that operator.caller() would be useful to me.
To be clear, as noted above, I have realized that the semantics I initially
proposed (now known as "caller") are not particularly useful; the semantics I
am proposing (and i
Change by Antony Lee :
--
keywords: +patch
pull_requests: +26526
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/28083
___
Python tracker
<https://bugs.python.org/issu
Antony Lee added the comment:
It means the Path/PurePath that would be constructed with the same single str
parameter, or equivalently that has the same os.fspath().
--
___
Python tracker
<https://bugs.python.org/issue27
Antony Lee added the comment:
You are correct as to the meaning of "convert".
The alternative approach you suggest would also work, but that seems to go much
more against the design of pathlib to me. OTOH I guess it is up to Antoine to
ru
Antony Lee added the comment:
Despite the now well-known security limitations of pickle, it is still used as
a simple way (from the user PoV) to exchange arbitrary Python objects (see e.g.
https://joblib.readthedocs.io/en/latest/persistence.html). Such objects can
sometimes include Paths
Antony Lee added the comment:
I guess I could instead add some OS-dependent entries for Path classes into
_compat_pickle (to do the remapping at load time) if you prefer? I don't have
a strong preference either-way.
--
___
Python tracker
&
Antony Lee added the comment:
Python2's apply has different semantics: it takes non-unpacked arguments, i.e.
def apply(f, args, kwargs={}): return f(*args, **kwargs)
rather than
def call(f, *args, **kwargs): return f(*args, **kwargs)
I agree that both functions can be writt
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue44019>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue25477>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue23991>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue27161>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue33581>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue43286>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Antony Lee :
The documentation for PyModule_AddString{Constant,Macro} does not specify the
encoding used. Checking the source shows that these simply call
PyUnicode_FromString and thus use utf8, but perhaps this could be made explicit.
--
assignee: docs@python
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue24253>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue26120>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Antony Lee :
https://bugs.python.org/issue8538 recently added to Py3.9 a much welcome
addition to argparse, namely the capability to generate --foo/--no-foo flag
pairs. A small issue with the implementation is that it *always* appends the
default value to the help string
New submission from Antony Lee :
As of Py3.8/Linux:
In [1]: os.environ["foo"] = Path("bar")
-
Antony Lee added the comment:
FWIW, I'm actually fine with not supporting Path objects in os.environ, as long
as the behavior is *consistent* with the env kwarg to subprocess.run() -- note
that the original title of the thread only pointed out to the inconsistency,
and did not str
New submission from Antony Lee :
If one tries to add twice the same flag to an ArgumentParser, one gets a
helpful exception:
from argparse import ArgumentParser
p = ArgumentParser()
p.add_argument("--foo")
p.add_argument("--foo")
results in
ar
Change by Antony Lee :
--
keywords: +patch
pull_requests: +17971
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/18605
___
Python tracker
<https://bugs.python.org/issu
Antony Lee added the comment:
Sure, https://github.com/python/cpython/pull/18605 it is.
--
___
Python tracker
<https://bugs.python.org/issue39716>
___
___
Pytho
Antony Lee added the comment:
Done in bugs.python.org/issue36350 /
https://github.com/python/cpython/pull/12412.
--
resolution: -> fixed
stage: needs patch -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
New submission from Antony Lee :
https://bugs.python.org/issue36350 /
https://github.com/python/cpython/pull/12412 changed Signature.parameters and
BoundArguments.arguments to be plain dicts, not OrderedDicts (for Py3.9a4).
Even though I agree for BoundArguments.arguments (in fact I argued
Antony Lee added the comment:
It looks good to me, thanks.
--
___
Python tracker
<https://bugs.python.org/issue39775>
___
___
Python-bugs-list mailing list
Unsub
New submission from Antony Lee :
Many functions which take a path-like object typically also accept strings
(sorry, no hard numbers here). This means that if the function plans to call
Path methods on the object, it needs to first call Path() on the arguments to
convert them, well, to Paths
Antony Lee added the comment:
Decorating __new__ with lru_cache would likely run into memory leakage
problems? (one would need a "weak lru_cache", I guess).
I didn't know about the _closed attribute. From a quick look it appears to only
be settable by using the path (not the
Antony Lee added the comment:
A problem of having this bit of state in paths is that it violates assumptions
based on immutability/hashability, e.g. with
from pathlib import Path
p = Path("foo")
q = Path("foo")
with p: pass
unique_paths = {
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue39775>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue23080>
___
___
Python-bugs-list mailing list
Unsubscribe:
Antony Lee added the comment:
Immutability and hashability are listed first among "general properties" of
paths (https://docs.python.org/3/library/pathlib.html#general-properties), and
in the PEP proposing pathlib
(https://www.python.org/dev/peps/pep-0428/#immutability). Loo
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue25024>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue39682>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Antony Lee :
Consider the following example, linewrapping 10^4 bytes in hex form to 128
characters per line, on Py 3.8.2 (Arch Linux repo package):
In [1]: import numpy as np, math
In [2]: data = np.random.randint(0, 256, (100, 100),
dtype=np.uint8).tobytes
New submission from Antony Lee :
It would be nice if inspect.signature was able to understand bound str.format
methods, e.g. `inspect.signature("{a} {b}".format) == inspect.signature(lambda
*args, a, b, **kwargs: None)` (`*args, **kwargs` are there because str.format
ignores
New submission from Antony Lee :
It would be a small usability improvement if ElementTree's XPath support also
supported the != (not-equals) operator.
I am specifically mentioning only != and not >/
<https://bugs.python.org
New submission from Antony Lee :
It would be nice if METH_NOARGS extension methods had an autogenerated
signature (or rather, autogenerated __text_signature__ that gets picked up by
inspect.signature). After all, the signature is trivially known at compile
time.
The same *could* possibly
Antony Lee added the comment:
Now fixed, I believe.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue42451>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Antony Lee :
os.add_dll_directory appears to only accept absolute paths, inheriting this
restriction from AddDllDirectory. That's absolutely fine, but could perhaps be
mentioned in the docs
(https://docs.python.org/3/library/os.html#os.add_dll_directory), espec
Antony Lee added the comment:
Thanks!
--
___
Python tracker
<https://bugs.python.org/issue34750>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue34750>
___
___
Python-bugs-list mailing list
Unsubscribe:
Antony Lee added the comment:
Thanks for implementing!
--
___
Python tracker
<https://bugs.python.org/issue42385>
___
___
Python-bugs-list mailing list
Unsub
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue42385>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Antony Lee :
The docs for PyUnicode_FSConverter and PyUnicode_FSDecoder could be improved on
two points:
- The functions also reject str/bytes that contain null bytes (one can easily
verify that there's a specific check for them in the C implementations).
Currentl
New submission from Antony Lee :
Starting from the keyword-arguments example at
https://docs.python.org/3/extending/extending.html#keyword-parameters-for-extension-functions,
change the docstring of `parrot` to "parrot(voltage, state, action,
type=1<<5)\n--\n\n" (yes, the do
New submission from Antony Lee :
Currently, the documentation for Popen.returncode states
The child return code, set by poll() and wait() (and indirectly by
communicate()). A None value indicates that the process hasn’t terminated yet.
A negative value -N indicates that the child was
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue31254>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue39783>
___
___
Python-bugs-list mailing list
Unsubscribe:
Antony Lee added the comment:
To be honest, I don't really remember what exact use case I had in my mind 2
years ago (as I probably worked around it in one way or another). However, one
example that I can think of (and that I have actually implemented before) is
auto-conversion
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue24970>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue27320>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue40624>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Antony Lee :
Currently, enum.auto doesn't work with the new (Py3.10) StrEnum: `class
E(enum.StrEnum): a = enum.auto()` results in `TypeError: 1 is not a string`.
I would guess that the most reasonable behavior for auto() in a StrEnum would
be to return the name itsel
New submission from Antony Lee :
Unlike `PySequence_GetItem`, `PyTuple_GetItem` does not support negative
indices ("indexing from the end"). That is fine, but warrants a notice in the
docs (as that behavior is certainly not obvious).
The same wording as for `PyList_GetItem` (chan
New submission from Antony Lee :
https://docs.python.org/3/library/math.html says
The following functions are provided by this module. Except when explicitly
noted otherwise, all return values are floats.
and
math.factorial(x)
Return x factorial. Raises ValueError if x is not integral or is
Antony Lee added the comment:
oops, missed that, thanks for pointing that out.
--
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/i
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue37109>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue31006>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Antony Lee :
The docs for ContextDecorator (of which contextmanager is a case) describe its
semantics as:
... for any construct of the following form:
def f():
with cm():
# Do stuff
ContextDecorator lets you instead write:
@cm
New submission from Antony Lee:
Python 3.6.1, virtualenv 15.1.0 (Arch Linux, distro packages)
```
export PIP_CONFIG_FILE=/dev/null # just to be sure
# python -mvirtualenv outer-env # using /usr/bin/python(3)
python2 -mvirtualenv outer-env # using /usr/bin/python(3)
source outer-env/bin
Antony Lee added the comment:
Sorry, that was a sloppy report. This is a better repro:
$ export PIP_CONFIG_FILE=/dev/null # just to be sure
python -mvirtualenv outer-env # using /usr/bin/python(3)
source outer-env/bin/activate
python -mvenv inner-env # using outer-env's python
source
Changes by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<http://bugs.python.org/issue19896>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Antony Lee:
Currently, the fields, types and defaults used to define a typing.NamedTuple
need to be retrieved from three different attributes: `_fields`,
`_field_types`, and `_field_defaults` (the first two are combined in
`__annotations__`, but that still misses the
Antony Lee added the comment:
For cross-referencing purposes: I have proposed in
http://bugs.python.org/issue25293 to allow passing a Thread/Process subclass as
argument instead of an initializer function, which would both handle Mark
Dickinson's comment (http://bugs.python.org/issue
Antony Lee added the comment:
I'll just repost the issue there for now
(https://github.com/python/typing/issues/454). May work on a patch at some
point (looks relatively simple) but no guarantees, so if someone else wants to
take over feel free to
New submission from Antony Lee:
The following example, which raises a KeyError, shows that in a
WeakKeyDictionary subclass that defines __missing__, that method doesn't get
called.
from weakref import WeakKeyDictionary
class WeakKeyDictionaryWithMissing(WeakKeyDicti
Antony Lee added the comment:
The use case is to generate a mapping of weakly-held objects to unique ids,
with something like
id_map = WeakKeyDictionaryWithMissing(lambda *, _counter=itertools.count():
next(_counter))
Of course, as always when using defaultdict, it is easy enough to instead
Antony Lee added the comment:
The original example did not cover the use case and was only there to show the
current behavior. The real use case is more something like
obj = (get obj as argument to function, caller has a hard reference to it)
uid = d[obj
Antony Lee added the comment:
For my use case, it was easy enough to wrap the `uid = d[obj]` in a try...
catch... plus locking.
Using setdefault would cause the counter to be incremented every time. In
truth, here I did not care about having consecutive uids, so that would have
worked just
Antony Lee added the comment:
Thanks for the clarification!
"at least if the original key is not `obj` but some other object equal to
`obj`" does not apply in my case so I'm fine, but the example shows that this
is tric
New submission from Antony Lee:
In https://docs.python.org/3.7/reference/datamodel.html#object.__hash__ I think
x.__hash__() returns an appropriate value such that x == y implies both that x
is y and hash(x) == hash(y).
should be
x.__hash__() returns an appropriate value such that x == y and
New submission from Antony Lee:
The doc for argparse.RawTextHelpFormatter states that it "maintains whitespace
for all sorts of help text, including argument descriptions." But the
following example (which outputs "Foo", "Bar", and "Baz", each separate
New submission from Antony Lee:
All's in the title: "pth files in site-packages of venvs are executed twice".
For example, the following code sample prints "1" twice.
python -mvenv /tmp/tmpenv
echo 'import os; print(1)' >/tmp/tmpenv/lib/python3.6/site
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue33944>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Antony Lee :
The documentation for the accepted types for each format unit in
PyArg_ParseTuple (and its variants) is usually quite detailed; compare for
example
y* (bytes-like object) [Py_buffer]
This variant on s* doesn’t accept Unicode objects, only bytes-like
New submission from Antony Lee :
pdb's recursive debug command (mentioned e.g. in
https://bugs.python.org/issue35931) is not listed in
https://docs.python.org/3/library/pdb.html#debugger-commands.
(I haven't checked whether any other command is missing.)
--
assignee: d
Antony Lee added the comment:
I'll pass on that for now.
--
___
Python tracker
<https://bugs.python.org/issue36277>
___
___
Python-bugs-list mailing list
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue35232>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Antony Lee :
--
nosy: -Antony.Lee
___
Python tracker
<https://bugs.python.org/issue36277>
___
___
Python-bugs-list mailing list
Unsubscribe:
1 - 100 of 219 matches
Mail list logo