[issue37883] threading.Lock.locked is not documented
New submission from Rémi Lapeyre : As far as I can tell, it has never been documented. I'm not sure if it is deprecated but it has a docstring so it seems to me, that it just needs documentation in Doc/Library/threading.rst PS: I don't know how to set the beginner friendly flag. -- assignee: docs@python components: Documentation, Library (Lib) messages: 349923 nosy: docs@python, remi.lapeyre priority: normal severity: normal status: open title: threading.Lock.locked is not documented type: enhancement versions: Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue37883> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42722] Add --debug command line option to unittest to enable post-mortem debugging
Change by Rémi Lapeyre : -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue42722> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44166] Make IndexError messages for list more informative
Change by Rémi Lapeyre : -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue44166> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44169] Add HTTPS support to http.server
Rémi Lapeyre added the comment: This is already proposed in issue 40990 for which I am working on a PR. -- nosy: +remi.lapeyre versions: +Python 3.11 -Python 3.9 ___ Python tracker <https://bugs.python.org/issue44169> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue45644] Make json.tool soak up input before opening output for writing
Rémi Lapeyre added the comment: The proposed path does not work for `python -m json.tool --json-lines test.json test.json`. There is also https://github.com/python/cpython/pull/7865 that aims to fix this bug but I did not have the time to get back to it. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue45644> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38998] dict.setdefault (setdefault of dictionary)
Rémi Lapeyre added the comment: > > > def __init__(self): > vars(self).setdefault('default', self.set_default()) > vars(self).setdefault('default', self.set_default()) > This code is equivalent to def __init__(self): x = self.set_default() vars(self).setdefault('default', x) x = self.set_default() vars(self).setdefault('default', x) > because the argument is evaluated before the call to setdefault() so you can't optimise anything here. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue38998> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38998] dict.setdefault (setdefault of dictionary)
Rémi Lapeyre added the comment: The documentation is correct, in Python argument are computed before the call to a function, not when they are used. You can try other functions than dict.setdefault() and see that the behaviour is always the same. Le dim. 8 déc. 2019 à 22:47, da-dada a écrit : > > da-dada added the comment: > > I have no problem of making my programme run properly (asking first if in > dict etc), but I just read the docu of dict.setdefault > > setdefault(key[, default]) > If key is in the dictionary, return its value. If not, insert key with a > value of default and return default. default defaults to None. > > and it clearly reads if the key is.. return its value, with a full stop; > so either the docu is wrong (but proposes exactly the needed shortcut) or > python is as it is: come in & find out > > -- > > ___ > Python tracker > <https://bugs.python.org/issue38998> > ___ > -- ___ Python tracker <https://bugs.python.org/issue38998> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39759] os.getenv documentation is misleading
New submission from Rémi Lapeyre : The documentation states that "*key*, *default* and the result are str." at https://github.com/python/cpython/blame/3.8/Doc/library/os.rst#L224 but either I'm missing something or it's not actually true: $ python -c 'import os; print(type(os.getenv("FOO")))' $ python -c 'import os; print(type(os.getenv("FOO", default=1)))' Only *key* needs to be a string as it is used to lookup the value in os.environ. I think this can be fixed by a new contributor -- assignee: docs@python components: Documentation messages: 362689 nosy: docs@python, remi.lapeyre priority: normal severity: normal status: open title: os.getenv documentation is misleading type: enhancement versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue39759> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39759] os.getenv documentation is misleading
Rémi Lapeyre added the comment: I don't really have a preference regarding saying that `default` should be a string or not but the phrase should still be reworded to be less confusing. In typeshed it's documented with a generic type: https://github.com/python/typeshed/blob/master/stdlib/3/os/__init__.pyi#L363. -- ___ Python tracker <https://bugs.python.org/issue39759> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39783] Optimize construction of Path from other Paths by just returning the same object?
Rémi Lapeyre added the comment: There is the _closed attribute thought that is mutated by some methods. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue39783> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39783] Optimize construction of Path from other Paths by just returning the same object?
Rémi Lapeyre added the comment: > Decorating __new__ with lru_cache would likely run into memory leakage > problems? I think the LRU cache would be for returning the same instance when called with the same string. I don't think it would be needed to return the same instance when called with a Path instance. > From a quick look it appears to only be settable by using the path (not the > actual file) as a context manager, and only serves to block further > filesystem methods, but I'm not even sure why? This came up in bpo-39682 recently, I'm not sure what this flag is supposed to mean and I could not find it in the documentation. Since it's uncorrelated to the file object and the physical file, I think it may actually be dangerous to rely on this flag. I don't know why is the purpose of using Path as a context manager. -- ___ Python tracker <https://bugs.python.org/issue39783> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39817] CRITICAL: TypeError: cannot pickle 'generator'
Rémi Lapeyre added the comment: Hi Oscar, can you attach a small program that reproduce the error? It's probable that the error is in your code and not in Python. -- nosy: +remi.lapeyre -paul.moore, steve.dower, tim.golden, zach.ware ___ Python tracker <https://bugs.python.org/issue39817> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39828] json.tool should catch BrokenPipeError
Change by Rémi Lapeyre : -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue39828> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39841] "as" variable in except block deletes local variables with same name
Rémi Lapeyre added the comment: Hi Alan, this is documented at https://docs.python.org/3/reference/compound_stmts.html#the-try-statement: > When an exception has been assigned using as target, it is cleared at the end > of the except clause. This is as if > > except E as N: >foo > > was translated to > > except E as N: >try: >foo >finally: >del N > This is because the exception keeps a reference to the code frame that would make a cycle with the locals which would not be destroyed until the next garbage collection. I think you will need to use a different name in the except clause. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue39841> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39912] warnings.py should not raise AssertionError when validating arguments
New submission from Rémi Lapeyre : Currently simplefilter() and filterwarnings() don't validate their arguments when using -O and AssertionError is not the most appropriate exception to raise. I will post a PR shortly. -- components: Library (Lib) messages: 363732 nosy: remi.lapeyre priority: normal severity: normal status: open title: warnings.py should not raise AssertionError when validating arguments versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue39912> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39912] warnings.py should not raise AssertionError when validating arguments
Change by Rémi Lapeyre : -- keywords: +patch pull_requests: +18236 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18878 ___ Python tracker <https://bugs.python.org/issue39912> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39913] Document warnings.WarningMessage ?
Rémi Lapeyre added the comment: warnings.WarningMessage was added in https://bugs.python.org/issue26568 at the same time than _showwarnmsg_impl() and _formatwarnmsg_impl(). The goal was to have public functions that took them instead of multiple arguments so it could be easily extended in the future. It looks like it never happened and as of today there is no way to use warnings.WarningMessage in user code. Maybe it is time to bikeshed the names and add them? -- nosy: +remi.lapeyre, vstinner ___ Python tracker <https://bugs.python.org/issue39913> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39907] `pathlib.Path.iterdir()` wastes memory by using `os.listdir()` rather than `os.scandir()`
Rémi Lapeyre added the comment: This is not how timeit works, you just measured the time taken by an empty loop, you can look at `python3 -m timeit -h` to get help how to call it. I think a correct invocation would be: (venv) ➜ ~ python3 -m timeit -s 'from os import scandir' "list(scandir('/usr/local'))" 1 loops, best of 5: 24.3 usec per loop (venv) ➜ ~ python3 -m timeit -s 'from os import listdir' "listdir('/usr/local')" 1 loops, best of 5: 22.2 usec per loop so it looks like scandir as a small overhead when accumulating all results and not using the extra info it returns. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue39907> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35775] Add a general selection function to statistics
Change by Rémi Lapeyre : -- stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue35775> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40123] append() works not correct
Rémi Lapeyre added the comment: Hi merli, there is no bug here, you always append the same list to Liste so when modifying it you override previous values. You could make a copy of it by using `Liste.append(list(StringL))` instead of `Liste.append(StringL)` and you would get the behaviour you expect. Please ask questions in python-help or in StackOverflow for questions related to Python usage. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40123> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40132] Mechanism to control who owns package names on PyPI?
Rémi Lapeyre added the comment: Hi Chris, this is explicitly forbidden in the Terms of use of Pypi and the PEP 451 at https://www.python.org/dev/peps/pep-0541/#invalid-projects: > Invalid projects > A project published on the Package Index meeting ANY of the following is > considered invalid and will be removed from the Index: [...] > project is malware (designed to exploit or harm systems or users); [...] > project is name squatting (package has no functionality or is empty); -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40132> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40168] import pandas error[python 3.8.]
Rémi Lapeyre added the comment: Hi Harish, it looks like you are having an issue related to Pandas and not Python itself. This bug tracker is for issues related to Python, for issues related to Pandas you will want to open a new issue at https://github.com/pandas-dev/pandas -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40168> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40200] count 0 crash
Rémi Lapeyre added the comment: Hi Talha, you are using floating points division which convert its operands to floats so it loose precision for large numbers. The syntax for integer division in Python 3 is // and it will not change the type of its operands. Notice the difference below: >>> 100/10 % 10 4.0 >>> 100.0//10 % 10 4.0 >>> 100//10 % 10 0 As you can see, in the first example the operand got changed to float which caused a loss of precision and we get the same result when we try directly with a float. Using // gives the expected result. Python use perfect arithmetic for integers but IEEE 754 for floating point calculations. You will find that there is a lot of those "quirks" when using either very large or very small numbers and will need to be mindful of them. In the program you linked, changing '/' to '//' should gives the result you are expecting. -- nosy: +remi.lapeyre -furkanonder ___ Python tracker <https://bugs.python.org/issue40200> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40206] Multiplying 4.6*100 will result in 459.99999999999994
Rémi Lapeyre added the comment: Hi ahmad, calculation with floating points in Python uses the IEE 754 (https://fr.wikipedia.org/wiki/IEEE_754) standard and will result in such quirks. If you want to not loose precision you can use the decimal module: >>> from decimal import Decimal >>> Decimal('4.6')*100 Decimal('460.0') Since this is not a bug if you have other questions when working with floats, try to ask on python-list or a forum. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40206> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40206] Multiplying 4.6*100 will result in 459.99999999999994
Rémi Lapeyre added the comment: @Steven Yes that's true, I only meant that in the context of the issue where only the multiplication is used. FWIW Fraction also would have issues with e.g. trigonometric functions right? @ahmad, that's because you did Decimal(4.6) which first parse 4.6 as a float then call Decimal() with the result. You need to use Decimal('4.6') to avoid the parser reading 4.6 as a float. Have a look at the tutorial Eric Smith linked, the documentation of decimal and the response from Steven D'Aprano for more information. -- ___ Python tracker <https://bugs.python.org/issue40206> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40225] recursive call within generator expression is O(depth)
Rémi Lapeyre added the comment: Hi brendon, can you write a complete minimal example that shows the issue, it seems that you are heving an issue when consuming recursive generators and that it's actually not related to max(). I'm confused about the details and have not been able to write an example that exposes the issue from the various pieces of code you posted. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40225> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40225] recursive call within generator expression is O(depth)
Rémi Lapeyre added the comment: I'm unable to run the example as it segfaults on my computer because of the linear recursion but do you notice the same behavior with: from time import time from sys import setrecursionlimit setrecursionlimit(1000) def recurse(i): if i < 0: return recurse(i-1) if __name__ == '__main__': lo = 8 hi = 16 t = {} for sh in range(lo, hi): b4 = time() x = 1 << sh ret = recurse(x) after = time() t[sh] = after - b4 for sh in range(lo+1, hi): print(t[sh] / t[sh-1]) -- ___ Python tracker <https://bugs.python.org/issue40225> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40239] Add a function for merging sorted iterables
Rémi Lapeyre added the comment: Hi Serhiy, do you plan on writing a PR for this feature? If not I would love to have a go at it. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40239> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40225] recursive call within generator expression is O(depth)
Rémi Lapeyre added the comment: I've been looking at this, I find the effect more visible when you don't do the division in the last print(). After bisecting, it looks like ae3087c6382011c47db82fea4d05f8bbf514265d may account for most of the performance gap between 3.6 and 3.7. -- ___ Python tracker <https://bugs.python.org/issue40225> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40303] argparse parse_args args parameter bug or intended
Rémi Lapeyre added the comment: Hi Gharg, this is expected, both because your program would not actually receive `--boolean=''` but `--boolean=`: ➜ ~ cat test.py import sys print(sys.argv) ➜ ~ python test.py --boolean='' ['test.py', '--boolean='] and the way the type argument works. You can do what you are looking for by using: ➜ ~ cat test.py import argparse parser = argparse.ArgumentParser() parser.add_argument('--boolean', action='store_const', const=True, default=False) print(parser.parse_args()) ➜ ~ python test.py --boolean Namespace(boolean=True) ➜ ~ python test.py Namespace(boolean=False) -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40303> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40310] If use element from for in while loop it will have bad iterate.
Rémi Lapeyre added the comment: Hi Maks, when you report a bug please write a minimal example that show the bug so we don't have to read the whole application (https://stackoverflow.com/help/minimal-reproducible-example). I think in this case that the issue is that you overrride model on line 65 `model = car[1]` hence the error on the next iteration, model has been replaced. This bug tracker is for bugs in the Python interpreter, for help in using Python please use the python-help mailing list or a forum like StackOverflow. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40310> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40325] Random.seed does not affect string hash randomization leading to non-intuitive results
Rémi Lapeyre added the comment: String hash randomization is a security feature so it may be better to not disable it unless explicitly asked for. Maybe a note in random's documentation could be added? -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40325> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40255] Fixing Copy on Writes from reference counting
Rémi Lapeyre added the comment: >> We also have the real world app that is Instagram. > I don't think Instagram is a single app. What is Python used for at Instagram? According to their engineering blog (https://instagram-engineering.com/static-analysis-at-scale-an-instagram-story-8f498ab71a0c): > Our server app is a monolith, one big codebase of several million lines and a > few thousand Django endpoints [1], all loaded up and served together. A few > services have been split out of the monolith, but we don’t have any plans to > aggressively break it up. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40255> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40351] How to edit "python --help"?
Rémi Lapeyre added the comment: Hi Nino, the text for `python --help` is here : https://github.com/python/cpython/blob/master/Python/initconfig.c#L28-L130 -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40351> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40352] SocketHandler silently drops log messages on re-connect
Rémi Lapeyre added the comment: On one hand it's bad messages get lost, one the other retrying to send the message would take a lot of time and make `SocketHandler` very slow. Maybe we could had the record to a very short queue so we can retry to send it with the next message? -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40352> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40355] The ast module fails to reject certain malformed nodes
Change by Rémi Lapeyre : -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40355> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40363] shlex.quote applied to a glob pattern disables glob matching
Rémi Lapeyre added the comment: shlex.quote makes the string safe to pass a command, what if it's rm 'var/log/syslog*' instead? You make sure that only the file given would be removed but then shlex.quote() shoot you in the foot. This would also cause issues for files with '*' or another special characters in the name, you would not be able to pass their name anymore. Also, not all shells have the same glob patterns and some of them are actually configurable to enable more patterns, so it would be impossible to know what to escape or not, shlex.quote() just quote everything unconditionnaly If you want to allow '*' at the end or inside the pattern I think the best way is to look for it in your application, split (or take the prefix if you only want to allow it in the end), use shlex.quote() on the parts and concatenate with '*'. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40363> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40363] shlex.quote applied to a glob pattern disables glob matching
Change by Rémi Lapeyre : -- type: -> behavior versions: +Python 3.9 -Python 3.7 ___ Python tracker <https://bugs.python.org/issue40363> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39385] Add an assertNoLogs context manager to unittest TestCase
Rémi Lapeyre added the comment: This makes sense, should assertNoWarns() be added too? -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue39385> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40387] queue example it does not work
Rémi Lapeyre added the comment: In general examples in the documentation may lack some things like imports as they are implicit but in this case it also lack do_work(), source() and num_worker_threads. You could use os.cpu_count() instead of your hard-coded value and the comment. Can you open a pull request with your change? -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40387> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40372] doctest example programs should exit 1 if any test fails
Change by Rémi Lapeyre : -- nosy: +remi.lapeyre, tim.peters versions: -Python 2.7, Python 3.5, Python 3.6 ___ Python tracker <https://bugs.python.org/issue40372> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue31122] SSLContext.wrap_socket() throws OSError with errno == 0
Change by Rémi Lapeyre : -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue31122> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40402] multiprocessing/connection.py broken handle
Rémi Lapeyre added the comment: Hi Maxi, Python 3.5 now only accept security fixes. Can you reproduce this issue with recent releases and post an example here? -- nosy: +remi.lapeyre type: crash -> behavior ___ Python tracker <https://bugs.python.org/issue40402> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40402] Race condition in multiprocessing/connection.py: broken handle
Rémi Lapeyre added the comment: A call to self._check_closed() is already present in Python 3.5 https://github.com/python/cpython/blob/3.5/Lib/multiprocessing/connection.py#L202-L206 It is possible for some issues to appear when mixing multiprocessing and multithreading thought: In [17]: from time import sleep ...: import multiprocessing, threading ...: ...: class Test: ...: def __reduce__(self): ...: sleep(1) ...: return (Test, ()) ...: ...: parent, child = multiprocessing.Pipe() ...: threading.Thread(target=lambda: parent.send(Test())).start() ...: parent.close() Exception in thread Thread-7: Traceback (most recent call last): File "/Users/remi/src/cpython/Lib/threading.py", line 950, in _bootstrap_inner self.run() File "/Users/remi/src/cpython/Lib/threading.py", line 888, in run self._target(*self._args, **self._kwargs) File "", line 10, in /Users/remi/src/cpython/venv/lib/python3.9/site-packages/prompt_toolkit/renderer.py:514: DeprecationWarning: The explicit passing of coroutine objects to asyncio.wait() is deprecated since Python 3.8, and scheduled for removal in Python 3.11. await wait(coroutines, return_when=FIRST_COMPLETED) File "/Users/remi/src/cpython/Lib/multiprocessing/connection.py", line 211, in send self._send_bytes(_ForkingPickler.dumps(obj)) File "/Users/remi/src/cpython/Lib/multiprocessing/connection.py", line 416, in _send_bytes self._send(header + buf) File "/Users/remi/src/cpython/Lib/multiprocessing/connection.py", line 373, in _send n = write(self._handle, buf) TypeError: an integer is required (got type NoneType) Maybe using a try-catch block could be more appropriate than the current check. CC-ing Antoine Pitrou as he is the original author of this part in 87cf220972c9cb400ddcd577962883dcc5dca51a. If you are OK with replacing calls to self._check_closed() by an exception block I would be happy to open a PR for this. -- components: +Library (Lib) nosy: +pitrou title: multiprocessing/connection.py broken handle -> Race condition in multiprocessing/connection.py: broken handle versions: +Python 3.7, Python 3.8, Python 3.9 -Python 3.5 ___ Python tracker <https://bugs.python.org/issue40402> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40402] Race condition in multiprocessing/connection.py: broken handle
Change by Rémi Lapeyre : -- keywords: +patch pull_requests: +19113 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/19790 ___ Python tracker <https://bugs.python.org/issue40402> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40437] add string.snake function
Rémi Lapeyre added the comment: I don't understand the motivation, why would it be very useful when working with titles of columns that are to be used in databases columns? Databases can handle columns with spaces in their name: postgres=# create temporary table foo ("column with spaces" text); CREATE TABLE Time: 29,973 ms postgres=# insert into foo values ('bar'); INSERT 0 1 Time: 0,746 ms postgres=# select * from foo; column with spaces bar (1 row) Time: 3,452 ms There is also various library available to do this on Pypi like https://github.com/okunishinishi/python-stringcase and https://github.com/jpvanhal/inflection. I'm pretty sure I used inflection at one company and it worked great. Finally, the issue on the Pandas repository says how to do it: you can use Series.apply. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40437> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36825] Make TestCase aware of the command line arguments given to TestProgram
Rémi Lapeyre added the comment: Bumping this issue as issue 37873 that wants to add a new -j argument to unittest got some attention lately. This PR makes the Test Cases aware of the command line arguments given to unittest.main() and is needed to add the --pdb argument proposed in issue 18765 to run pdb.post_mortem() when an exception occurs during a test. Both this issue and #18765 would be very useful to augment unittest. -- nosy: +gregory.p.smith, terry.reedy versions: +Python 3.9 -Python 3.8 ___ Python tracker <https://bugs.python.org/issue36825> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40471] Grammar typo in issubclass docstring
Rémi Lapeyre added the comment: Hi Alex, thanks for reporting this. A PR will be needed to fix those indeed. Regarding argument clinic, the file you will need to change is Python/bltinmodule.c and you can run `make regen-all` to regenerate the other file. There is more information about this in the Python dev guide: https://devguide.python.org/ For the Pull Request to be accepted you will need to sign the Contributor License Agreement, the steps to follow are here: https://devguide.python.org/pullrequest/#cla, a bot will reemind you if you forget :) -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40471> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40471] Grammar typo in issubclass docstring
Change by Rémi Lapeyre : -- versions: +Python 3.9 -Python 3.8 ___ Python tracker <https://bugs.python.org/issue40471> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40476] Write file failed on OS X 10.15.4
Rémi Lapeyre added the comment: Hi, I can't reproduce the issue but the fact that you did not close the file is suspicious. What does with open('test_output','w') as f: length = 195364 for i in range(length): f.write(str(i)+'\r\n') gives? -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40476> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40497] subprocess.check_output() accept the check keyword argument
New submission from Rémi Lapeyre : The subprocess.check_output() raises TypeError when given the `check` keyword-argument: Python 3.8.2 (v3.8.2:7b3ab5921f, Feb 24 2020, 17:52:18) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import subprocess >>> subprocess.check_output(['ls'], check=False) Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 411, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, TypeError: run() got multiple values for keyword argument 'check' It should just use True as the default when it's not specified in kwargs. -- components: Library (Lib) messages: 368027 nosy: remi.lapeyre priority: normal severity: normal status: open title: subprocess.check_output() accept the check keyword argument type: behavior versions: Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue40497> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40497] subprocess.check_output() accept the check keyword argument
Change by Rémi Lapeyre : -- keywords: +patch pull_requests: +19208 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19897 ___ Python tracker <https://bugs.python.org/issue40497> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40496] re.findall() takes a long time (100% cup usage) on Python 3.6.10
Rémi Lapeyre added the comment: I don't think this is a deadlock rather it is certainly related to the number of '*' there is in your pattern, the regexp has to search an exponentially growing number of patterns. You could try a simple pattern to match your attribute and it should be faster. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40496> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40497] subprocess.check_output() accept the check keyword argument
Rémi Lapeyre added the comment: > check_output() should not accept check=False. I thought about raising ValueError instead but `subprocess.check_output([...], check=False)` is actually a convenient shortcut over `subprocess.run([...], stdout=subprocess.PIPE).stdout` and I can't think of much drawbacks if someone explicitly ask for the check to be disabled. Is there any way we could have that? -- ___ Python tracker <https://bugs.python.org/issue40497> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40497] subprocess.check_output() accept the check keyword argument
Rémi Lapeyre added the comment: > Now a reviewer has to check that a developer uses the validate_result() > function *and* the developer is not passing validate=False into the function. Fair enough, I updated the PR to raise ValueError instead. -- ___ Python tracker <https://bugs.python.org/issue40497> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40028] Math module method to find prime factors for non-negative int n
Change by Rémi Lapeyre : -- nosy: +remi.lapeyre nosy_count: 7.0 -> 8.0 pull_requests: +19232 pull_request: https://github.com/python/cpython/pull/19918 ___ Python tracker <https://bugs.python.org/issue40028> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40028] Math module method to find prime factors for non-negative int n
Rémi Lapeyre added the comment: >> Regardless, how can we best move forward with this idea? > Provide a pull request. Hi, I looked into what scientific programs where doing. Most of them uses a form of the Baillie–PSW primality test which is a probabilistic primality test that's never wrong up to 2**64 and for which their is currently no known pseudoprime. This first version I wrote uses a deterministic variant of the Miller-Rabin test for n < 3317044064679887385961981. For larger n, a probabilistic Miller-Rabin test is used with s=25 random bases. The probabilistic Miller-Rabin test is never wrong when it concludes that n is composite and has a probability of error of 4^(-s) when it concludes that n is prime. The implementations of next_prime() and previous_prime() are straightforward and factorise() uses the Phollard's rho heuristic which gives satisfactory results for numbers with small factors. It's a generator as it may hang when n has very large factors e.g. 2**(2**8)+1. I implemented all functions Steven D'Aprano suggested but did not bother with the sieve as Tim Peters already provided one in the python-ideas thread. The code is in imath for now but I can move it. Hopefully this is enough to bikeshed the API, if this proposal is accepted I will write more tests and fix any bug found. -- ___ Python tracker <https://bugs.python.org/issue40028> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40028] Math module method to find prime factors for non-negative int n
Rémi Lapeyre added the comment: I can't mark the issue as open thought, can someone do this? -- ___ Python tracker <https://bugs.python.org/issue40028> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40516] GCC 9 compiler warnings on MacOS Catalina
New submission from Rémi Lapeyre : Building master with GCC 9.3.0 gives some warnings on posix and nis: ./Modules/posixmodule.c: In function 'os_chown_impl': ./Modules/posixmodule.c:3397:39: warning: the comparison will always evaluate as 'false' for the address of 'lchown' will never be NULL [-Waddress] 3397 | if ((!follow_symlinks) && (lchown == NULL)) { | ^~ ./Modules/posixmodule.c: In function 'PyInit_posix': ./Modules/posixmodule.c:14939:16: warning: the comparison will always evaluate as 'false' for the address of 'lchown' will never be NULL [-Waddress] 14939 | if (lchown == NULL) { |^~ /Users/remi/src/cpython/Modules/nismodule.c: In function 'nis_cat': /Users/remi/src/cpython/Modules/nismodule.c:216:18: warning: cast between incompatible function types from 'int (*)(int, char *, int, char *, int, struct ypcallback_data *)' to 'int (*)(long unsigned int, char *, int, char *, int, void *)' [-Wcast-function-type] 216 | cb.foreach = (foreachfunc)nis_foreach; | ^ /Users/remi/src/cpython/Modules/nismodule.c: In function 'nis_xdr_ypmaplist': /Users/remi/src/cpython/Modules/nismodule.c:302:42: warning: cast between incompatible function types from 'int (*)(XDR *, nismaplist *)' {aka 'int (*)(struct __rpc_xdr *, struct nismaplist *)'} to 'int (*)(XDR *, void *, unsigned int)' {aka 'int (*)(struct __rpc_xdr *, void *, unsigned int)'} [-Wcast-function-type] 302 | sizeof(nismaplist), (xdrproc_t)nis_xdr_ypmaplist)) | ^ /Users/remi/src/cpython/Modules/nismodule.c: In function 'nis_xdr_ypresp_maplist': /Users/remi/src/cpython/Modules/nismodule.c:328:42: warning: cast between incompatible function types from 'int (*)(XDR *, nismaplist *)' {aka 'int (*)(struct __rpc_xdr *, struct nismaplist *)'} to 'int (*)(XDR *, void *, unsigned int)' {aka 'int (*)(struct __rpc_xdr *, void *, unsigned int)'} [-Wcast-function-type] 328 | sizeof(nismaplist), (xdrproc_t)nis_xdr_ypmaplist)) | ^ In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/rpc/rpc.h:76, from /Users/remi/src/cpython/Modules/nismodule.c:17: /Users/remi/src/cpython/Modules/nismodule.c: In function 'nisproc_maplist_2': /Users/remi/src/cpython/Modules/nismodule.c:344:19: warning: cast between incompatible function types from 'int (*)(XDR *, char **)' {aka 'int (*)(struct __rpc_xdr *, char **)'} to 'int (*)(XDR *, void *, unsigned int)' {aka 'int (*)(struct __rpc_xdr *, void *, unsigned int)'} [-Wcast-function-type] 344 | (xdrproc_t)nis_xdr_domainname, (caddr_t)argp, | ^ /Users/remi/src/cpython/Modules/nismodule.c:345:19: warning: cast between incompatible function types from 'int (*)(XDR *, nisresp_maplist *)' {aka 'int (*)(struct __rpc_xdr *, struct nisresp_maplist *)'} to 'int (*)(XDR *, void *, unsigned int)' {aka 'int (*)(struct __rpc_xdr *, void *, unsigned int)'} [-Wcast-function-type] 345 | (xdrproc_t)nis_xdr_ypresp_maplist, (caddr_t)&res, | ^ I'm not sure about the fix, especially for nis but I will propose a PR. There is also some warnings concerning libffi_osx but this looks like a vendored dependency so I left it untouched. -- components: Build messages: 368146 nosy: remi.lapeyre priority: normal severity: normal status: open title: GCC 9 compiler warnings on MacOS Catalina type: behavior ___ Python tracker <https://bugs.python.org/issue40516> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40516] GCC 9 compiler warnings on MacOS Catalina
Change by Rémi Lapeyre : -- keywords: +patch pull_requests: +19240 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19925 ___ Python tracker <https://bugs.python.org/issue40516> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40531] Adding the method find() to list
Rémi Lapeyre added the comment: Hi João, ideas like this can also be proposed first on the python-ideas mailing list but as you said in your post there is already a method to do this and it raises ValueError when it is not found which is a common idiom in Python. Other objects don't often have two versions of the same method, one that raises an exception on error and one that returns a sentinel, most only have the one that raises. Notice that your example is not simpler with your proposal: # Example driver code: index = find(list, possible_element) if index_of_element == -1: pass # Not found else: pass # Found is a hard to read than and actually longer: try: index = list.index(possible_element) except ValueError: index = -1 if you really care about the number of lines you could use, while I don't recommend it: try: index = list.index(possible_element) except ValueErrort: index = -1 Also adding a new method to list would mean adding it to all sequence objects and that is asking for a lot. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40531> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40560] uuid.uuid4().hex not random
Rémi Lapeyre added the comment: This is expected, while part of them are randomly generated, some bits are always set: https://tools.ietf.org/html/rfc4122#section-4.1.3. This let you know that the UUID you have is a version 4 just by looking at it, it's not a bug. -- components: +Library (Lib) -Extension Modules nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40560> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40579] Second argument to iterator.next not described
Rémi Lapeyre added the comment: It's documented here: https://docs.python.org/3/library/functions.html#next -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40579> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40580] Macintosh Documentation Still Bad
Rémi Lapeyre added the comment: Hi Gleen, this looks like there already exists an issue for this problem, please use it instead of opening a new one. Can you please open a new Pull-Request for solving this issue? -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40580> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue32824] Docs: Using Python on a Macintosh has bad info per Apple site
Rémi Lapeyre added the comment: Hi Gleen, the best way forward is to propose an improvement to the current documentation. It will get reviewed and merge if appropriate. The source for this part is at https://github.com/python/cpython/blob/master/Doc/using/mac.rst and you can find the information needed to contribute in the Python Dev Guide: https://devguide.python.org/. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue32824> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40603] slice not hashable
Rémi Lapeyre added the comment: I think slices were explicitly made not hashable to avoid issues to avoid issues with dictionaries, see discussion at https://mail.python.org/pipermail/python-list/2001-March/076101.html and issue 408326. The commit that did this is https://github.com/python/cpython/commit/a1351fbd884189329bbcb6c688ca992fc1afc3f6 Is this not needed anymore? Wouldn't this need to be discussed on python-ideas? -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40603> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40331] Increase test coverage for the statistics module
Rémi Lapeyre added the comment: >> Perhaps you missed it because you're not in the CODEOWNERS so don't >> automatically get notified by GitHub? > That's quite possible. I can't fix that as Github considers everything to do with my computer and browser too old. I don't think you need to use the Github interface to change this, you can update the .github/CODEOWNERS file and push the change in a new commit. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40331> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40624] add support for != (not-equals) in ElementTree XPath
Change by Rémi Lapeyre : -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40624> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40649] [Errno 1]
Rémi Lapeyre added the comment: Hi Glenn, this is probably not a bug in Python and more information about the error and the context would be needed if it was. Bugs must be reproducible to be looked at and fixed and your post does not contain enough information to do so. You should redirect your friend to a forum like StackOverflow or the python-help mailing list to get help with his script. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40649> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40649] [Errno 1]
Rémi Lapeyre added the comment: The error message you linked does not show an issue with the Python installation but the permissions are wrong on the 'howdy.py' file, that's what the error message says: can't open file 'howdy.py': [Errno 1] Operation not permitted You have to check the permissions on the file to make sure the Python interpreter can read it. This is not a bug in the Python interpreter which this bug tracker is for, the python-help mailing list and StackOverflow will give you the help you are looking for. -- ___ Python tracker <https://bugs.python.org/issue40649> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40649] [Errno 1]
Rémi Lapeyre added the comment: It's because application on recent versions of MacOS cannot access files in some directories without being granted permission explicitly, a permission model similar to what iOS and Android. You can grant them additional permission using System Preferences, see https://osxdaily.com/2018/10/09/fix-operation-not-permitted-terminal-error-macos/ for example. All applications on recent version of MacOS behaves like this and this is not a bug in Python. -- ___ Python tracker <https://bugs.python.org/issue40649> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40670] supplying an empty string to timeit causes an IndentationError
Rémi Lapeyre added the comment: Is this different than what you would expect? Supplying garbage to timeit will result in an error: >>> from timeit import timeit >>> timeit('weofinwofinwe') Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/timeit.py", line 232, in timeit return Timer(stmt, setup, timer, globals).timeit(number) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/timeit.py", line 176, in timeit timing = self.inner(it, self.timer) File "", line 6, in inner NameError: name 'weofinwofinwe' is not defined If you want to time an empty loop, you can use: >>> timeit('pass', number=1) 0.000104323021822 -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40670> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40673] urllib.request.URLopener raises different exceptions based on implementation detail
Rémi Lapeyre added the comment: URLOpener has been deprecated since Python3.3 (https://github.com/python/cpython/blob/master/Lib/urllib/request.py#L1703-L1705) maybe it should just be removed from the codebase? -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40673> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40674] Deprecate urllib.request.urlretrieve() and cleanup()
Change by Rémi Lapeyre : -- components: Library (Lib) nosy: remi.lapeyre priority: normal severity: normal status: open title: Deprecate urllib.request.urlretrieve() and cleanup() type: behavior ___ Python tracker <https://bugs.python.org/issue40674> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40674] Deprecate urllib.request.urlretrieve() and cleanup()
Change by Rémi Lapeyre : -- keywords: +patch pull_requests: +19497 stage: -> patch review pull_request: https://github.com/python/cpython/pull/20197 ___ Python tracker <https://bugs.python.org/issue40674> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40681] shelve.open() should accept pathlib.Path
New submission from Rémi Lapeyre : This should target Python3.10, current behavior is: Python 3.10.0a0 (heads/master:19e3e00264, May 19 2020, 14:40:31) [Clang 11.0.3 (clang-1103.0.32.29)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import shelve, pathlib >>> shelve.open(pathlib.Path('spam')) Traceback (most recent call last): File "", line 1, in File "/Users/remi/src/cpython/Lib/shelve.py", line 243, in open return DbfilenameShelf(filename, flag, protocol, writeback) File "/Users/remi/src/cpython/Lib/shelve.py", line 227, in __init__ Shelf.__init__(self, dbm.open(filename, flag), protocol, writeback) File "/Users/remi/src/cpython/Lib/dbm/__init__.py", line 78, in open result = whichdb(file) if 'n' not in flag else None File "/Users/remi/src/cpython/Lib/dbm/__init__.py", line 113, in whichdb f = io.open(filename + ".pag", "rb") TypeError: unsupported operand type(s) for +: 'PosixPath' and 'str' >>> -- components: Library (Lib) messages: 369349 nosy: remi.lapeyre priority: normal severity: normal status: open title: shelve.open() should accept pathlib.Path type: behavior ___ Python tracker <https://bugs.python.org/issue40681> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39782] local varible referenced a Exception won't be collected in function
Change by Rémi Lapeyre : -- nosy: +remi.lapeyre nosy_count: 2.0 -> 3.0 pull_requests: +19562 pull_request: https://github.com/python/cpython/pull/20288 ___ Python tracker <https://bugs.python.org/issue39782> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue29847] Path takes and ignores **kwargs
Rémi Lapeyre added the comment: PurePath subclasses cannot support kwargs as __new__() does not accept **kwargs: >>> from pathlib import PurePath >>> class MyPurePath(PurePath): ... def __init__(self, *args, **kargs): pass ... >>> MyPurePath('foo', spam=True) Traceback (most recent call last): File "", line 1, in TypeError: __new__() got an unexpected keyword argument 'spam' The behaviour for this should probably be made the same for both Path and PurePath. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue29847> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39783] Optimize construction of Path from other Paths by just returning the same object?
Change by Rémi Lapeyre : -- keywords: +patch pull_requests: +19563 stage: -> patch review pull_request: https://github.com/python/cpython/pull/20288 ___ Python tracker <https://bugs.python.org/issue39783> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue39782] local varible referenced a Exception won't be collected in function
Change by Rémi Lapeyre : -- pull_requests: -19562 ___ Python tracker <https://bugs.python.org/issue39782> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40273] mappingproxy isn't reversible
Rémi Lapeyre added the comment: I think this issue can be closed thanks to Zackery Spytz. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40273> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40713] _zoneinfo.c can use dst_offset without initialization in parse_tz_str()
Change by Rémi Lapeyre : -- keywords: +patch pull_requests: +19564 stage: -> patch review pull_request: https://github.com/python/cpython/pull/20289 ___ Python tracker <https://bugs.python.org/issue40713> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40713] _zoneinfo.c can use dst_offset without initialization in parse_tz_str()
New submission from Rémi Lapeyre : Here's the warning given by clang: /Users/remi/src/cpython/Modules/_zoneinfo.c:1487:9: warning: variable 'dst_offset' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (*p == '\0') { ^~ /Users/remi/src/cpython/Modules/_zoneinfo.c:1544:50: note: uninitialized use occurs here build_tzrule(std_abbr, dst_abbr, std_offset, dst_offset, start, end, out); ^~ /Users/remi/src/cpython/Modules/_zoneinfo.c:1487:5: note: remove the 'if' if its condition is always false if (*p == '\0') { ^ /Users/remi/src/cpython/Modules/_zoneinfo.c:1460:32: note: initialize the variable 'dst_offset' to silence this warning long std_offset, dst_offset; ^ = 0 /Users/remi/src/cpython/Modules/_zoneinfo.c:1910:19: warning: suggest braces around initialization of subobject [-Wmissing-braces] _tzrule rv = {0}; ^ {} Looking at the code path, the unitialized dst_offset may create a ZoneInfo with a garbage value in dstoff with some inputs so this should be backported to Python3.9 too. -- components: Library (Lib) messages: 369523 nosy: remi.lapeyre priority: normal severity: normal status: open title: _zoneinfo.c can use dst_offset without initialization in parse_tz_str() type: behavior versions: Python 3.10, Python 3.9 ___ Python tracker <https://bugs.python.org/issue40713> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40690] unittest: if FunctionTestCase is imported, the loader loads "tests" from it
Rémi Lapeyre added the comment: Hi Vitalii, can you give more context about why you are writing this code, what you expect it to do and why is there a bug? -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40690> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40721] PEP0435 (enums) -- there is no standard on enum item letters case
Rémi Lapeyre added the comment: There is no official way, you can find both in the Python tree: all caps at https://github.com/python/cpython/blob/master/Lib/ast.py#L615-L636 and snake case at https://github.com/python/cpython/blob/master/Lib/uuid.py#L76-L79. I think it's common to use all caps for those that are used as flags (i.e. where each value is a power of 2 and that may be combined using bigs operations) but there is no one true way that you can enforced, it depends on the context. Also, note that pep8 covers the code of Python, it's not a rule that must be blindly applied to all Python code and that you may ignore it for various reasons: https://www.python.org/dev/peps/pep-0008/#a-foolish-consistency-is-the-hobgoblin-of-little-minds. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40721> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40726] ast.Call end_lineno is defined and returns None
Rémi Lapeyre added the comment: This was done in b7e9525f9c7ef02a1d2ad8253afdeb733b0951d4 for issue 36287, all attribute should now be defined, even when they are not set. It looks like some parts of the ast module where not updated. If nobody works on this I will send a PR to update the rest of AST later today. -- components: +Library (Lib) nosy: +remi.lapeyre -BTaskaya, serhiy.storchaka type: -> behavior versions: +Python 3.10 ___ Python tracker <https://bugs.python.org/issue40726> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40028] Math module method to find prime factors for non-negative int n
Rémi Lapeyre added the comment: Hi Mark Dickinson, I was waiting for everyone to have a chance to comment on this issue and read their reply before answering. It seems to me that there some core developers are mildly in favor of a new imath module and it's has been proposed on the bug tracker and python-ideas while other would prefer it as an external package. I agree with the idea that that using gfactor is not the best, it may not be installed and has different names on different OS. The state of the art algorithms used by others languages and libraries for numbers up to 2**64 are not very complicated, as Steven D'Aprano said deterministic MR works incredibly well for numbers < 2**64 and that's what I implemented with a probabilistic test for larger number. It only misses a Lucas test to be a complete Baillie–PSW test. As you said the PEP would have to explain why not just use sympy and honestly I don't have a very good argument there for now. In the end, if some core devs think that putting together the various discussions for an imath module in a coherent PEP so it can be discussed and either: - accepted and merged, - refused with some functions merged in math, - definitely put to bed would be useful and prevent additional discussions around this idea, I'm willing to do the leg work (thought I may take me some time). If nobody thinks it would be really helpful, I may focus my time on other issues. -- ___ Python tracker <https://bugs.python.org/issue40028> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40745] Typo in library/typing
Rémi Lapeyre added the comment: Hi Héctor, can you open a new PR with those changes? -- nosy: +remi.lapeyre versions: -Python 3.5, Python 3.6, Python 3.7 ___ Python tracker <https://bugs.python.org/issue40745> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40743] [CMake] It's 2020, where is CMake?
Rémi Lapeyre added the comment: Can you point to specific issues with the current build system? It seems to me that for 1. it will only make it easier for projects that use CMake, 2. the build system is not the only part needed to support a new OS and for 3. I've not found Python to be particularly slow to build for such a large program. You may want to look at ccache if you want to speed you build process (I'm not using it on this computer and it's still quite fast, Make will only rebuild the appropriate object files already unless you explicitly clean them). Before making large changes to the build system, you should open a thread on the python-ideas mailing list, there was some discussion about this a few years back but maybe now that Python2 is gone it would be easier to make this change? -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40743> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40752] Implement PurePath.__len__
Rémi Lapeyre added the comment: PurePath is not iterable but I would expect len(Path('/home/remi/src/cpython')) == 4 The fact the the path is stored as a string is an implementation detail, it seems leaky to get the length of the string here. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40752> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40752] Implement PurePath.__len__
Rémi Lapeyre added the comment: > Remi: Your use case is taken care of by `len(path.parts)`. Yes, and your use case is taken care of by `len(str(path))` which works as well. The reason in the PR is to simplify: sorted(paths, key=lambda path: len(str(path)), reverse=True) to sorted(paths, key=len, reverse=True) but why avoiding a few characters? My remark is not that it __len__ should be len(path.parts) but that the semantics are unclear (I should have wrote "**if __len__ is defined** I would expect...") Since the semantics are unclear I would except it not to be defined. Also, it's common to use a lambda or an helper function in sorted(), map(), filter(), etc. Most use case can't be covered using existing methods and shouldn't necessarely be. -- ___ Python tracker <https://bugs.python.org/issue40752> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40762] Writing bytes using CSV module results in b prefixed strings
Rémi Lapeyre added the comment: > As an example, if I write character "A" as a byte, i.e b'A' in a csv file But you can't write b'A' in a csv file, what you can't do is write `b'a'.decode()` or `b'a'.decode('latin1')` or `b'a'.decode('whatever')` but the string representation of a byte string is dependant on the character encoding and it's not possible to guess it, which is why bytes and string were separated in Python3 in the first place. Since csv can't write bytes, it gets a string representation of the by calling str(), as it would with any other objects. > which is not what the user would have wanted in majority of the use-cases If you try to guess the encoding, you will obligatory fail in some case and the resulting file will be corrupted. The only way here is for your users to fix their program and decode thee byte string using the correct encoding before giving them to csv. -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40762> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40768] pyaudio
New submission from Rémi Lapeyre : Hi Mansi, this is not an issue in the Python interpreter but with a third party module. This bug tracker is only for reporting issues with the CPython interpreter. If you read the error message you attached, there is some steps given to fix your issue, you can also ask for help on StackOverflow or the python-list mailing list. -- nosy: +remi.lapeyre type: compile error -> ___ Python tracker <https://bugs.python.org/issue40768> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40762] Writing bytes using CSV module results in b prefixed strings
Rémi Lapeyre added the comment: > in real-life that b-prefixed string is just not readable by another program > in an easy way If another program opens this CSV file, it will read the string "b'A'" which is what this field actually contains. Everything that is not a number or a string gets converted to a string: In [1]: import collections, dataclasses, random, secrets, io, csv ...: ...: Point = collections.namedtuple('Point', 'x y') ...: ...: @dataclasses.dataclass ...: class Valar: ...: name: str ...: age: int ...: ...: a = Point(1, 2) ...: b = Valar('Melkor', 2900) ...: c = secrets.token_bytes(4) ...: ...: out = io.StringIO() ...: f = csv.writer(out) ...: f.writerow((a, b, c)) ...: ...: out.seek(0) ...: print(out.read()) ...: "Point(x=1, y=2)","Valar(name='Melkor', age=2900)",b'\x95g6\xa2' Here another would find three fields, all strings: "Point(x=1, y=2)", "Valar(name='Melkor', age=2900)" and "b'\x95g6\xa2'". Would you expect to get actual objects instead of strings when reading the two first fields? > Incase it fails to decode using that, then it will throw a UnicodeDecodeError I read your PR, but succeeding to decode it does not mean it's correct: In [4]: b'r\xc3\xa9sum\xc3\xa9'.decode('latin') Out[4]: 'résumé' It worked, but is it the appropriate encoding? Probably not In [5]: b'r\xc3\xa9sum\xc3\xa9'.decode('utf8') Out[5]: 'résumé' If you want to be able to save bytes, the best way is to use a format that can roundtrip bytes like parquet: In [18]: df = pd.DataFrame.from_dict({'a': [b'a']}) In [19]: df.to_parquet('foo.parquet') In [20]: type(pd.read_parquet('foo.parquet')['a'][0]) Out[20]: bytes -- ___ Python tracker <https://bugs.python.org/issue40762> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40762] Writing bytes using CSV module results in b prefixed strings
Rémi Lapeyre added the comment: I don't think this would be accepted but I think you could try to propose that on the python-ideas mailing list to get some feedback on your proposal. -- nosy: +skip.montanaro ___ Python tracker <https://bugs.python.org/issue40762> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40787] Mysql + unittest crash
Rémi Lapeyre added the comment: Hi Lucas, this is probably not an issue with unittest but a bug in the test themselves. Can you attach an example to reproduce the issue? -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue40787> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40797] multiprocessing.Semaphore has undocumented get_value() method
New submission from Rémi Lapeyre : The threading.Semaphore class does not have this method, it is undocumented and useless on some system (at least MacOS): >>> s.get_value() Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/synchronize.py", line 129, in get_value return self._semlock._get_value() NotImplementedError The implementation is at https://github.com/python/cpython/blob/master/Modules/_multiprocessing/semaphore.c#L537-L553 I think this method could be removed, since it's undocumented and probably not used can I just remove it or does it need a deprecation cycle? -- components: Library (Lib) messages: 370128 nosy: remi.lapeyre priority: normal severity: normal status: open title: multiprocessing.Semaphore has undocumented get_value() method type: behavior versions: Python 3.10 ___ Python tracker <https://bugs.python.org/issue40797> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40690] unittest: if FunctionTestCase is imported, the loader loads "tests" from it
Rémi Lapeyre added the comment: I checked and FunctionTestCase seems to completely break the loader. The tests for FunctionTestCase in the standard library instantiate the class from inside the method of a TestCase so the loader never see them but even the simple test file I attached completely breaks: ✗ python3 -m unittest E == Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 193, in _run_module_as_main return _run_code(code, main_globals, None, File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 86, in _run_code exec(code, run_globals) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/__main__.py", line 18, in main(module=None) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/main.py", line 101, in __init__ self.runTests() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/main.py", line 271, in runTests self.result = testRunner.run(self.test) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/runner.py", line 183, in run result.printErrors() File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/runner.py", line 109, in printErrors self.printErrorList('ERROR', self.errors) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/runner.py", line 115, in printErrorList self.stream.writeln("%s: %s" % (flavour,self.getDescription(test))) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/runner.py", line 47, in getDescription return '\n'.join((str(test), doc_first_line)) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/unittest/case.py", line 1472, in __str__ self._testFunc.__name__) AttributeError: 'str' object has no attribute '__name__' I look at plenty of usages of FunctionTestCase on Github and all of them seemed to be false positive, they were copies of the unittest/test/test_functiontestcase.py file The patch in the attached PR is not correct thought, it only fixes one of the loader and all of them suffer from the same issue. -- versions: +Python 3.10 Added file: https://bugs.python.org/file49196/test_functiontest.py ___ Python tracker <https://bugs.python.org/issue40690> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue40798] The deprecated-removed Sphinx extension need to change the error message based on the Python version
New submission from Rémi Lapeyre : The new deprecated-removed extension in the documentation always produces text like this: Deprecated since version 3.4, will be removed in version 3.8: MD5 as implicit default digest This message should be used in the documentation of 3.4 to 3.7 and then it should produce: Deprecated since version 3.4, removed in version 3.8: MD5 as implicit default digest I'm not sure if Sphinx knows which Python version it is building the documentation for. This is the only instance were this is used with a version less than 3.9 so all other messages are currently correct. I think a new contributor should be able to fix this. -- assignee: docs@python components: Documentation messages: 370141 nosy: docs@python, remi.lapeyre priority: normal severity: normal status: open title: The deprecated-removed Sphinx extension need to change the error message based on the Python version type: behavior versions: Python 3.10, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue40798> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22250] unittest lowercase methods
Rémi Lapeyre added the comment: See for example https://mail.python.org/archives/list/python-id...@python.org/thread/4HE2GFL27LGBSHGWOBDOOBPEULC52U4D/#RC3QWQUX6VP56K2WXSMRZ5IGNAUBXKRI -- nosy: +remi.lapeyre ___ Python tracker <https://bugs.python.org/issue22250> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com