[issue19895] Cryptic error when subclassing multiprocessing classes

2019-04-26 Thread Antony Lee
Change by Antony Lee : -- nosy: -Antony.Lee ___ Python tracker <https://bugs.python.org/issue19895> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue22964] dbm.open(..., "x")

2019-05-12 Thread Antony Lee
Change by Antony Lee : -- nosy: -Antony.Lee ___ Python tracker <https://bugs.python.org/issue22964> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue30811] A venv created and activated from within a virtualenv uses the outer virtualenv's site-packages rather than its own.

2018-01-17 Thread Antony Lee
Change by Antony Lee : -- nosy: -Antony.Lee ___ Python tracker <https://bugs.python.org/issue30811> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32945] sorted(generator) is slower than sorted(list-comprehension)

2018-02-25 Thread Antony Lee
New submission from Antony Lee : Consider e.g. In [2]: %timeit sorted([i for i in range(100)]) 4.74 µs ± 24.3 ns per loop (mean ± std. dev. of 7 runs, 10 loops each) In [3]: %timeit sorted(i for i in range(100)) 7.05 µs ± 25.7 ns per loop (mean ± std. dev. of 7 runs, 10

[issue32945] sorted(generator) is slower than sorted(list-comprehension)

2018-02-25 Thread Antony Lee
Antony Lee added the comment: Feel free to close the issue if that's not the forum for this discussion, but I'm still baffled by what's happening. In the example that you give, the first case needs to look up the `list` global and that callable (which happens to be the `list`

[issue32945] sorted(generator) is slower than sorted(list-comprehension)

2018-02-25 Thread Antony Lee
Antony Lee added the comment: > But with a list or other sequence with a known length, the interpreter can > allocate the right number of items up front, and avoid growing or shrinking > the new list. I believe that this is the time saving you are seeing. But certainly when

[issue33007] Objects referencing private-mangled names do not roundtrip properly under pickling.

2018-03-05 Thread Antony Lee
New submission from Antony Lee : Consider the following example: import pickle class T: def __init__(self): self.attr = self.__foo def __foo(self): pass print(pickle.loads(pickle.dumps(T( This fails on 3.6 with `AttributeError: &#

[issue33009] inspect.signature crashes on unbound partialmethods

2018-03-05 Thread Antony Lee
New submission from Antony Lee : The following example crashes Python 3.6: from functools import partialmethod import inspect class T: g = partialmethod((lambda self, x: x), 1) print(T().g()) # Correctly returns 1. print(T.g(T())) # Correctly returns 1. print

[issue33033] Clarify that the signed number convertors to PyArg_ParseTuple... *do* overflow checking

2018-03-08 Thread Antony Lee
New submission from Antony Lee : At https://docs.python.org/3/c-api/arg.html#numbers, it is explicitly documented that the unsigned number convertors do not perform overflow checking. Implicitly, this suggests that the signed convertors *do* perform overflow checking, which they indeed do

[issue33033] Clarify that the signed number convertors to PyArg_ParseTuple... *do* overflow checking

2018-03-09 Thread Antony Lee
Antony Lee added the comment: One could just add, immediately below the "Numbers" section, something like: "The signed convertors (b, h, i, ...) perform overflow checking. The unsigned convertors (B, H, I, ...) do not." That would actually be shorter than the current ve

[issue33197] Confusing error message when constructing invalid inspect.Parameters

2018-04-01 Thread Antony Lee
New submission from Antony Lee : Python 3.6.4 In [15]: inspect.Parameter("foo", kind=inspect.Parameter.VAR_KEYWORD, default=42) --- ValueErrorTraceback (most recent

[issue12029] Allow catching virtual subclasses in except clauses

2018-04-13 Thread Antony Lee
Change by Antony Lee : -- nosy: -Antony.Lee ___ Python tracker <https://bugs.python.org/issue12029> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue33197] Confusing error message when constructing invalid inspect.Parameters

2018-04-29 Thread Antony Lee
Change by Antony Lee : -- nosy: -Antony.Lee ___ Python tracker <https://bugs.python.org/issue33197> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21423] concurrent.futures.ThreadPoolExecutor/ProcessPoolExecutor should accept an initializer argument

2017-11-02 Thread Antony Lee
Change by Antony Lee : -- nosy: -Antony.Lee ___ Python tracker <https://bugs.python.org/issue21423> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue25293] Hooking Thread/Process instantiation in concurrent.futures.

2017-11-02 Thread Antony Lee
Antony Lee added the comment: I can't say I *really* need this anymore, but note that https://bugs.python.org/issue21423 is less general as it does not handle the case of a finalizer as proposed here. -- ___ Python tracker &

[issue30811] A venv created and activated from within a virtualenv uses the outer virtualenv's site-packages rather than its own.

2017-11-21 Thread Antony Lee
Antony Lee added the comment: Travis uses virtualenvs as toplevel containers for running CI. Some projects need (or would like to) set up venvs as part of their test suites. On example is https://github.com/airspeed-velocity/asv, which profiles a project's speed across revisions; in

[issue30811] A venv created and activated from within a virtualenv uses the outer virtualenv's site-packages rather than its own.

2017-11-21 Thread Antony Lee
Antony Lee added the comment: > venv, on the other hand, doesn't, but keeps a reference to its original > Python environment. That is, I think, the reason for the difference in > behaviour. But for example, using the system Python to create a venv (no nesting), packages in

[issue30811] A venv created and activated from within a virtualenv uses the outer virtualenv's site-packages rather than its own.

2017-11-21 Thread Antony Lee
Antony Lee added the comment: I guess it's reasonable, I'll see whether we can use the workaround you proposed. (Could a fix on virtualenv's side help?) Thanks for the explanations. -- ___ Python tracker <https://bugs.pyt

[issue33581] Document "optional components that are commonly included in Python distributions."

2018-05-19 Thread Antony Lee
New submission from Antony Lee : The stdlib docs intro include the following sentences: It also describes some of the optional components that are commonly included in Python distributions. For Unix-like operating systems Python is normally provided as a collection of packages, so it

[issue34389] CPython may fail to build in the presence of a ~/.pydistutils.cfg

2018-08-12 Thread Antony Lee
New submission from Antony Lee : I have a ~/.pydistutils.cfg with the following contents: [build_ext] force = true inplace = true (--force is useful because sometimes just comparing timestamps is insufficient to know whether a package needs to be rebuilt, e.g. in the presence of

[issue34526] Path.relative_to() taking multiple arguments could be better documented

2018-08-28 Thread Antony Lee
New submission from Antony Lee : Currently, the docs for Path.relative_to read PurePath.relative_to(*other) Compute a version of this path relative to the path represented by other. If it’s impossible, ValueError is raised: (examples follow) It's a bit confusing why other is a

[issue34750] locals().update doesn't work in Enum body, even though direct assignment to locals() does

2018-09-20 Thread Antony Lee
New submission from Antony Lee : A quick check suggests that enum entries can be programmatically created by assigning to locals() in the Enum body: class E(Enum): locals()["a"] = 1 E.a # -> However, using locals().update(...) doesn't, and silently does the wrong

[issue34750] locals().update doesn't work in Enum body, even though direct assignment to locals() does

2018-09-20 Thread Antony Lee
Antony Lee added the comment: I have a personal helper function for writing (Qt) GUIs that generates ComboBoxes from Enums; essentially something like class Choices(Enum): choice1 = "text for choice 1" choice2 = "text for choice 2" def call

[issue34750] locals().update doesn't work in Enum body, even though direct assignment to locals() does

2018-09-21 Thread Antony Lee
Antony Lee added the comment: > encourage the common assumption that locals() returns a dict where mutating > it actually works, since it usually doesn't. It does at global and class scope, not at function scope. FWIW, PEP558 (admittedly not accepted yet) proposes to

[issue34750] locals().update doesn't work in Enum body, even though direct assignment to locals() does

2018-09-22 Thread Antony Lee
Antony Lee added the comment: > I agree though that adding an update method would be nice though and can be > done in just a few lines of code. Again, this can be done just be inheriting the methods from MutableMapping. In fact even now one can just write class

[issue34807] pathlib.[r]glob fails when the toplevel directory is not readable, whereas glob.glob "succeeds"

2018-09-26 Thread Antony Lee
New submission from Antony Lee : After $ mkdir -p foo/bar && chmod 000 foo one gets In [1]: glob.glob("foo/bar") Out[1]: [] but In [2]: list(Path("foo/bar").glob("*")) gives a PermissionError. I'm not arguing that pathlib should

[issue23596] gzip argparse interface

2018-10-09 Thread Antony Lee
Change by Antony Lee : -- nosy: -Antony.Lee ___ Python tracker <https://bugs.python.org/issue23596> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35063] Checking for abstractmethod implementation fails to consider MRO for builtins

2018-10-25 Thread Antony Lee
New submission from Antony Lee : When checking whether a class implements all abstractmethods (to know whether the class can be instantiated), one should only consider methods that come *before* the abstractmethod in the MRO -- methods that come after cannot be said to override the

[issue33944] Deprecate and remove pth files

2018-10-25 Thread Antony Lee
Antony Lee added the comment: There are a number of packages that can "self-import" into any Python process depending on the presence of an environment variable, by installing a pth file that contains something like `import os; __import__("thepkg") if os.environ.get(&q

[issue35232] Add `module`/`qualname` arguments to make_dataclass for picklability

2018-11-13 Thread Antony Lee
New submission from Antony Lee : Currently, dataclasses created by make_dataclass are not picklable, because their __module__ is set to "types". It seems that this would be easily fixed by letting make_dataclass gain a `module` and a `qualname` kwarg, similarly to the Enum funct

[issue15598] relative import unexpectedly binds name

2012-08-08 Thread Antony Lee
New submission from Antony Lee: The language reference is clear: "The from form does not bind the module name" (Section 6.12) However, consider the following example: * package/__init__.py: foo = "FOO" from .foo import bar print(foo) os = "OS" from os import pa

[issue21127] Path objects cannot be constructed from str subclasses

2014-04-01 Thread Antony Lee
New submission from Antony Lee: Trying to construct a Path object from a str subclass, e.g. class S(str): pass Path(S("foo")) fails because the subclass cannot be interned. I think that the interning should simply be removed for non-exactly-str arguments (it is only here for p

[issue21127] Path objects cannot be constructed from str subclasses

2014-04-07 Thread Antony Lee
Antony Lee added the comment: The attached patch should fix the issue. -- keywords: +patch Added file: http://bugs.python.org/file34759/pathlib.patch ___ Python tracker <http://bugs.python.org/issue21

[issue21127] Path objects cannot be constructed from str subclasses

2014-04-11 Thread Antony Lee
Antony Lee added the comment: I am loading some structure from a MATLAB binary file using scipy.io.loadmat. This structure contains (in particular) paths (written as bytestrings) to other files which end up being loaded as numpy.str_ objects. In fact, just trying to store and retrieve

[issue21714] Path.with_name can construct invalid paths

2014-06-10 Thread Antony Lee
New submission from Antony Lee: Path.with_name can be used to construct paths containing slashes as name contents (rather than as separators), as demonstrated below. $ python -c 'from pathlib import Path; print(Path("foo").with_name("bar/baz").name)' bar/baz Th

[issue21717] Exclusive mode for ZipFile and TarFile

2014-06-11 Thread Antony Lee
New submission from Antony Lee: I noticed that while lzma and bz2 already support the "x" (create a new file, raise if it already exists) flag, zipfile and tarfile don't know about it yet. It would be an useful addition, just as it is useful for regular open. A quick look

[issue21714] Path.with_name can construct invalid paths

2014-06-11 Thread Antony Lee
Antony Lee added the comment: I have the patch almost ready, but ran into another issue: should "path.with_name('foo/')" be allowed? It may make sense to treat it like "path.with_name('foo')", just like 'Path("foo/") == Path("fo

[issue19573] Fix the docstring of inspect.Parameter and the implementation of _ParameterKind

2013-11-13 Thread Antony Lee
New submission from Antony Lee: The following patch corrects the docstring of `inspect.Parameter`, as the `default` and `annotation` attributes are in fact set to `empty` if no value is provided, and the `kind` attribute is in fact an `int` (more precisely, a `_ParameterKind`). It also

[issue19890] Typo in multiprocessing docs

2013-12-04 Thread Antony Lee
New submission from Antony Lee: The docs for multiprocessing refer to BaseProxy._callMethod() while it should be _callmethod. -- assignee: docs@python components: Documentation messages: 205261 nosy: Antony.Lee, docs@python priority: normal severity: normal status: open title: Typo in

[issue19895] Cryptic error when subclassing multiprocessing classes

2013-12-05 Thread Antony Lee
New submission from Antony Lee: Classes defined in the multiprocessing module are in fact functions that call the internally defined class constructor with the "ctx" argument properly set; because of that, trying to subclass them yields a (very?) cryptic error message:

[issue19896] Exposing "q" and "Q" to multiprocessing.sharedctypes

2013-12-05 Thread Antony Lee
New submission from Antony Lee: multiprocessing.sharedctypes was not updated after the "q" (c_longlong) and "Q" (c_ulonglong) typecodes were added to the array module (the docs claim that the typecode can be "one character typecode of the kind used by the array modul

[issue21714] Path.with_name can construct invalid paths

2014-06-22 Thread Antony Lee
Antony Lee added the comment: The attached patch fixes all the issues mentioned, and also integrates the fixes of issue 20639 (issues with with_suffix) as they are quite similar. -- keywords: +patch Added file: http://bugs.python.org/file35735/pathlib-with_name-with_suffix.patch

[issue21969] WindowsPath constructor does not check for invalid characters

2014-07-12 Thread Antony Lee
New submission from Antony Lee: PureWindowsPath("foo*") returns a path object, even though it is an invalid one (e.g., open("foo*") on Windows throws an OSError for "invalid argument" rather than a FileNotFoundError). Given the amount of checking that is

[issue21969] WindowsPath constructor does not check for invalid characters

2014-07-12 Thread Antony Lee
Antony Lee added the comment: There is a list of always forbidden characters (http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#naming_conventions), and then a couple of obscure fs-dependent cases (http://en.wikipedia.org/wiki/Comparison_of_file_systems) but I

[issue22201] python -mzipfile fails to unzip files with folders created by zip

2014-08-14 Thread Antony Lee
New submission from Antony Lee: With Python 3.4.1: $ mkdir foo; zip -r foo{,}; python -mzipfile -e foo.zip dest adding: foo/ (stored 0%) Traceback (most recent call last): File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main "__main__", mod_sp

[issue20334] make inspect Signature hashable

2014-08-14 Thread Antony Lee
Antony Lee added the comment: The hash function of the Signature class is actually incompatible with the definition of Signature equality, which doesn't consider the order of keyword-only arguments: >>> from inspect import signature >>> s1 = signature(lambda *, x, y

[issue20334] make inspect Signature hashable

2014-08-15 Thread Antony Lee
Antony Lee added the comment: Actually, that specific solution (using a helper method) will fail because there may be unhashable params (due to unhashable default values or annotations) among the keyword-only arguments, so it may not be possible to build a frozenset (rather, one should

[issue22219] python -mzipfile fails to add empty folders to created zip

2014-08-17 Thread Antony Lee
New submission from Antony Lee: Compare $ mkdir foo; zip -q foo{,}; unzip -l foo.zip Archive: foo.zip Length DateTimeName - -- - 0 2014-08-17 10:49 foo/ - --- 0 1 file and

[issue22370] pathlib OS detection

2014-09-09 Thread Antony Lee
New submission from Antony Lee: Currently, pathlib contains the following check for the OS in the import section: try: import nt except ImportError: nt = None else: if sys.getwindowsversion()[:2] >= (6, 0): from nt import _getfinalpathn

[issue22387] Making tempfile.NamedTemporaryFile a class

2014-09-11 Thread Antony Lee
New submission from Antony Lee: Currently, tempfile.TemporaryFile and tempfile.NamedTemporaryFile are functions, not classes, despite what their names suggest, preventing subclassing. It would arguably be not so easy to make TemporaryFile a class, as its return value is whatever "_io

[issue22387] Making tempfile.NamedTemporaryFile a class

2014-09-11 Thread Antony Lee
Antony Lee added the comment: The initial idea was to solve #14243 (NamedTemporaryFile would be more useful on Windows if you could close it without deleting) by adding a "closed" keyword argument to the constructor of a subclass, that would set "delete" to False and

[issue22387] Making tempfile.NamedTemporaryFile a class

2014-09-11 Thread Antony Lee
Antony Lee added the comment: Yes, but this will make the context-manager approach (with NamedTemporaryFile(closed=True): ) unusable, because the underlying file object will be closed before calling __enter__. I think the only reasonable way to implement this would be to have __enter__

[issue20334] make inspect Signature hashable

2014-09-12 Thread Antony Lee
Antony Lee added the comment: While your patch works, I think it is a good opportunity to simplify the implementation of Signature.__eq__, which is *much* more complicated than what it should be. Please comment on the attached patch, which uses the helper method approach I suggested

[issue20267] TemporaryDirectory does not resolve path when created using a relative path

2014-09-26 Thread Antony Lee
Antony Lee added the comment: This looks reasonable. Note that the output of gettempdir is always passed as first argument to os.path.join (possibly via _mkstemp_inner), so perhaps you should rather define something like def _absolute_child_of_parent_or_tmpdir(parent, *args): "&qu

[issue20267] TemporaryDirectory does not resolve path when created using a relative path

2014-09-26 Thread Antony Lee
Antony Lee added the comment: I don't feel strongly about this, so either way is fine. -- ___ Python tracker <http://bugs.python.org/issue20267> ___ ___ Pytho

[issue22531] Turn contextlib.{redirect_stdout, suppress} into ContextDecorators

2014-10-01 Thread Antony Lee
New submission from Antony Lee: A small lib improvement suggestion could be to make contextlib.redirect_stdout and contextlib.suppress inherit from ContextDecorator. As a side note, the source of contextlib has some classes inheriting explicitly from object while others don't, so perhaps

[issue12029] Catching virtual subclasses in except clauses

2014-10-01 Thread Antony Lee
Antony Lee added the comment: "it looks like all the avenues for arbitrary code execution while checking if an exception handler matches a thrown an exception are closed off." This seems to be directly contradicted by your previous sentence: "the except clause accepts

[issue20267] TemporaryDirectory does not resolve path when created using a relative path

2014-10-04 Thread Antony Lee
Antony Lee added the comment: The change would be backwards-incompatible but also mimics the behavior of NamedTemporaryFile (which also fails to delete the file if the containing folder has been renamed -- this is easy to verify manually). I guess the other option would be to use fd-based

[issue20011] Changing the signature for Parameter's constructor

2013-12-17 Thread Antony Lee
New submission from Antony Lee: As suggested on python-ideas, this small patch changes the constructor of inspect.Parameter so that "kind" defaults to "POSITIONAL_OR_KEYWORD", which should make code that needs to construct Parameter objects slightly less v

[issue20011] Changing the signature for Parameter's constructor

2013-12-18 Thread Antony Lee
Antony Lee added the comment: Nobody replied so far... https://mail.python.org/pipermail/python-ideas/2013-December/024538.html -- ___ Python tracker <http://bugs.python.org/issue20

[issue20247] Condition._is_owned is wrong

2014-01-13 Thread Antony Lee
New submission from Antony Lee: I believe that the implementation of Condition._is_owned is wrong, as mentioned here: https://mail.python.org/pipermail/python-list/2012-October/632682.html. Specifically, the two return values (True and False) should be inverted. I guess this slipped through

[issue20267] TemporaryDirectory does not resolve path when created using a relative path

2014-01-14 Thread Antony Lee
New submission from Antony Lee: Essentially, the following fails: t = tempfile.TemporaryDirectory(dir=".") os.chdir(some_other_dir) t.cleanup() because t.name is a relative path. Resolving the "dir" argument when the directory is created should(?) fix the issue. -

[issue19573] Fix the docstring of inspect.Parameter and the implementation of _ParameterKind

2014-02-04 Thread Antony Lee
Antony Lee added the comment: Submitted new patch as suggested. -- Added file: http://bugs.python.org/file33913/inspect.py.diff ___ Python tracker <http://bugs.python.org/issue19

[issue20267] TemporaryDirectory does not resolve path when created using a relative path

2014-02-07 Thread Antony Lee
Antony Lee added the comment: Thanks for the fix. The same fix seems should also work for mkstemp and mktemp -- is it really worth creating a new issue for them? -- ___ Python tracker <http://bugs.python.org/issue20

[issue20247] Condition._is_owned is wrong

2014-02-07 Thread Antony Lee
Antony Lee added the comment: For the second half, the same behavior applies under Linux -- basically, a simple Lock doesn't have a notion of owning thread and can the be unlocked by any thread. However, the first half is not correct if the lock used is a *RLock-like* object (that is, i

[issue20765] Pathlib docs fail to mention with_name, with_suffix

2014-02-24 Thread Antony Lee
New submission from Antony Lee: I actually thought that Path.with_{name,suffix} had been removed before 3.4 when I didn't find them in the official docs... -- assignee: docs@python components: Documentation messages: 212160 nosy: Antony.Lee, docs@python priority: normal sev

[issue29111] Strange signature for memoryview constructor

2016-12-29 Thread Antony Lee
New submission from Antony Lee: The return value of `inspect.signature(memoryview)` is rather strange: Python 3.5.2 (default, Nov 7 2016, 11:31:36) [GCC 6.2.1 20160830] on linux Type "help", "copyright", "credits" or "license" for more informatio

[issue29117] dir() should include dunder attributes of the unbound method

2016-12-30 Thread Antony Lee
New submission from Antony Lee: ``` Python 3.5.2 (default, Nov 7 2016, 11:31:36) [GCC 6.2.1 20160830] on linux Type "help", "copyright", "credits" or "license" for more information. >>> class C: ... def f(self): pass ... >>> C.f.a

[issue29661] Typo in the docstring of timeit.Timer.autorange

2017-02-26 Thread Antony Lee
New submission from Antony Lee: The docstring of timeit.Timer.autorange currently reads | Return the number of loops so that total time >= 0.2. | | Calls the timeit method with *number* set to successive powers of | ten (10, 100, 1000, ...) up t

[issue29661] Typo in the docstring of timeit.Timer.autorange

2017-02-26 Thread Antony Lee
Changes by Antony Lee : -- nosy: -Antony.Lee ___ Python tracker <http://bugs.python.org/issue29661> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue27161] Confusing exception in Path().with_name

2016-05-30 Thread Antony Lee
New submission from Antony Lee: `Path().with_name` can fail with a lot of different exceptions: >>> Path("foo").with_name(0) Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.5/pathlib.py", line 800, in with

[issue27161] Confusing exception in Path().with_name

2016-05-30 Thread Antony Lee
Antony Lee added the comment: Actually, a simpler approach may be the attached patch (pathlib-splitroot.patch), in which case the exception is AttributeError: 'dict' object has no attribute 'lstrip' which is pretty commonly seen when a wrong type is passed to a functio

[issue27161] Confusing exception in Path().with_name

2016-05-31 Thread Antony Lee
Antony Lee added the comment: Would it? Note that splitroot is not public, and some quick tests did not show any other behavior difference from the public API side. -- ___ Python tracker <http://bugs.python.org/issue27

[issue27161] Confusing exception in Path().with_name

2016-05-31 Thread Antony Lee
Antony Lee added the comment: First, I doubt that this optimization actually changes anything measurable, but if you want you can always replace that line by "if part.startswith(sep)" (also solving the original issue). Additionally, note that `parse_parts` (the only functi

[issue27175] Unpickling Path objects

2016-06-01 Thread Antony Lee
New submission from Antony Lee: Currently, pickling Path objects lead to issues when working across platforms: Paths (and, thus, objects that contain Paths) created on a POSIX platform (PosixPaths) cannot be unpickled on Windows and vice versa. There are a few possibilities around this issue

[issue27320] ./setup.py --help-commands should sort extra commands

2016-06-14 Thread Antony Lee
New submission from Antony Lee: Currently, `./setup.py --help-commands` displays extra commands in a random (dict iteration, probably?) order, as can be seen with the following minimal example: from distutils.command.build_py import build_py from distutils.core import setup class

[issue27865] WeakMethod does not support builtin methods

2016-08-25 Thread Antony Lee
New submission from Antony Lee: List subclasses can be weakref'd (as mentioned by the docs), but their methods cannot be wrapped by WeakMethod, even though this makes sense semantically: ``` In [25]: class L(list): pass In [26]: weakref.WeakMethod(L().a

[issue17635] Doc of multiprocessing.connection mentions answerChallenge instead of answer_challenge

2013-04-04 Thread Antony Lee
New submission from Antony Lee: The documentation for multiprocessing.connection mentions the answerChallenge function, but it is actually called answer_challenge in 2.6, 2.7 and 3.3 -- I guess it's also the case in 3.1 and 3.2 but I didn't check. -- assignee: docs@python

[issue22955] Pickling of methodcaller and attrgetter

2014-11-26 Thread Antony Lee
New submission from Antony Lee: methodcaller and attrgetter objects seem to be picklable, but in fact the pickling is erroneous: >>> import operator, pickle >>> pickle.loads(pickle.dumps(operator.methodcaller("foo"))) Traceback (most recent call last): Fi

[issue22964] dbm.open(..., "x")

2014-11-28 Thread Antony Lee
New submission from Antony Lee: It would be nice if dbm.open() supported the "x" flag that open() now supports (create a new db, failing if it already exists). -- components: Library (Lib) messages: 231835 nosy: Antony.Lee priority: normal severity: normal status: open title

[issue23008] pydoc enum.{,Int}Enum fails

2014-12-07 Thread Antony Lee
New submission from Antony Lee: Not a big deal, but "$ pydoc enum.Enum" and "$ pydoc enum.IntEnum" fail to retrieve the docstrings, while they are visible with "$ pydoc enum". -- components: Library (Lib) messages: 232298 nosy: Antony.Lee priority: normal

[issue23076] path.glob("") fails with IndexError

2014-12-17 Thread Antony Lee
New submission from Antony Lee: glob.glob returns an empty list when passed an empty pattern as argument, but pathlib's Path.glob fails with IndexError. The first option seems more reasonable (or at least it should be a ValueError). -- components: Library (Lib) messages: 232841

[issue23080] BoundArguments.arguments should be unordered

2014-12-18 Thread Antony Lee
New submission from Antony Lee: This patch makes BoundArguments.arguments an unordered dict. As discussed on python-ideas, the rationale for this is 1. The current ordering in ba.arguments is the one of the parameters in the signature (which is already available via the ba.signature

[issue24459] Mention PYTHONFAULTHANDLER in the man page

2015-06-16 Thread Antony Lee
New submission from Antony Lee: The man page doesn't mention PYTHONFAULTHANDER in the list of environment variables (I haven't thoroughly checked that everyone else is there, either). I would also suggest reordering the environment variables in alphabetical order. -- assi

[issue24644] --help for runnable stdlib modules

2015-07-16 Thread Antony Lee
New submission from Antony Lee: Support for python -m [-h|--help] is a bit patchy right now: $ python -mpdb -h usage: pdb.py [-c command] ... pyfile [arg] ... $ python -mpdb --help Traceback (most recent call last): File "/usr/lib/python3.4/runpy.py", line 170, in _run_modu

[issue24647] Document argparse.REMAINDER as being equal to "..."

2015-07-16 Thread Antony Lee
New submission from Antony Lee: Currently the argparse docs mention the special values "+", "*" and "?" by their actual values instead of argparse.{ONE_OR_MORE,ZERO_OR_MORE,OPTIONAL}, but argparse.REMAINDER is mentioned as is. It seems easier to just use its ac

[issue24649] python -mtrace --help is wrong

2015-07-16 Thread Antony Lee
New submission from Antony Lee: While working on #24644, I noticed that the help for python -mtrace is quite wrong. $ python -mtrace --help Usage: /usr/lib/python3.4/trace.py [OPTIONS] [ARGS] Meta-options: --helpDisplay this help then exit. --version Output

[issue24644] --help for runnable stdlib modules

2015-07-16 Thread Antony Lee
Antony Lee added the comment: To be honest I don't really plan to contribute any patch on this specific issue right now, the CLI interface of e.g. trace has some other serious issues (see e.g. #24649) that I don't want to work out, and writing tests for the CLI are a pain too (

[issue24970] Make distutils.Command an ABC

2015-08-31 Thread Antony Lee
New submission from Antony Lee: Currently, distutils.Command is a "hand-written" ABC; i.e. direct instantiaion or calling the "abstract" methods initialize_options, run and finalize_options raises a RuntimeError saying that the method (not named in the error message, wh

[issue25024] Allow passing "delete=False" to TemporaryDirectory

2015-09-07 Thread Antony Lee
New submission from Antony Lee: I would like to suggest allowing passing "delete=False" to the TemporaryDirectory constructor, with the effect that the directory is not deleted when the TemporaryDirectory context manager exits, or when the TemporaryDirectory object is deleted. I re

[issue25293] Hooking Thread/Process instantiation in concurrent.futures.

2015-10-01 Thread Antony Lee
New submission from Antony Lee: http://bugs.python.org/issue21423 and http://bugs.python.org/issue24980 suggest adding an initializer/on_new_thread argument to {Thread,Process}PoolExecutor. I would like to suggest a more unified API, that would allow not only handling initialization, but

[issue25330] Two issues with pkgutil.get_data

2015-10-06 Thread Antony Lee
New submission from Antony Lee: The docs of pkgutil.get_data say "The resource argument should be in the form of a relative filename, using / as the path separator. The parent directory name .. is not allowed, and nor is a rooted name (starting with a /)." In fact (on Python 3.

[issue25417] Minor typo in Path.samefile docstring

2015-10-15 Thread Antony Lee
New submission from Antony Lee: The output of pydoc for Path.samefile currently reads pathlib.Path.samefile = samefile(self, other_path) Return whether `other_file` is the same or not as this file. (as returned by os.path.samefile(file, other_file)). It should arguably be something

[issue25417] Minor typo in Path.samefile docstring

2015-10-21 Thread Antony Lee
Antony Lee added the comment: Actually there's also an extra dot at the end of the first line of the docstring (redundant with the one on the second line). -- ___ Python tracker <http://bugs.python.org/is

[issue25477] text mode for pkgutil.get_data

2015-10-25 Thread Antony Lee
New submission from Antony Lee: Initially suggested in #25330: it would be helpful to provide text mode support (returning unicode, and handling universal newlines) for pkgutil.get_data (either as a keyword argument, or as a separate function). -- components: Library (Lib) messages

[issue25527] Invalid (... and confusing) warning raised by 2to3 regarding repeat

2015-11-01 Thread Antony Lee
New submission from Antony Lee: $ echo 'from numpy import repeat\nrepeat(2, 3)' | 2to3 - RefactoringTool: Skipping optional fixer: buffer RefactoringTool: Skipping optional fixer: idioms RefactoringTool: Skipping optional fixer: set_literal RefactoringTool: Skipping optional fixer

[issue25632] Document BUILD_*_UNPACK opcodes

2015-11-15 Thread Antony Lee
New submission from Antony Lee: The additional unpack generalizations provided by Python3.5 rely on a new set of opcodes, BUILD_{TUPLE,LIST,DICT,SET}_UNPACK, that are not documented in the docs for the dis module. -- assignee: docs@python components: Documentation messages: 254715

[issue25912] Use __spec__.__name__ instead of __name__ in the docs where appropriate

2015-12-19 Thread Antony Lee
New submission from Antony Lee: There are a couple of places in the docs where it would be appropriate to replace __name__ by __spec__.__name__ in order to support the case where the module is executed as the __main__ module: - logging.getLogger should certainly use __spec__.__name__ so that

[issue26051] Non-data descriptors in pydoc

2016-01-08 Thread Antony Lee
New submission from Antony Lee: Consider the following minimal example: class readonlyprop: __init__ = lambda self, func: None __get__ = lambda self, inst, cls=None: None class C: def bar(self): pass @readonlyprop def foo(self

[issue26052] pydoc for __init__ with not docstring

2016-01-08 Thread Antony Lee
New submission from Antony Lee: For a class whose __init__ has no docstring, e.g. class C: def __init__(self, arg): pass pydoc outputs <... cropped ...> class C(builtins.object) | Methods defined here: | | __init__(sel

<    1   2   3   >