[issue38306] High level API for loop.run_in_executor(None, ...)?

2020-07-24 Thread Antoine Pietri
Antoine Pietri added the comment: Yeah I'm pretty sure this solves it: https://github.com/python/cpython/pull/20143 Closing the issue, thanks. -- resolution: -> fixed ___ Python tracker <https://bugs.python.org/issu

[issue38306] High level API for loop.run_in_executor(None, ...)?

2019-10-12 Thread Antoine Pietri
Antoine Pietri added the comment: Yes, that's why I'm in favor of calling it run_thread. Because it fundamentally *isn't* a way to run a function in an executor, it's a way to run a function in a thread. -- ___ Python tracker <ht

[issue38306] High level API for loop.run_in_executor(None, ...)?

2019-10-12 Thread Antoine Pietri
Antoine Pietri added the comment: On Sat, Oct 12, 2019 at 1:24 PM Caleb Hattingh wrote: > Even before task groups land, this API can be easily improved by adding > > asyncio.run_in_executor(func, *args, **kwargs) > > - Only valid inside a coro or async context (uses g

[issue38306] High level API for loop.run_in_executor(None, ...)?

2019-10-01 Thread Antoine Pietri
Antoine Pietri added the comment: > run_in_executor doesn't necessarily create a new thread each time so > create_thread would be misleading. run_in_thread might be better. Right, the idea was to have an analogy with create_task, because the run_in_executor would be wrapped in a Tas

[issue38306] High level API for loop.run_in_executor(None, ...)?

2019-09-28 Thread Antoine Pietri
Antoine Pietri added the comment: Actually I don't think it's possible with the current implementation to cancel the concurrent.Future after a timeout, so maybe we should remove that argument. So, this signature instead: async def create_thread(callable, *args, *, kwargs=None, loop=None

[issue38306] High level API for loop.run_in_executor(None, ...)?

2019-09-28 Thread Antoine Pietri
New submission from Antoine Pietri : In 3.7 a lot of high level functions have been added to the asyncio API, but nothing to start blocking functions as non-blocking threads. You still have to call get_event_loop() then await loop.run_in_executor(None, callable). I think this pattern

[issue10496] Python startup should not require passwd entry

2018-12-05 Thread Antoine Pietri
Antoine Pietri added the comment: Would it make sense to backport this fix in 3.6 and 3.7? As distros increasingly move in the direction of using DynamicUser=yes for most stateless services, it would really help to have that, for instance in Debian Buster (which will probably be on 3.7

[issue10496] Python startup should not require passwd entry

2018-12-05 Thread Antoine Pietri
Antoine Pietri added the comment: Trivial way to reproduce, run this as root: systemd-run -p DynamicUser=yes -t python3 -- nosy: +antoine.pietri ___ Python tracker <https://bugs.python.org/issue10

[issue34930] sha1module: Switch sha1 implementation to sha1dc/hardened sha1

2018-10-16 Thread Antoine Pietri
Antoine Pietri added the comment: Thanks, those arguments are convincing. I guess for applications that really can't move to a more secure hash, it would be better for them to rely on third-party libraries that implement the "band-aid". I'm closing this for now. --

[issue34961] Global scoping when shadowing local names in class definitions

2018-10-12 Thread Antoine Pietri
Antoine Pietri added the comment: Tracking down the issue a bit further: a = 10 def main(): a = 42 class wtf(): print(a) class wtf2(): print(a) a = 2 main() prints: 42 10 It seems that when

[issue34930] sha1module: Switch sha1 implementation to sha1dc/hardened sha1

2018-10-10 Thread Antoine Pietri
Antoine Pietri added the comment: On Wed, Oct 10, 2018 at 11:27 PM STINNER Victor wrote: > I dislike modifying a hash function to return its output but keep the same > name. For name, "SHA1" must remain "SHA1". If you want a variant, it should > have a diffe

[issue34930] sha1module: Switch sha1 implementation to sha1dc/hardened sha1

2018-10-08 Thread Antoine Pietri
New submission from Antoine Pietri : SHA-1 has been broken a while ago. While the general recommandation is to migrate to more recent hashes (like SHA-2 and SHA-3), a lot of industry applications (notably Merkle DAG implementations like Git or Blockchains) require backwards compatibility

[issue22674] RFE: Add signal.strsignal(): string describing a signal

2018-03-12 Thread Antoine Pietri
Antoine Pietri <antoine.piet...@gmail.com> added the comment: Done, https://github.com/python/cpython/pull/6085 As I said in the PR body, I can't test it myself, I don't have an OSX VM setup. -- ___ Python tracker <rep...@bugs.python.or

[issue22674] RFE: Add signal.strsignal(): string describing a signal

2018-03-12 Thread Antoine Pietri
Change by Antoine Pietri <antoine.piet...@gmail.com>: -- pull_requests: +5846 stage: needs patch -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue22674] RFE: Add signal.strsignal(): string describing a signal

2018-03-12 Thread Antoine Pietri
Antoine Pietri <antoine.piet...@gmail.com> added the comment: Yes, sorry, the issue is that we decided with pitrou to remove the osx specific handling. The fix should be: diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py index fbb12a5b67..ae0351e992 100644 --- a/Li

[issue22674] RFE: Add signal.strsignal(): string describing a signal

2018-03-07 Thread Antoine Pietri
Antoine Pietri <antoine.piet...@gmail.com> added the comment: I updated Vajrasky's patch to rebase it onto master, use the clinic argument parser and improve the docs. I made a PR on GitHub so the review can be easier than a patch. I left a Co-Authored-By field so I'm not st

[issue22674] RFE: Add signal.strsignal(): string describing a signal

2018-03-07 Thread Antoine Pietri
Change by Antoine Pietri <antoine.piet...@gmail.com>: -- pull_requests: +5784 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue29116] Make str and bytes error messages on concatenation conform with other sequences

2017-10-24 Thread Antoine Pietri
Change by Antoine Pietri <antoine.piet...@gmail.com>: -- keywords: +patch pull_requests: +4084 stage: -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue22674] strsignal() missing from signal module

2017-10-12 Thread Antoine Pietri
Antoine Pietri <antoine.piet...@gmail.com> added the comment: Hey everyone, We would like to have that feature for a project where we have to use ctypes to achieve that. I don't know the answers to vajrasky's questions but I just wanted to chime in to say having this feature would be g

[issue30762] Misleading message “can't concat bytes to str”

2017-06-26 Thread Antoine Pietri
Changes by Antoine Pietri <antoine.piet...@gmail.com>: -- components: +Interpreter Core ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue30762] Misleading message “can't concat bytes to str”

2017-06-26 Thread Antoine Pietri
Changes by Antoine Pietri <antoine.piet...@gmail.com>: -- pull_requests: +2447 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue30762] Misleading message “can't concat bytes to str”

2017-06-26 Thread Antoine Pietri
New submission from Antoine Pietri: >>> b'a' + 'a' Traceback (most recent call last): File "", line 1, in TypeError: can't concat bytes to str This error message is misleading because it is reversed: what is really happening is that we're concatenating str to bytes! W

[issue30177] pathlib.resolve(strict=False) only includes first child

2017-06-12 Thread Antoine Pietri
Changes by Antoine Pietri <antoine.piet...@gmail.com>: -- pull_requests: +2189 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue30177] pathlib.resolve(strict=False) only includes first child

2017-06-12 Thread Antoine Pietri
Changes by Antoine Pietri <antoine.piet...@gmail.com>: -- pull_requests: +2188 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue30177] pathlib.resolve(strict=False) only includes first child

2017-06-07 Thread Antoine Pietri
Antoine Pietri added the comment: The only backport was for 3.6 as the previous versions don't have the strict= parameter. PR submitted here: https://github.com/python/cpython/pull/1985 -- ___ Python tracker <rep...@bugs.python.org>

[issue30177] pathlib.resolve(strict=False) only includes first child

2017-06-07 Thread Antoine Pietri
Changes by Antoine Pietri <antoine.piet...@gmail.com>: -- pull_requests: +2052 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue30177] pathlib.resolve(strict=False) only includes first child

2017-06-06 Thread Antoine Pietri
Antoine Pietri added the comment: The code has been reviewed by (the other) Antoine, I guess there is now everything needed to merge it? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue30177] pathlib.resolve(strict=False) only includes first child

2017-06-05 Thread Antoine Pietri
Antoine Pietri added the comment: I updated the PR to fix the Windows part of the issue thanks to Zachary who gave me access to a Windows machine. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue30177] pathlib.resolve(strict=False) only includes first child

2017-06-01 Thread Antoine Pietri
Antoine Pietri added the comment: So, I asked a friend to check again with a more recent Python version on Windows and he can't reproduce the documented behavior, so the bug seems to also be present on Windows. My patch doesn't address that for now, which explains why the build fails (and why

[issue21044] tarfile does not handle file .name being an int

2017-06-01 Thread Antoine Pietri
Changes by Antoine Pietri <antoine.piet...@gmail.com>: -- stage: test needed -> resolved status: open -> closed ___ Python tracker <rep...@bugs.python.org> <http://bugs.

[issue24692] types.coroutines() idempotence documentation

2017-06-01 Thread Antoine Pietri
Antoine Pietri added the comment: I checked, the current doc gives a good explanation. I'm closing the issue. -- stage: patch review -> resolved status: open -> closed ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue30177] pathlib.resolve(strict=False) only includes first child

2017-05-31 Thread Antoine Pietri
Antoine Pietri added the comment: I added a fix for the tests and the code. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue30177] pathlib.resolve(strict=False) only includes first child

2017-05-31 Thread Antoine Pietri
Antoine Pietri added the comment: I'm on it. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30177> ___ ___ Python-bugs-list

[issue30177] pathlib.resolve(strict=False) only includes first child

2017-05-31 Thread Antoine Pietri
Antoine Pietri added the comment: By the way, I'm pasting what I said on the PR here: For what it's worth, this bug was the cause of an important downtime in our organization, because someone needed to normalize a path that was later passed to a .mkdir(parents=True), and it was, in some

[issue30177] pathlib.resolve(strict=False) only includes first child

2017-05-31 Thread Antoine Pietri
Antoine Pietri added the comment: In Windows/Python 3.6, the behavior matches the documented one, so this could actually be an important silent bug when executing a code wrote for Windows in another OS. I'd argue to fix it in 3.6 too. -- ___ Python

[issue30177] pathlib.resolve(strict=False) only includes first child

2017-04-30 Thread Antoine Pietri
Antoine Pietri added the comment: I can reproduce this bug. This behavior is really confusing. -- nosy: +seirl ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue24692] types.coroutines() idempotence documentation

2015-07-29 Thread Antoine Pietri
Antoine Pietri added the comment: Lgtm! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24692 ___ ___ Python-bugs-list mailing list Unsubscribe

[issue24692] types.coroutines() idempotence documentation

2015-07-23 Thread Antoine Pietri
New submission from Antoine Pietri: In the new types.coroutines() documentation, it is not clearly stated whether this function is idempotent or not: what happens when it is called on a function that is already a native coroutine? -- assignee: docs@python components: Documentation

[issue21044] tarfile does not handle file .name being an int

2014-07-17 Thread Antoine Pietri
Antoine Pietri added the comment: Also, Serhiy, I think you may have got me mixed up with someone else. I don’t think I did any patches here, so I probably shouldn’t be credited for them :) Yeah, but I don't mind if I'm not in the ACKS file for a one-line patch though :P

[issue21044] tarfile does not handle file .name being an int

2014-07-17 Thread Antoine Pietri
Antoine Pietri added the comment: This change does not need to be merged on 2.7 anyway, as the os.fdopen sets the name attribute to 'fdopen' and not to the fd, this check is not required prior to python 3. Still, it would be interesting to investigate why this breaks 2.7 though

[issue19776] Provide expanduser() on Path objects

2014-04-27 Thread Antoine Pietri
Antoine Pietri added the comment: I think that `absolute` method should call `expanduser` and `expandvars` (do you plan to include it?) automatically. This should be optional (via default arguments: `expanduser=True, expandvars=True`. I think it shouldn't. (Or shouldn't be set to True

[issue21044] tarfile does not handle file .name being an int

2014-04-05 Thread Antoine Pietri
Antoine Pietri added the comment: Well, that seems complicated: you can't overwrite a io.FileIO().name attribute, and doing so would be nonsensical for tarfile, which would try to perform IO operations on a random file descriptor... Also, I can't think of any case where a .name attribute

[issue13781] gzip module does the wrong thing with an os.fdopen()'ed fileobj

2014-04-05 Thread Antoine Pietri
Antoine Pietri added the comment: Actually, thinking about it, it seems safer to use os.open() + os.fdopen() than TemporaryFile(), like in the equivalent test for 'gzip'. This new patch replaces last one. -- nosy: +seirl Added file: http://bugs.python.org/file34740

[issue21044] tarfile does not handle file .name being an int

2014-03-30 Thread Antoine Pietri
Antoine Pietri added the comment: Ping. The patch is just one line and there's a test case, if someone could review that, it would be great! (For the record I signed the contributor agreement a week ago and my profile still hasn't been updated

[issue21044] tempfile.TemporaryFile() shouldn't have a name attribute

2014-03-24 Thread Antoine Pietri
Antoine Pietri added the comment: I attached a patch for tarfile with eryksun's suggestion. -- keywords: +patch Added file: http://bugs.python.org/file34603/tarfile-fileobjname.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue21044] tarfile does not handle file .name being an int

2014-03-24 Thread Antoine Pietri
Antoine Pietri added the comment: Here's the test case as requested by berkerpeksag in the patch review. -- Added file: http://bugs.python.org/file34605/test_tarfile_fobj_int.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue21044] tarfile does not handle file .name being an int

2014-03-24 Thread Antoine Pietri
Antoine Pietri added the comment: Yes, the bug report was originally titled like this (TemporaryFile should'nt have a name attribute) but apparently this is a common and expected behavior for FileIO subclasses. -- ___ Python tracker rep

[issue21044] tarfile does not handle file .name being an int

2014-03-24 Thread Antoine Pietri
Antoine Pietri added the comment: Well, this behavior seems pretty inconsistent to me, it means that every library has to check if the name attribute is actually a string (which would correspond to a path) or an int (that would mean a fd), and I think a fd attribute would seem more

[issue21044] tempfile.TemporaryFile() shouldn't have a name attribute

2014-03-23 Thread Antoine Pietri
New submission from Antoine Pietri: The fact that tempfile.TemporaryFile() has a name integer attribute causes weird behavior when interacting with libraries that rely on this attribute being a valid string for file objects. For instance, it led to this exception with the tarfile module

[issue21044] tempfile.TemporaryFile() shouldn't have a name attribute

2014-03-23 Thread Antoine Pietri
Antoine Pietri added the comment: Alternatively, if the name attribute can't be removed, I propose the following diff for the tarfile module: -if name is None and hasattr(fileobj, name): +if name is None and hasattr(fileobj, name) and isinstance(fileobj.name, str

[issue18145] Strange behavior when importing internal modules in the __init__.py of a submodule

2013-06-05 Thread Antoine Pietri
New submission from Antoine Pietri: I just found a very strange bug today, and it took me like two hours to figure out the problem. We first create a package package, which contains an __init__.py, which makes an absolute import of package/foo.py (import package.foo), which makes an absolute

[issue18145] Strange behavior when importing internal modules in the __init__.py of a submodule

2013-06-05 Thread Antoine Pietri
Antoine Pietri added the comment: Okay, maybe my message was unclear. I figured out on my own how to work around this issue (for instance using relative imports), the main problem for me is that this issue is very difficult to debug. The import statement should at least fail with a more